Skip to content

Commit

Permalink
Add output as macro classpath for suspended compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Oct 2, 2019
1 parent e440974 commit e436d28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/core/MacroClassLoader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ object MacroClassLoader {

private def makeMacroClassLoader(implicit ctx: Context): ClassLoader = trace("new macro class loader") {
val urls = ctx.settings.classpath.value.split(java.io.File.pathSeparatorChar).map(cp => java.nio.file.Paths.get(cp).toUri.toURL)
new java.net.URLClassLoader(urls, getClass.getClassLoader)
val out = ctx.settings.outputDir.value.jpath.toUri.toURL // to find classes in case of suspended compilation
new java.net.URLClassLoader(urls :+ out, getClass.getClassLoader)
}
}
4 changes: 4 additions & 0 deletions project/scripts/cmdTests
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ clear_out "$OUT"
"$SBT" ";dotc -d $OUT/out.jar $SOURCE; dotc -decompile -classpath $OUT/out.jar -color:never $MAIN" > "$tmp"
grep -qe "def main(args: scala.Array\[scala.Predef.String\]): scala.Unit =" "$tmp"

echo "testing sbt dotc with suspension"
clear_out "$OUT"
"$SBT" "dotc -d $OUT/out.jar tests/pos-macros/macros-in-same-project-1/Bar.scala tests/pos-macros/macros-in-same-project-1/Foo.scala" > "$tmp"

# check that missing source file does not crash message rendering
echo "testing that missing source file does not crash message rendering"
clear_out "$OUT"
Expand Down

0 comments on commit e436d28

Please sign in to comment.