You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: compiler/src/dotty/tools/dotc/config/ScalaSettings.scala
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,7 @@ class ScalaSettings extends Settings.SettingGroup {
77
77
valXreplLineWidth:Setting[Int] =IntSetting("-Xrepl-line-width", "Maximal number of columns per line for REPL output", 390)
78
78
valXfatalWarnings:Setting[Boolean] =BooleanSetting("-Xfatal-warnings", "Fail the compilation if there are any warnings.")
79
79
valXverifySignatures:Setting[Boolean] =BooleanSetting("-Xverify-signatures", "Verify generic signatures in generated bytecode.")
80
+
valXignoreScala2Macros:Setting[Boolean] =BooleanSetting("-Xignore-scala2-macros", "Ignore errors when compiling code that calls Scala2 macros, these will fail at runtime.")
Copy file name to clipboardExpand all lines: compiler/src/dotty/tools/dotc/typer/Typer.scala
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2756,6 +2756,24 @@ class Typer extends Namer
2756
2756
tree.tpe <:< wildApprox(pt)
2757
2757
readaptSimplified(Inliner.inlineCall(tree, pt))
2758
2758
}
2759
+
elseif (tree.symbol.isScala2Macro) {
2760
+
if (ctx.settings.XignoreScala2Macros.value) {
2761
+
ctx.warning("Scala 2 macro cannot be used in Dotty, this call will crash at runtime. See http://dotty.epfl.ch/docs/reference/dropped-features/macros.html", tree.sourcePos)
2762
+
tree
2763
+
} elseif (tree.symbol eq defn.StringContext_f) {
2764
+
// As scala.StringContext.f is defined in the standard library which
2765
+
// we currently do not bootstrap we cannot implement the macro the library.
2766
+
// To overcome the current limitation we intercept the call and rewrite it into
2767
+
// a call to dotty.internal.StringContext.f which we can implement using the new macros.
2768
+
// As the macro is implemented in the bootstrapped library, it can only be used from the bootstrapped compiler.
2769
+
valApply(TypeApply(Select(sc, _), _), args) = tree
0 commit comments