-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes undercompilation on local inheritance
In sbt 0.13 days, we could ignore the relationship between two classes defined in the same `*.scala` source file, because they will be compiled anyway, and the invalidation was done at the source file level. With class-based namehashing, the invalidation is done at the class level, so we can no longer ignore inheritance relationship coming from the same source. This fact is acknowledged in the existence of `LocalDependencyByInheritance`, but we still have old assumptions scattered around the xsbt-dependency implementation. This change changes two if expressions that was used to filter out dependency info coming from the same source. One might wonder why it's necessary to keep the local inheritance info, if two classes involved are compiled together anyways. The answer is transitive dependencies. Using trait-trait-211 as example, `gg.table.ObjectConcatHelpers` was changed, eventually causing `xx.EvaluatorTestSupport` to invalidate. However, because of the missing same-source inheritance, it did not invalidate `xx.EvaluatorSpecification`. This meant that neither `xx.StringLibSpecs` was invalidated, and resulting to a runtime error. Fixes sbt#417
- Loading branch information
Showing
15 changed files
with
122 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
zinc/src/sbt-test/source-dependencies/trait-trait-211/build.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"projects": [ | ||
{ | ||
"name": "mirtest", | ||
"scalaVersion": "2.11.8", | ||
"dependsOn": ["gg"] | ||
}, | ||
{ | ||
"name": "gg", | ||
"scalaVersion": "2.11.8" | ||
} | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
zinc/src/sbt-test/source-dependencies/trait-trait-211/changes/SliceTransforms1.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package gg | ||
package table | ||
|
||
trait SliceTransforms[F[+ _]] extends TableModule[F] | ||
with ObjectConcatHelpers { | ||
buildNonemptyObjects(0, 1) | ||
} | ||
|
||
trait ObjectConcatHelpers { | ||
def buildNonemptyObjects(a: Int, b: Int): Unit = () | ||
} |
5 changes: 5 additions & 0 deletions
5
zinc/src/sbt-test/source-dependencies/trait-trait-211/gg/ColumnarTableModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package gg | ||
package table | ||
|
||
trait ColumnarTableModule[F[+ _]] extends TableModule[F] | ||
with SliceTransforms[F] |
11 changes: 11 additions & 0 deletions
11
zinc/src/sbt-test/source-dependencies/trait-trait-211/gg/SliceTransforms.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package gg | ||
package table | ||
|
||
trait SliceTransforms[F[+ _]] extends TableModule[F] | ||
with ObjectConcatHelpers { | ||
buildNonemptyObjects(0) | ||
} | ||
|
||
trait ObjectConcatHelpers { | ||
def buildNonemptyObjects(a: Int): Unit = () | ||
} |
3 changes: 3 additions & 0 deletions
3
zinc/src/sbt-test/source-dependencies/trait-trait-211/gg/TableModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package gg | ||
|
||
trait TableModule[F[+ _]] |
8 changes: 8 additions & 0 deletions
8
zinc/src/sbt-test/source-dependencies/trait-trait-211/mirtest/EvaluatorModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package xx | ||
|
||
import gg._ | ||
|
||
// note changing the parent from TableModule to ColumnarTableModule here changes the result. | ||
trait EvaluatorModule[F[+ _]] extends TableModule[F] { | ||
def eval: String = "x" | ||
} |
12 changes: 12 additions & 0 deletions
12
zinc/src/sbt-test/source-dependencies/trait-trait-211/mirtest/EvaluatorSpecs.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package xx | ||
|
||
import gg.table._ | ||
|
||
trait EvaluatorSpecification[F[+_]] extends EvaluatorTestSupport[F] { self => | ||
} | ||
|
||
trait EvaluatorTestSupport[F[+_]] extends EvaluatorModule[F] | ||
with ColumnarTableModule[F] { outer => | ||
|
||
def consumeEval: String = eval | ||
} |
14 changes: 14 additions & 0 deletions
14
zinc/src/sbt-test/source-dependencies/trait-trait-211/mirtest/Hello.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package xx | ||
|
||
import gg.table._ | ||
|
||
object Hello extends App { | ||
def testEval: Unit = { | ||
val consumer = new StringLibSpecs[Option] {} | ||
consumer.consumeEval | ||
} | ||
testEval | ||
} | ||
|
||
trait StringLibSpecs[F[+_]] extends EvaluatorSpecification[F] { self => | ||
} |
2 changes: 2 additions & 0 deletions
2
zinc/src/sbt-test/source-dependencies/trait-trait-211/mirtest/incOptions.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
apiDebug = true | ||
relationsDebug = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
> mirtest/run | ||
|
||
$ copy-file changes/SliceTransforms1.scala gg/SliceTransforms.scala | ||
> mirtest/run |