Skip to content

Commit d05e455

Browse files
committed
Demonstrate the problem.
This fails because A.scala doesn't get recompiled when B.scala is changed, so the number of iterations is 2 instead of 3.
1 parent 1e0d0e1 commit d05e455

File tree

6 files changed

+25
-13
lines changed

6 files changed

+25
-13
lines changed
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
class A(val c: C) {
2-
export c._
3-
}
4-
5-
object A {
6-
def create: A = new A(new C())
1+
class A {
2+
val b: B = new B
3+
export b._
74
}

sbt-dotty/sbt-test/source-dependencies/export-clauses/C.scala

Lines changed: 0 additions & 1 deletion
This file was deleted.

sbt-dotty/sbt-test/source-dependencies/export-clauses/D.scala

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import complete.DefaultParsers._
2+
3+
val checkIterations = inputKey[Unit]("Verifies the accumlated number of iterations of incremental compilation.")
4+
5+
checkIterations := {
6+
val analysis = (compile in Compile).value.asInstanceOf[sbt.internal.inc.Analysis]
7+
8+
val expected: Int = (Space ~> NatBasic).parsed
9+
val actual: Int = analysis.compilations.allCompilations.size
10+
assert(expected == actual, s"Expected $expected compilations, got $actual")
11+
}
12+
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
class B {
2-
val x: String = "x"
2+
val x: Int = 23
3+
val y: Int = 30
34
}
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
> compile
22
$ copy-file changes/B1.scala B.scala
3-
# Compilation of D.scala should fail because the signature of B.x changed
4-
-> compile
3+
> compile
4+
# This should be 3 because of:
5+
# 1. the first `compile` call
6+
# 2. the recompilation of B.scala
7+
# 3. this recompilation triggering a recompilation of A.scala
8+
# because B has a new member and A does a wildcard export
9+
# of a value of type B.
10+
> checkIterations 3

0 commit comments

Comments
 (0)