-
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, 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
12 changed files
with
102 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" | ||
} | ||
] | ||
} |
10 changes: 10 additions & 0 deletions
10
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,10 @@ | ||
package gg | ||
package table | ||
|
||
trait SliceTransforms extends ObjectConcatHelpers { | ||
buildNonemptyObjects(0, 1) | ||
} | ||
|
||
trait ObjectConcatHelpers { | ||
def buildNonemptyObjects(a: Int, b: Int): Unit = () | ||
} |
10 changes: 10 additions & 0 deletions
10
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,10 @@ | ||
package gg | ||
package table | ||
|
||
trait SliceTransforms extends ObjectConcatHelpers { | ||
buildNonemptyObjects(0) | ||
} | ||
|
||
trait ObjectConcatHelpers { | ||
def buildNonemptyObjects(a: Int): Unit = () | ||
} |
10 changes: 10 additions & 0 deletions
10
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,10 @@ | ||
package xx | ||
|
||
import gg.table._ | ||
|
||
trait EvaluatorSpecification extends EvaluatorTestSupport { self => | ||
} | ||
|
||
trait EvaluatorTestSupport extends SliceTransforms { outer => | ||
def consumeEval: String = "x" | ||
} |
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 {} | ||
consumer.consumeEval | ||
} | ||
testEval | ||
} | ||
|
||
trait StringLibSpecs extends EvaluatorSpecification { 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 |