Skip to content

Commit 3ba57aa

Browse files
authored
Merge pull request #1517 from Friendseeker/zinc-1507-test
[1.x] Add scripted test for #1507
2 parents c2e459f + d49fdb8 commit 3ba57aa

File tree

5 files changed

+43
-0
lines changed

5 files changed

+43
-0
lines changed

internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala

+11
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ class IncHandler(directory: Path, cacheDir: Path, scriptedLog: ManagedLogger, co
225225
onArgs("checkIterations") {
226226
case (p, x :: Nil, i) => p.checkNumberOfCompilerIterations(i, x.toInt)
227227
},
228+
onArgs("checkNumberOfLibraries") {
229+
case (p, x :: Nil, i) => p.checkNumberOfLibraries(i, x.toInt)
230+
},
228231
onArgs("checkCycles") {
229232
case (p, x :: Nil, i) => p.checkNumberOfCycles(i, x.toInt)
230233
},
@@ -525,6 +528,14 @@ case class ProjectStructure(
525528
()
526529
}
527530

531+
def checkNumberOfLibraries(i: IncState, expected: Int): Future[Unit] =
532+
compile(i).map { analysis =>
533+
val count = analysis.stamps.libraries.size
534+
val msg = s"analysis.stamps.libraries.size = $count (expected $expected)"
535+
assert(count == expected, msg)
536+
()
537+
}
538+
528539
def run(i: IncState, params: Seq[String]): Future[Unit] =
529540
compile(i).map { analysis =>
530541
discoverMainClasses(Some(analysis.apis)) match {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package A
2+
3+
class SRC[_]
4+
class Refined {
5+
def select() = new {
6+
def using(opt: Option[SRC[_]] => Some[SRC[_]]) = opt
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package B
2+
3+
import A.Refined
4+
5+
class Client {
6+
def temp = new Refined().select().using(null)
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"projects": [
3+
{
4+
"name": "B",
5+
"dependsOn": [
6+
"A"
7+
],
8+
"scalaVersion": "2.13.x"
9+
},
10+
{
11+
"name": "A",
12+
"scalaVersion": "2.13.x"
13+
}
14+
]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
> B/compile
2+
> B/checkNumberOfLibraries 1

0 commit comments

Comments
 (0)