@@ -314,23 +314,19 @@ object Inliner {
314
314
val source2 = SourceFile .virtual(" tasty-reflect" , code)
315
315
inContext(ctx.fresh.setNewTyperState().setTyper(new Typer ).setSource(source2)) {
316
316
val tree2 = new Parser (source2).block()
317
- val res = collection.mutable.ListBuffer .empty[(ErrorKind , Error )]
318
-
319
- val parseErrors = ctx.reporter.allErrors.toList
320
- res ++= parseErrors.map(e => ErrorKind .Parser -> e)
321
- if res.isEmpty then
317
+ if ctx.reporter.allErrors.nonEmpty then
318
+ ctx.reporter.allErrors.map((ErrorKind .Parser , _))
319
+ else
322
320
val tree3 = ctx.typer.typed(tree2)
323
321
ctx.base.postTyperPhase match
324
- case postTyper : PostTyper =>
322
+ case postTyper : PostTyper if ctx.reporter.allErrors.isEmpty =>
325
323
val tree4 = atPhase(postTyper) { postTyper.newTransformer.transform(tree3) }
326
324
ctx.base.inliningPhase match
327
- case inlining : Inlining =>
328
- val tree5 = atPhase(inlining) { inlining.newTransformer.transform(tree4) }
325
+ case inlining : Inlining if ctx.reporter.allErrors.isEmpty =>
326
+ atPhase(inlining) { inlining.newTransformer.transform(tree4) }
329
327
case _ =>
330
328
case _ =>
331
- val typerErrors = ctx.reporter.allErrors.filterNot(parseErrors.contains)
332
- res ++= typerErrors.map(e => ErrorKind .Typer -> e)
333
- res.toList
329
+ ctx.reporter.allErrors.map((ErrorKind .Typer , _))
334
330
}
335
331
case t =>
336
332
report.error(em " argument to compileError must be a statically known String but was: $codeArg" , codeArg1.srcPos)
0 commit comments