-
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 inheritance on same source
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.SliceTransforms` was changed, causing `xx.EvaluatorTestSupport` to invalidate. However, because of the missing same-source inheritance, it did not invalidate `xx.EvaluatorSpecification`. Calling `transform` method on a new `xx.EvaluatorSpecification` causes runtime error. Fixes sbt#417
- Loading branch information
Showing
10 changed files
with
84 additions
and
32 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
8 changes: 8 additions & 0 deletions
8
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,8 @@ | ||
{ | ||
"projects": [ | ||
{ | ||
"name": "mirtest", | ||
"scalaVersion": "2.11.8" | ||
} | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
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,12 @@ | ||
package gg | ||
package table | ||
|
||
trait SliceTransforms { | ||
def transform: Unit = { | ||
// the use site is updated | ||
buildNonemptyObjects(0, 1) | ||
} | ||
|
||
// add extra parameter here | ||
def buildNonemptyObjects(a: Int, b: Int): Unit = () | ||
} |
9 changes: 9 additions & 0 deletions
9
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,9 @@ | ||
package xx | ||
|
||
import gg.table._ | ||
|
||
trait EvaluatorSpecification extends EvaluatorTestSupport { | ||
} | ||
|
||
trait EvaluatorTestSupport extends SliceTransforms { | ||
} |
6 changes: 6 additions & 0 deletions
6
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,6 @@ | ||
package xx | ||
|
||
object Hello extends App { | ||
val consumer = new EvaluatorSpecification {} | ||
consumer.transform | ||
} |
10 changes: 10 additions & 0 deletions
10
zinc/src/sbt-test/source-dependencies/trait-trait-211/mirtest/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 { | ||
def transform: Unit = { | ||
buildNonemptyObjects(0) | ||
} | ||
|
||
def buildNonemptyObjects(a: Int): Unit = () | ||
} |
1 change: 1 addition & 0 deletions
1
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 @@ | ||
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,5 @@ | ||
> mirtest/run | ||
|
||
## After copying the Good implementation, we should be able to run successfully. | ||
$ copy-file changes/SliceTransforms1.scala mirtest/SliceTransforms.scala | ||
> mirtest/run |