Closed
Description
Compiler version
- 3.1.1
- 3.1.2-RC3
- 3.1.3-RC1-bin-20220323-fb7f900-NIGHTLY
Minimized code
import scala.quoted.*
object A {
transparent inline def foo(a: Any): Any = ${ impl('a) }
def impl(a: Expr[Any])(using Quotes) = {
foo(a)
Expr(())
}
}
Output (click arrow to expand)
[error] java.util.NoSuchElementException: None.get
[error] scala.None$.get(Option.scala:627)
[error] scala.None$.get(Option.scala:626)
[error] dotty.tools.dotc.typer.Typer.localTyper(Typer.scala:2779)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2807)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2894)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2960)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2964)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3080)
[error] dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1471)
[error] dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1461)
[error] dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1471)
[error] dotty.tools.dotc.typer.Namer$Completer.rhsToInline$1(Namer.scala:840)
[error] dotty.tools.dotc.typer.Namer$Completer.addInlineInfo$$anonfun$1(Namer.scala:842)
[error] dotty.tools.dotc.typer.PrepareInlineable$.$anonfun$3(PrepareInlineable.scala:273)
[error] dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:248)
[error] dotty.tools.dotc.typer.PrepareInlineable$.registerInlineInfo$$anonfun$1(PrepareInlineable.scala:273)
[error] dotty.tools.dotc.core.Annotations$LazyBodyAnnotation.tree(Annotations.scala:150)
[error] dotty.tools.dotc.typer.Inliner$.bodyToInline(Inliner.scala:53)
[error] dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:157)
[error] dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:3670)
[error] dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3787)
[error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3999)
[error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3329)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2960)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2964)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3013)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3036)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1067)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1071)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2840)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2895)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2960)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2964)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3080)
[error] dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1471)
[error] dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1461)
[error] dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1471)
[error] dotty.tools.dotc.typer.Namer.typedAheadRhs$1$$anonfun$1(Namer.scala:1708)
[error] dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:248)
[error] dotty.tools.dotc.typer.Namer.typedAheadRhs$1(Namer.scala:1708)
[error] dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:1716)
[error] dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1734)
[error] dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1735)
[error] dotty.tools.dotc.typer.Namer.inferredResultType(Namer.scala:1746)
[error] dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1510)
[error] dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1517)
[error] dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1586)
[error] dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:781)
[error] dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:912)
[error] dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:804)
[error] dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:167)
[error] dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
[error] dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
[error] dotty.tools.dotc.core.Types$TermRef.underlying(Types.scala:2649)
[error] dotty.tools.dotc.core.Types$Type.widen(Types.scala:1221)
[error] dotty.tools.dotc.typer.Typer.simplify(Typer.scala:2908)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2897)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2960)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2964)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3080)
[error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:898)
[error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1040)
[error] dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:327)
[error] dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:117)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2832)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2895)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2960)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2964)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3080)
[error] dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1471)
[error] dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1461)
[error] dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1471)
[error] dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1528)
[error] dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1586)
[error] dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:781)
[error] dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:912)
[error] dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:804)
[error] dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:167)
[error] dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
[error] dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
[error] dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:369)
[error] dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2773)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2798)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2894)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2960)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2964)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2986)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3036)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1067)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1071)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2840)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2895)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2960)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2964)
[error] dotty.tools.dotc.typer.Typer.typedFunctionValue(Typer.scala:1468)
[error] dotty.tools.dotc.typer.Typer.makeContextualFunction(Typer.scala:2946)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2892)
[error] dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$7(ProtoTypes.scala:462)
[error] dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:385)
[error] dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:463)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:866)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:866)
[error] dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:557)
[error] dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:622)
[error] dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:460)
[error] dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:748)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:865)
[error] dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1065)
[error] dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:327)
[error] dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:117)
[error] dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:911)
[error] dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$3(Applications.scala:991)
[error] dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3104)
[error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1002)
[error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1040)
[error] dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:327)
[error] dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:117)
[error] dotty.tools.dotc.typer.QuotesAndSplices.typedSplice(QuotesAndSplices.scala:111)
[error] dotty.tools.dotc.typer.QuotesAndSplices.typedSplice$(QuotesAndSplices.scala:28)
[error] dotty.tools.dotc.typer.Typer.typedSplice(Typer.scala:117)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2876)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2895)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2960)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2964)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3080)
[error] dotty.tools.dotc.typer.Typer.$anonfun$47(Typer.scala:2278)
[error] dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:248)
[error] dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2278)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2808)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2894)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2960)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2964)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2986)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3036)
[error] dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2476)
[error] dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2820)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2824)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2894)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2960)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2964)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2986)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3036)
[error] dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2603)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2865)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2895)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2960)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2964)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3080)
[error] dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:43)
[error] dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$adapted$1(TyperPhase.scala:50)
[error] scala.Function0.apply$mcV$sp(Function0.scala:39)
[error] dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:414)
[error] dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:50)
[error] dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:84)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:333)
[error] dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:84)
[error] dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:225)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1328)
[error] dotty.tools.dotc.Run.runPhases$1(Run.scala:236)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:244)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:253)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:253)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:186)
[error] dotty.tools.dotc.Run.compile(Run.scala:170)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
[error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:177)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:175)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:461)
[error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
[error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:416)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:503)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:403)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:169)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2366)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2316)
[error] sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:30)
[error] sbt.internal.io.Retry$.apply(Retry.scala:46)
[error] sbt.internal.io.Retry$.apply(Retry.scala:28)
[error] sbt.internal.io.Retry$.apply(Retry.scala:23)
[error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:30)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2314)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] sbt.Execute.work(Execute.scala:291)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] java.lang.Thread.run(Thread.java:750)
Note
compiler report correct error message if add explicit type
object A {
transparent inline def foo(a: Any): Any = ${ impl('a) }
- def impl(a: Expr[Any])(using Quotes) = {
+ def impl(a: Expr[Any])(using Quotes): Expr[Any] = {
foo(a)
Expr(())
}
[error] 7 | foo(a)
[error] | ^^^^^^
[error] | Cannot call macro method impl defined in the same source file
[error] one error found