@@ -188,7 +188,7 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
188
188
case _ =>
189
189
mapOver(tp)
190
190
case tp : ThisType if level != - 1 && level != levelOf(tp.cls) =>
191
- levelError(tp.cls, tp, pos, " " )
191
+ levelError(tp.cls, tp, pos)
192
192
case tp : AnnotatedType =>
193
193
val newAnnotTree = transform(tp.annot.tree)
194
194
derivedAnnotatedType(tp, apply(tp.parent), tp.annot.derivedAnnotation(newAnnotTree))
@@ -203,9 +203,9 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
203
203
case tp @ TypeRef (NoPrefix , _) if level > levelOf(tp.symbol) =>
204
204
tryHeal(tp.symbol, tp, pos)
205
205
case tp @ TermRef (NoPrefix , _) if ! tp.symbol.isStatic && level != levelOf(tp.symbol) =>
206
- levelError(tp.symbol, tp, pos, " " )
206
+ levelError(tp.symbol, tp, pos)
207
207
case tp : ThisType if level != - 1 && level != levelOf(tp.cls) =>
208
- levelError(tp.cls, tp, pos, " " )
208
+ levelError(tp.cls, tp, pos)
209
209
case _ =>
210
210
if tp.typeSymbol.is(Package ) then tp
211
211
else mapOver(tp)
@@ -225,27 +225,27 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
225
225
checkStable(tp, pos, " type witness" )
226
226
getQuoteTypeTags.getTagRef(tp)
227
227
case _ : SearchFailureType =>
228
- levelError(sym, tp, pos,
229
- i """
230
- |
231
- | The access would be accepted with the right type tag, but
232
- | ${ctx.typer.missingArgMsg(tag, reqType, " " )} """ )
228
+ ctx.error( i """ Reference to $tp withing quotes requires a $reqType in scope.
229
+ | ${ctx.typer.missingArgMsg(tag, reqType, " " )}
230
+ |
231
+ | """ , pos)
232
+ tp
233
233
case _ =>
234
- levelError(sym, tp, pos,
235
- i """
236
- |
237
- | The access would be accepted with a given $reqType """ )
234
+ ctx.error( i """ Reference to $tp withing quotes requires a $reqType in scope.
235
+ |
236
+ | """ , pos)
237
+ tp
238
238
}
239
239
240
- private def levelError (sym : Symbol , tp : Type , pos : SourcePosition , errMsg : String )(using Context ): tp.type = {
240
+ private def levelError (sym : Symbol , tp : Type , pos : SourcePosition )(using Context ): tp.type = {
241
241
def symStr =
242
242
if (! tp.isInstanceOf [ThisType ]) sym.show
243
243
else if (sym.is(ModuleClass )) sym.sourceModule.show
244
244
else i " ${sym.name}.this "
245
245
ctx.error(
246
246
em """ access to $symStr from wrong staging level:
247
247
| - the definition is at level ${levelOf(sym)},
248
- | - but the access is at level $level. $errMsg """ , pos)
248
+ | - but the access is at level $level. """ , pos)
249
249
tp
250
250
}
251
251
0 commit comments