File tree 3 files changed +8
-7
lines changed
compiler/src/dotty/tools/dotc 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -206,8 +206,8 @@ class CrossStageSafety extends TreeMapWithStages {
206
206
* The tag is generated by an instance of `QuoteTypeTags` directly if the splice is explicit
207
207
* or indirectly by `tryHeal`.
208
208
*/
209
- protected def healType (pos : SrcPos )(using Context ) =
210
- new HealType (pos)
209
+ protected def healType (pos : SrcPos )(tpe : Type )( using Context ) =
210
+ new HealType (pos).apply(tpe)
211
211
212
212
/** Check level consistency of terms references */
213
213
private def checkLevelConsistency (tree : Ident | This )(using Context ): Unit =
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class HealType(pos: SrcPos)(using Context) extends TypeMap {
51
51
if level == 0 then tp else getQuoteTypeTags.getTagRef(prefix)
52
52
case _ : NamedType | _ : ThisType | NoPrefix =>
53
53
if levelInconsistentRootOfPath(tp).exists then
54
- tryHeal(tp.symbol, tp, pos )
54
+ tryHeal(tp)
55
55
else
56
56
tp
57
57
case _ =>
@@ -82,7 +82,7 @@ class HealType(pos: SrcPos)(using Context) extends TypeMap {
82
82
* reference to a type alias containing the equivalent of `${summon[quoted.Type[T]]}`.
83
83
* Emits an error if `T` cannot be healed and returns `T`.
84
84
*/
85
- protected def tryHeal (sym : Symbol , tp : TypeRef , pos : SrcPos ): Type = {
85
+ protected def tryHeal (tp : TypeRef ): Type = {
86
86
val reqType = defn.QuotedTypeClass .typeRef.appliedTo(tp)
87
87
val tag = ctx.typer.inferImplicitArg(reqType, pos.span)
88
88
tag.tpe match
Original file line number Diff line number Diff line change @@ -36,8 +36,9 @@ class Staging extends MacroTransform {
36
36
tree match {
37
37
case PackageDef (pid, _) if tree.symbol.owner == defn.RootClass =>
38
38
val checker = new CrossStageSafety {
39
- override protected def healType (pos : SrcPos )(using Context ) = new HealType (pos) {
40
- override protected def tryHeal (sym : Symbol , tp : TypeRef , pos : SrcPos ): TypeRef = {
39
+ override protected def healType (pos : SrcPos )(tpe : Type )(using Context ) = new HealType (pos) {
40
+ override protected def tryHeal (tp : TypeRef ): TypeRef = {
41
+ val sym = tp.symbol
41
42
def symStr =
42
43
if (sym.is(ModuleClass )) sym.sourceModule.show
43
44
else i " ${sym.name}.this "
@@ -51,7 +52,7 @@ class Staging extends MacroTransform {
51
52
52
53
tp
53
54
}
54
- }
55
+ }.apply(tpe)
55
56
}
56
57
checker.transform(tree)
57
58
case _ =>
You can’t perform that action at this time.
0 commit comments