-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13953 from jodersky/jo/tasty-cache
Initialize quote cache on tasty inspector run
- Loading branch information
Showing
5 changed files
with
46 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
lazy val dottyVersion = sys.props("plugin.scalaVersion") | ||
|
||
lazy val lib = project | ||
.in(file("lib")) | ||
.settings( | ||
scalaVersion := dottyVersion | ||
) | ||
|
||
val jarDest = file("target") / "app.jar" | ||
|
||
val runTest = Def.taskKey[Unit]("run tests") | ||
|
||
lazy val inspector = project | ||
.in(file("inspector")) | ||
.settings( | ||
scalaVersion := dottyVersion, | ||
libraryDependencies += "org.scala-lang" %% "scala3-tasty-inspector" % scalaVersion.value, | ||
runTest := | ||
Def.sequential( | ||
Def.task(IO.copyFile((lib/Compile/packageBin).value, jarDest)), | ||
(Compile/run).toTask(" " + jarDest.getAbsolutePath) | ||
).value | ||
) | ||
.dependsOn(lib) |
14 changes: 14 additions & 0 deletions
14
sbt-test/sbt-dotty/tasty-inspector-cache/inspector/src/main/scala/main.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,14 @@ | ||
import scala.quoted.Quotes | ||
import scala.quoted.quotes | ||
import scala.tasty.inspector as ins | ||
|
||
// Test for https://github.com/lampepfl/dotty/issues/13919 | ||
class MyInspector extends ins.Inspector: | ||
def inspect(using Quotes)(tastys: List[ins.Tasty[quotes.type]]): Unit = | ||
import quotes.reflect._ | ||
TypeRepr.of[Int] | ||
TypeRepr.of[String] | ||
|
||
|
||
@main def main(args: String*): Unit = | ||
ins.TastyInspector.inspectTastyFilesInJar(args.head)(new MyInspector) |
1 change: 1 addition & 0 deletions
1
sbt-test/sbt-dotty/tasty-inspector-cache/lib/src/main/scala/dummy.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 @@ | ||
class Dummy // we need at least one file for the tasty inspector to run |
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 @@ | ||
> inspector/runTest |
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