Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Add scripted test for #1507 #1517

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ class IncHandler(directory: Path, cacheDir: Path, scriptedLog: ManagedLogger, co
onArgs("checkIterations") {
case (p, x :: Nil, i) => p.checkNumberOfCompilerIterations(i, x.toInt)
},
onArgs("checkNumberOfLibraries") {
case (p, x :: Nil, i) => p.checkNumberOfLibraries(i, x.toInt)
},
onArgs("checkCycles") {
case (p, x :: Nil, i) => p.checkNumberOfCycles(i, x.toInt)
},
Expand Down Expand Up @@ -525,6 +528,14 @@ case class ProjectStructure(
()
}

def checkNumberOfLibraries(i: IncState, expected: Int): Future[Unit] =
compile(i).map { analysis =>
val count = analysis.stamps.libraries.size
val msg = s"analysis.stamps.libraries.size = $count (expected $expected)"
assert(count == expected, msg)
()
}

def run(i: IncState, params: Seq[String]): Future[Unit] =
compile(i).map { analysis =>
discoverMainClasses(Some(analysis.apis)) match {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package A

class SRC[_]
class Refined {
def select() = new {
def using(opt: Option[SRC[_]] => Some[SRC[_]]) = opt
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package B

import A.Refined

class Client {
def temp = new Refined().select().using(null)
}
15 changes: 15 additions & 0 deletions zinc/src/sbt-test/source-dependencies/anon-class-dep/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"projects": [
{
"name": "B",
"dependsOn": [
"A"
],
"scalaVersion": "2.13.x"
},
{
"name": "A",
"scalaVersion": "2.13.x"
}
]
}
2 changes: 2 additions & 0 deletions zinc/src/sbt-test/source-dependencies/anon-class-dep/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> B/compile
> B/checkNumberOfLibraries 1
Loading