We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build.sbt
scalaVersion := "3.1.2-RC2"
src/main/scala/Macros.scala
package example import scala.quoted.* object Macros { def fooImpl(a: Expr[Any])(using Quotes): Expr[Any] = a match { case '{ $x1: String } | '{ $x2: Int } => println((x1, x2)) a } inline def foo(a: Any) = ${fooImpl('a)} }
src/test/scala/Test.scala
package example object Test { def main(args: Array[String]): Unit = Macros.foo(3) }
sbt Test/run
java.lang.VerifyError: Bad local variable type Exception Details: Location: example/Macros$.fooImpl(Lscala/quoted/Expr;Lscala/quoted/Quotes;)Lscala/quoted/Expr; @179: aload Reason: Type top (current frame, locals[8]) is not assignable to reference type Current Frame: bci: @179 flags: { } locals: { 'example/Macros$', 'scala/quoted/Expr', 'scala/quoted/Quotes', 'scala/quoted/Expr', 'scala/Option' } stack: { 'scala/Predef$', 'scala/Tuple2$' } Bytecode: 0x0000000: 2b4e 2dc6 00a7 2cc0 000b b900 2701 002d 0x0000010: 2cc0 0029 122b 0101 b900 2f04 00b9 0033 0x0000020: 0300 3a04 1904 b600 399a 002f 1904 b600 0x0000030: 3cc0 003e 3a05 1905 3a06 1906 c600 1c19 0x0000040: 06b6 0041 c000 433a 0719 07c1 0043 9900 0x0000050: 0a19 073a 08a7 0058 2cc0 000b b900 2701 0x0000060: 002d 2cc0 0029 1245 0101 b900 2f04 00b9 0x0000070: 0033 0300 3a09 1909 b600 399a 002f 1909 0x0000080: b600 3cc0 003e 3a0a 190a 3a0b 190b c600 0x0000090: 1c19 0bb6 0041 c000 433a 0c19 0cc1 0043 0x00000a0: 9900 0a19 0c3a 0da7 0006 a700 17b2 004a 0x00000b0: b200 4f19 0819 0db6 0053 b600 572b a700 0x00000c0: 0cbb 0059 592d b700 5bbf b0 Stackmap Table: append_frame(@88,Object[#67],Object[#53]) chop_frame(@170,1) append_frame(@173,Object[#53]) chop_frame(@193,1) full_frame(@202,{Object[#2],Object[#67],Object[#97],Object[#67],Object[#53]},{Object[#67]}) while compiling /Users/kenji/aaa/src/test/scala/Test.scala [error] ## Exception when compiling 1 sources to /Users/kenji/aaa/target/scala-3.1.2-RC2/test-classes [error] java.lang.VerifyError: Bad local variable type [error] Exception Details: [error] Location: [error] example/Macros$.fooImpl(Lscala/quoted/Expr;Lscala/quoted/Quotes;)Lscala/quoted/Expr; @179: aload [error] Reason: [error] Type top (current frame, locals[8]) is not assignable to reference type [error] Current Frame: [error] bci: @179 [error] flags: { } [error] locals: { 'example/Macros$', 'scala/quoted/Expr', 'scala/quoted/Quotes', 'scala/quoted/Expr', 'scala/Option' } [error] stack: { 'scala/Predef$', 'scala/Tuple2$' } [error] Bytecode: [error] 0x0000000: 2b4e 2dc6 00a7 2cc0 000b b900 2701 002d [error] 0x0000010: 2cc0 0029 122b 0101 b900 2f04 00b9 0033 [error] 0x0000020: 0300 3a04 1904 b600 399a 002f 1904 b600 [error] 0x0000030: 3cc0 003e 3a05 1905 3a06 1906 c600 1c19 [error] 0x0000040: 06b6 0041 c000 433a 0719 07c1 0043 9900 [error] 0x0000050: 0a19 073a 08a7 0058 2cc0 000b b900 2701 [error] 0x0000060: 002d 2cc0 0029 1245 0101 b900 2f04 00b9 [error] 0x0000070: 0033 0300 3a09 1909 b600 399a 002f 1909 [error] 0x0000080: b600 3cc0 003e 3a0a 190a 3a0b 190b c600 [error] 0x0000090: 1c19 0bb6 0041 c000 433a 0c19 0cc1 0043 [error] 0x00000a0: 9900 0a19 0c3a 0da7 0006 a700 17b2 004a [error] 0x00000b0: b200 4f19 0819 0db6 0053 b600 572b a700 [error] 0x00000c0: 0cbb 0059 592d b700 5bbf b0 [error] Stackmap Table: [error] append_frame(@88,Object[#67],Object[#53]) [error] chop_frame(@170,1) [error] append_frame(@173,Object[#53]) [error] chop_frame(@193,1) [error] full_frame(@202,{Object[#2],Object[#67],Object[#97],Object[#67],Object[#53]},{Object[#67]}) [error] [error] java.lang.Class.getDeclaredFields0(Native Method) [error] java.lang.Class.privateGetDeclaredFields(Class.java:2583) [error] java.lang.Class.getField0(Class.java:2975) [error] java.lang.Class.getField(Class.java:1701) [error] dotty.tools.dotc.transform.Splicer$Interpreter.loadModule(Splicer.scala:400) [error] dotty.tools.dotc.transform.Splicer$Interpreter.liftedTree1$1(Splicer.scala:364) [error] dotty.tools.dotc.transform.Splicer$Interpreter.interpretedStaticMethodCall(Splicer.scala:371) [error] dotty.tools.dotc.transform.Splicer$Interpreter.interpretTree(Splicer.scala:267) [error] dotty.tools.dotc.transform.Splicer$Interpreter.interpretTree$$anonfun$2(Splicer.scala:288) [error] dotty.tools.dotc.transform.Splicer$.$anonfun$2(Splicer.scala:56) [error] scala.Option.fold(Option.scala:263) [error] dotty.tools.dotc.transform.Splicer$.splice(Splicer.scala:56) [error] dotty.tools.dotc.typer.Inliner.dotty$tools$dotc$typer$Inliner$$expandMacro(Inliner.scala:1825) [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1603) [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2809) [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2872) [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1686) [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937) [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941) [error] dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:62) [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2814) [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2872) [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1686) [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937) [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941) [error] dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:1054) [error] dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:160) [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:86) [error] dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53) [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60) [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1403) [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:95) [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:82) [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:103) [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) [error] dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53) [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60) [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:111) [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1466) [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120) [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) [error] dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53) [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60) [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1477) [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120) [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94) [error] dotty.tools.dotc.transform.Inlining$$anon$2.transform(Inlining.scala:72) [error] dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21) [error] dotty.tools.dotc.transform.Inlining.run(Inlining.scala:44) [error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:308) [error] scala.collection.immutable.List.map(List.scala:246) [error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:309) [error] dotty.tools.dotc.transform.Inlining.runOn(Inlining.scala:48) [error] dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:259) [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:270) [error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:278) [error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) [error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68) [error] dotty.tools.dotc.Run.compileUnits(Run.scala:287) [error] dotty.tools.dotc.Run.compileSources(Run.scala:220) [error] dotty.tools.dotc.Run.compile(Run.scala:204) [error] dotty.tools.dotc.Driver.doCompile(Driver.scala:39) [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) [error] [error] stack trace is suppressed; run last Test / compileIncremental for the full output [error] (Test / compileIncremental) java.lang.VerifyError: Bad local variable type [error] Exception Details: [error] Location: [error] example/Macros$.fooImpl(Lscala/quoted/Expr;Lscala/quoted/Quotes;)Lscala/quoted/Expr; @179: aload [error] Reason: [error] Type top (current frame, locals[8]) is not assignable to reference type [error] Current Frame: [error] bci: @179 [error] flags: { } [error] locals: { 'example/Macros$', 'scala/quoted/Expr', 'scala/quoted/Quotes', 'scala/quoted/Expr', 'scala/Option' } [error] stack: { 'scala/Predef$', 'scala/Tuple2$' } [error] Bytecode: [error] 0x0000000: 2b4e 2dc6 00a7 2cc0 000b b900 2701 002d [error] 0x0000010: 2cc0 0029 122b 0101 b900 2f04 00b9 0033 [error] 0x0000020: 0300 3a04 1904 b600 399a 002f 1904 b600 [error] 0x0000030: 3cc0 003e 3a05 1905 3a06 1906 c600 1c19 [error] 0x0000040: 06b6 0041 c000 433a 0719 07c1 0043 9900 [error] 0x0000050: 0a19 073a 08a7 0058 2cc0 000b b900 2701 [error] 0x0000060: 002d 2cc0 0029 1245 0101 b900 2f04 00b9 [error] 0x0000070: 0033 0300 3a09 1909 b600 399a 002f 1909 [error] 0x0000080: b600 3cc0 003e 3a0a 190a 3a0b 190b c600 [error] 0x0000090: 1c19 0bb6 0041 c000 433a 0c19 0cc1 0043 [error] 0x00000a0: 9900 0a19 0c3a 0da7 0006 a700 17b2 004a [error] 0x00000b0: b200 4f19 0819 0db6 0053 b600 572b a700 [error] 0x00000c0: 0cbb 0059 592d b700 5bbf b0 [error] Stackmap Table: [error] append_frame(@88,Object[#67],Object[#53]) [error] chop_frame(@170,1) [error] append_frame(@173,Object[#53]) [error] chop_frame(@193,1) [error] full_frame(@202,{Object[#2],Object[#67],Object[#97],Object[#67],Object[#53]},{Object[#67]})
The text was updated successfully, but these errors were encountered:
This code should emit the same error as
def fooImpl(a: Any): Any = a match { case (x1: String) | (x2: Int) => println((x1, x2)) a }
Sorry, something went wrong.
Either this check is not working properly or it should be repeated somewhere in QuotesAndSplices.scala.
Detect quoted pattern variables in alternatives
9ed7ac5
Fixes scala#14696
0b3b217
nicolasstucki
Successfully merging a pull request may close this issue.
Compiler version
Minimized code
build.sbt
src/main/scala/Macros.scala
src/test/scala/Test.scala
sbt Test/run
Output (click arrow to expand)
The text was updated successfully, but these errors were encountered: