Skip to content

Commit 83fc85a

Browse files
committed
Rename tasty-consumer to tasty-inspector
Also rework TastyInspector API to simplify use.
1 parent b4c1d50 commit 83fc85a

File tree

23 files changed

+128
-154
lines changed

23 files changed

+128
-154
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ val `dotty-library-bootstrappedJS` = Build.`dotty-library-bootstrappedJS`
1111
val `dotty-sbt-bridge` = Build.`dotty-sbt-bridge`
1212
val `dotty-sbt-bridge-tests` = Build.`dotty-sbt-bridge-tests`
1313
val `dotty-staging` = Build.`dotty-staging`
14-
val `dotty-tasty-consumer` = Build.`dotty-tasty-consumer`
14+
val `dotty-tasty-inspector` = Build.`dotty-tasty-inspector`
1515
val `dotty-language-server` = Build.`dotty-language-server`
1616
val `dotty-bench` = Build.`dotty-bench`
1717
val `dotty-bench-bootstrapped` = Build.`dotty-bench-bootstrapped`

compiler/test/dotty/Properties.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ object Properties {
5353
/** dotty-staging jar */
5454
def dottyStaging: String = sys.props("dotty.tests.classes.dottyStaging")
5555

56-
/** dotty-tasty-consumer jar */
57-
def dottyTastyConsumer: String = sys.props("dotty.tests.classes.dottyTastyConsumer")
56+
/** dotty-tasty-inspector jar */
57+
def dottyTastyInspector: String = sys.props("dotty.tests.classes.dottyTastyInspector")
5858

5959
/** tasty-core jar */
6060
def tastyCore: String = sys.props("dotty.tests.classes.tastyCore")

compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ class BootstrappedOnlyCompilationTests extends ParallelTesting {
127127
aggregateTests(
128128
compileFilesInDir("tests/run-with-compiler", withCompilerOptions),
129129
compileFilesInDir("tests/run-staging", withStagingOptions),
130-
compileFilesInDir("tests/run-custom-args/tasty-consumer", withTastyConsumerOptions),
131-
compileDir("tests/run-custom-args/tasty-interpreter", withTastyConsumerOptions),
130+
compileFilesInDir("tests/run-custom-args/tasty-inspector", withTastyInspectorOptions),
131+
compileDir("tests/run-custom-args/tasty-interpreter", withTastyInspectorOptions),
132132
).checkRuns()
133133
}
134134

compiler/test/dotty/tools/vulpix/TestConfiguration.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ object TestConfiguration {
3939
lazy val withStagingClasspath =
4040
withCompilerClasspath + File.pathSeparator + mkClasspath(List(Properties.dottyStaging))
4141

42-
lazy val withTastyConsumerClasspath =
43-
withCompilerClasspath + File.pathSeparator + mkClasspath(List(Properties.dottyTastyConsumer))
42+
lazy val withTastyInspectorClasspath =
43+
withCompilerClasspath + File.pathSeparator + mkClasspath(List(Properties.dottyTastyInspector))
4444

4545
def mkClasspath(classpaths: List[String]): String =
4646
classpaths.map({ p =>
@@ -57,8 +57,8 @@ object TestConfiguration {
5757
defaultOptions.withClasspath(withCompilerClasspath).withRunClasspath(withCompilerClasspath)
5858
lazy val withStagingOptions =
5959
defaultOptions.withClasspath(withStagingClasspath).withRunClasspath(withStagingClasspath)
60-
lazy val withTastyConsumerOptions =
61-
defaultOptions.withClasspath(withTastyConsumerClasspath).withRunClasspath(withTastyConsumerClasspath)
60+
lazy val withTastyInspectorOptions =
61+
defaultOptions.withClasspath(withTastyInspectorClasspath).withRunClasspath(withTastyInspectorClasspath)
6262
val allowDeepSubtypes = defaultOptions without "-Yno-deep-subtypes"
6363
val allowDoubleBindings = defaultOptions without "-Yno-double-bindings"
6464
val picklingOptions = defaultOptions and (

docs/docs/reference/metaprogramming/tasty-inspect.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ title: "TASTy Inspection"
44
---
55

66
```scala
7-
libraryDependencies += "ch.epfl.lamp" %% "dotty-tasty-consumer" % scalaVersion.value
7+
libraryDependencies += "ch.epfl.lamp" %% "dotty-tasty-inspector" % scalaVersion.value
88
```
99

1010
TASTy files contain the full typed tree of a class including source positions
1111
and documentation. This is ideal for tools that analyze or extract semantic
1212
information of the code. To avoid the hassle of working directly with the TASTy
13-
file we provide the `TastyConsumer` which loads the contents and exposes it
13+
file we provide the `TastyInspector` which loads the contents and exposes it
1414
through the TASTy reflect API.
1515

1616

@@ -23,7 +23,7 @@ the following way.
2323
import scala.tasty.Reflection
2424
import scala.tasty.file._
2525

26-
class Consumer extends TastyConsumer {
26+
class Consumer extends TastyInspector {
2727
final def apply(reflect: Reflection)(root: reflect.Tree): Unit = {
2828
import reflect._
2929
// Do something with the tree
@@ -37,7 +37,7 @@ the class `foo.Bar` for a foo in the classpath.
3737
```scala
3838
object Test {
3939
def main(args: Array[String]): Unit = {
40-
ConsumeTasty("", List("foo.Bar"), new Consumer)
40+
InspectTasty("", List("foo.Bar"), new Consumer)
4141
}
4242
}
4343
```

project/Build.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -595,10 +595,10 @@ object Build {
595595
val asm = findArtifactPath(externalDeps, "scala-asm")
596596
val dottyCompiler = jars("dotty-compiler")
597597
val dottyStaging = jars("dotty-staging")
598-
val dottyTastyConsumer = jars("dotty-tasty-consumer")
598+
val dottyTastyInspector = jars("dotty-tasty-inspector")
599599
val dottyInterfaces = jars("dotty-interfaces")
600600
val tastyCore = jars("tasty-core")
601-
run(insertClasspathInArgs(args1, List(dottyCompiler, dottyInterfaces, asm, dottyStaging, dottyTastyConsumer, tastyCore).mkString(File.pathSeparator)))
601+
run(insertClasspathInArgs(args1, List(dottyCompiler, dottyInterfaces, asm, dottyStaging, dottyTastyInspector, tastyCore).mkString(File.pathSeparator)))
602602
} else run(args)
603603
},
604604

@@ -672,10 +672,10 @@ object Build {
672672
}
673673
val dottyInterfaces = jars("dotty-interfaces")
674674
val dottyStaging = jars("dotty-staging")
675-
val dottyTastyConsumer = jars("dotty-tasty-consumer")
675+
val dottyTastyInspector = jars("dotty-tasty-inspector")
676676
val tastyCore = jars("tasty-core")
677677
val asm = findArtifactPath(externalDeps, "scala-asm")
678-
extraClasspath ++= Seq(dottyCompiler, dottyInterfaces, asm, dottyStaging, dottyTastyConsumer, tastyCore)
678+
extraClasspath ++= Seq(dottyCompiler, dottyInterfaces, asm, dottyStaging, dottyTastyInspector, tastyCore)
679679
}
680680

681681
val fullArgs = main :: insertClasspathInArgs(args, extraClasspath.mkString(File.pathSeparator))
@@ -721,14 +721,14 @@ object Build {
721721
val jars = packageAll.value
722722
Seq(
723723
"-Ddotty.tests.classes.dottyStaging=" + jars("dotty-staging"),
724-
"-Ddotty.tests.classes.dottyTastyConsumer=" + jars("dotty-tasty-consumer"),
724+
"-Ddotty.tests.classes.dottyTastyInspector=" + jars("dotty-tasty-inspector"),
725725
)
726726
},
727727
packageAll := {
728728
packageAll.in(`dotty-compiler`).value ++ Seq(
729729
"dotty-compiler" -> packageBin.in(Compile).value.getAbsolutePath,
730730
"dotty-staging" -> packageBin.in(LocalProject("dotty-staging"), Compile).value.getAbsolutePath,
731-
"dotty-tasty-consumer" -> packageBin.in(LocalProject("dotty-tasty-consumer"), Compile).value.getAbsolutePath,
731+
"dotty-tasty-inspector" -> packageBin.in(LocalProject("dotty-tasty-inspector"), Compile).value.getAbsolutePath,
732732
"tasty-core" -> packageBin.in(LocalProject("tasty-core-bootstrapped"), Compile).value.getAbsolutePath,
733733
)
734734
}
@@ -807,10 +807,10 @@ object Build {
807807
javaOptions := (javaOptions in `dotty-compiler-bootstrapped`).value
808808
)
809809

810-
lazy val `dotty-tasty-consumer` = project.in(file("tasty-consumer")).
810+
lazy val `dotty-tasty-inspector` = project.in(file("tasty-inspector")).
811811
withCommonSettings(Bootstrapped).
812812
// We want the compiler to be present in the compiler classpath when compiling this project but not
813-
// when compiling a project that depends on dotty-tasty-consumer (see sbt-dotty/sbt-test/sbt-dotty/tasty-consumer-example-project),
813+
// when compiling a project that depends on dotty-tasty-inspector (see sbt-dotty/sbt-test/sbt-dotty/tasty-inspector-example-project),
814814
// but we always need it to be present on the JVM classpath at runtime.
815815
dependsOn(dottyCompiler(Bootstrapped) % "provided; compile->runtime; test->test").
816816
settings(commonBootstrappedSettings).
@@ -1121,7 +1121,7 @@ object Build {
11211121
publishLocal in `dotty-library-bootstrapped`,
11221122
publishLocal in `tasty-core-bootstrapped`,
11231123
publishLocal in `dotty-staging`,
1124-
publishLocal in `dotty-tasty-consumer`,
1124+
publishLocal in `dotty-tasty-inspector`,
11251125
publishLocal in `scala-library`,
11261126
publishLocal in `scala-reflect`,
11271127
publishLocal in `dotty-doc-bootstrapped`,
@@ -1332,7 +1332,7 @@ object Build {
13321332
def asDottyRoot(implicit mode: Mode): Project = project.withCommonSettings.
13331333
aggregate(`dotty-interfaces`, dottyLibrary, dottyCompiler, tastyCore, dottyDoc, `dotty-sbt-bridge`).
13341334
bootstrappedAggregate(`scala-library`, `scala-compiler`, `scala-reflect`, scalap,
1335-
`dotty-language-server`, `dotty-staging`, `dotty-tasty-consumer`, `dotty-tastydoc`).
1335+
`dotty-language-server`, `dotty-staging`, `dotty-tasty-inspector`, `dotty-tastydoc`).
13361336
dependsOn(tastyCore).
13371337
dependsOn(dottyCompiler).
13381338
dependsOn(dottyLibrary).
@@ -1371,7 +1371,7 @@ object Build {
13711371
def asDottyTastydoc(implicit mode: Mode): Project = project.withCommonSettings.
13721372
aggregate(`dotty-tastydoc-input`).
13731373
dependsOn(dottyCompiler).
1374-
dependsOn(`dotty-tasty-consumer`).
1374+
dependsOn(`dotty-tasty-inspector`).
13751375
settings(commonDocSettings)
13761376

13771377
def asDottyTastydocInput(implicit mode: Mode): Project = project.withCommonSettings.

sbt-dotty/sbt-test/sbt-dotty/tasty-consumer-example-project/app/Main.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import scala.tasty.file._
66
object Main extends App {
77

88

9-
class Consumer extends TastyConsumer {
9+
class Consumer extends TastyInspector {
1010
final def apply(reflect: Reflection)(root: reflect.Tree): Unit = {
1111
import reflect._
1212
val tastyStr = root.show
1313
println(tastyStr)
1414
}
1515
}
1616

17-
ConsumeTasty("", List("lib.Foo"), new Consumer)
17+
InspectTasty("", List("lib.Foo"), new Consumer)
1818

1919
}

sbt-dotty/sbt-test/sbt-dotty/tasty-consumer-example-project/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ lazy val app = project
1010
.in(file("app"))
1111
.settings(
1212
scalaVersion := dottyVersion,
13-
libraryDependencies += "ch.epfl.lamp" %% "dotty-tasty-consumer" % scalaVersion.value,
13+
libraryDependencies += "ch.epfl.lamp" %% "dotty-tasty-inspector" % scalaVersion.value,
1414
)
1515
.dependsOn(lib)

tasty-consumer/src/scala/tasty/file/ConsumeTasty.scala

Lines changed: 0 additions & 39 deletions
This file was deleted.

tasty-consumer/src/scala/tasty/file/TastyConsumer.scala

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)