Skip to content

Update to 3.0.0-RC1 #12

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

Merged
merged 1 commit into from
Feb 17, 2021
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
2 changes: 1 addition & 1 deletion src/main/g8/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
val scala3Version = "3.0.0-M3"
val scala3Version = "3.0.0-RC1"

lazy val lib = project
.in(file("lib"))
Expand Down
15 changes: 8 additions & 7 deletions src/main/g8/inspector/src/main/scala/inspector/Inspector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@ package inspector

import scala.quoted._

import scala.tasty.inspector.TastyInspector
import scala.tasty.inspector._

object Inspector {

def showCodeOf(tastyFile: String): String = {
var tastyStr: String = null
val inspector = new TastyInspector {
protected def processCompilationUnit(using Quotes)(root: quotes.reflect.Tree): Unit = {
val inspector = new Inspector {
def inspect(using Quotes)(tastys: List[Tasty[quotes.type]]): Unit = {
import quotes.reflect._
val projectDir = new java.io.File( "." ).getCanonicalPath() + java.io.File.separator // To cleanup the paths in @SourceFile
tastyStr = root.show.replace(projectDir, "")
for tasty <- tastys do
val projectDir = new java.io.File( "." ).getCanonicalPath() + java.io.File.separator // To cleanup the paths in @SourceFile
tastyStr = tasty.ast.show.replace(projectDir, "")
}
}
inspector.inspectTastyFiles(List(tastyFile))
TastyInspector.inspectTastyFiles(List(tastyFile))(inspector)
tastyStr
}

}
4 changes: 2 additions & 2 deletions src/main/g8/inspector/src/main/scala/inspector/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package inspector

import scala.quoted._

@main def run =
val tastyFile = "lib/target/scala-3.0.0-M3/classes/lib/Greetings.tasty"
@main def run =
val tastyFile = "lib/target/scala-3.0.0-RC1/classes/lib/Greetings.tasty"
val tastyContents = Inspector.showCodeOf(tastyFile)
println(tastyContents)
4 changes: 2 additions & 2 deletions src/main/g8/inspector/src/test/scala/inspector/Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class InspectorTest {
| @scala.annotation.internal.SourceFile("lib/src/main/scala/lib/Greetings.scala") object Greetings {
| def hello(name: scala.Predef.String): scala.Predef.String = "Hello ".+(name)
| }
|}""".stripMargin,
Inspector.showCodeOf("lib/target/scala-3.0.0-M3/classes/lib/Greetings.tasty")
|}""".stripMargin,
Inspector.showCodeOf("lib/target/scala-3.0.0-RC1/classes/lib/Greetings.tasty")
)

}
Expand Down