File tree Expand file tree Collapse file tree 9 files changed +217
-86
lines changed
compiler/src/dotty/tools/dotc/sbt
sbt-test/source-dependencies/extension-change-second-tparams Expand file tree Collapse file tree 9 files changed +217
-86
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -7,9 +7,7 @@ import dotty.tools.dotc.core.Names.Name
7
7
8
8
inline val TermNameHash = 1987 // 300th prime
9
9
inline val TypeNameHash = 1993 // 301st prime
10
- inline val EmptyParamHash = 1997 // 302nd prime
11
- inline val InlineParamHash = 1999 // 303rd prime
12
- inline val InlineValHash = 2003 // 304th prime
10
+ inline val InlineParamHash = 1997 // 302nd prime
13
11
14
12
extension (sym : Symbol )
15
13
Original file line number Diff line number Diff line change
1
+ object A {
2
+
3
+ class Box [T ](val value : T )
4
+
5
+ extension (box : Box [Int ]) def map [I <: Int ](f : Int => I ): Box [I ] = new Box (f(box.value))
6
+
7
+ }
Original file line number Diff line number Diff line change
1
+ import A .Box
2
+ import A .map
3
+
4
+ class B {
5
+ val n = Box (5 ).map(x => x * 3 )
6
+ }
Original file line number Diff line number Diff line change
1
+ import sbt .internal .inc .Analysis
2
+ import complete .DefaultParsers ._
3
+
4
+ // Reset compiler iterations, necessary because tests run in batch mode
5
+ val recordPreviousIterations = taskKey[Unit ](" Record previous iterations." )
6
+ recordPreviousIterations := {
7
+ val log = streams.value.log
8
+ CompileState .previousIterations = {
9
+ val previousAnalysis = (previousCompile in Compile ).value.analysis.asScala
10
+ previousAnalysis match {
11
+ case None =>
12
+ log.info(" No previous analysis detected" )
13
+ 0
14
+ case Some (a : Analysis ) => a.compilations.allCompilations.size
15
+ }
16
+ }
17
+ }
18
+
19
+ val checkIterations = inputKey[Unit ](" Verifies the accumulated number of iterations of incremental compilation." )
20
+
21
+ checkIterations := {
22
+ val expected : Int = (Space ~> NatBasic ).parsed
23
+ val actual : Int = ((compile in Compile ).value match { case a : Analysis => a.compilations.allCompilations.size }) - CompileState .previousIterations
24
+ assert(expected == actual, s " Expected $expected compilations, got $actual" )
25
+ }
Original file line number Diff line number Diff line change
1
+ object A {
2
+
3
+ class Box [T ](val value : T )
4
+
5
+ extension (box : Box [Int ]) def map [I ](f : Int => I ): Box [I ] = new Box (f(box.value))
6
+
7
+ }
Original file line number Diff line number Diff line change
1
+ // This is necessary because tests are run in batch mode
2
+ object CompileState {
3
+ @ volatile var previousIterations : Int = - 1
4
+ }
Original file line number Diff line number Diff line change
1
+ import sbt ._
2
+ import Keys ._
3
+
4
+ object DottyInjectedPlugin extends AutoPlugin {
5
+ override def requires = plugins.JvmPlugin
6
+ override def trigger = allRequirements
7
+
8
+ override val projectSettings = Seq (
9
+ scalaVersion := sys.props(" plugin.scalaVersion" )
10
+ )
11
+ }
Original file line number Diff line number Diff line change
1
+ > compile
2
+ > recordPreviousIterations
3
+ # Force recompilation of B because A.map, called by B.n, has changed
4
+ $ copy-file changes/A1.scala A.scala
5
+ > compile
6
+ # 1 to recompile A, then 1 more to recompile B due to A.map change
7
+ > checkIterations 2
You can’t perform that action at this time.
0 commit comments