Skip to content

Commit 2df18bf

Browse files
committed
Don't typecheck Scala2 macro calls in retyping mode
1 parent 00277e9 commit 2df18bf

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/typer/ReTyper.scala

+1
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,5 @@ class ReTyper extends Typer with ReChecking {
134134
override protected def addAccessorDefs(cls: Symbol, body: List[Tree])(using Context): List[Tree] = body
135135
override protected def checkEqualityEvidence(tree: tpd.Tree, pt: Type)(using Context): Unit = ()
136136
override protected def matchingApply(methType: MethodOrPoly, pt: FunProto)(using Context): Boolean = true
137+
override protected def typedScala2MacroBody(call: untpd.Tree)(using Context): Tree = promote(call)
137138
}

compiler/src/dotty/tools/dotc/typer/Typer.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -3900,7 +3900,7 @@ class Typer extends Namer
39003900
report.warning(PureExpressionInStatementPosition(original, exprOwner), original.srcPos)
39013901

39023902
/** Types the body Scala 2 macro declaration `def f = macro <body>` */
3903-
private def typedScala2MacroBody(call: untpd.Tree)(using Context): Tree =
3903+
protected def typedScala2MacroBody(call: untpd.Tree)(using Context): Tree =
39043904
// TODO check that call is to a method with valid signature
39053905
def typedPrefix(tree: untpd.RefTree)(splice: Context ?=> Tree => Tree)(using Context): Tree = {
39063906
tryAlternatively {

0 commit comments

Comments
 (0)