Skip to content

scala.MatchError for imported java enum Values #6151

New issue

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

Closed
fkowal opened this issue Mar 23, 2019 · 0 comments
Closed

scala.MatchError for imported java enum Values #6151

fkowal opened this issue Mar 23, 2019 · 0 comments

Comments

@fkowal
Copy link

fkowal commented Mar 23, 2019

import org.openjdk.jcstress.annotations._
import org.openjdk.jcstress.annotations.Expect._

object ExTests {
  @Outcome.Outcomes(
    Array(
      new Outcome(id = Array("1"), expect = ACCEPTABLE)
    )
  )
  class SimpleTest {
  }
}

expect = ACCEPTABLE causes

scala.MatchError: Ident(ACCEPTABLE) (of class dotty.tools.dotc.ast.Trees$Ident)
at dotty.tools.backend.jvm.DottyBackendInterface.emitArgument(DottyBackendInterface.scala:308)
at dotty.tools.backend.jvm.DottyBackendInterface.emitAssocs$$anonfun$2(DottyBackendInterface.scala:325)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:18)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.TraversableLike$WithFilter.$anonfun$foreach$1(TraversableLike.scala:792)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:791)
at dotty.tools.backend.jvm.DottyBackendInterface.emitAssocs(DottyBackendInterface.scala:325)
at dotty.tools.backend.jvm.DottyBackendInterface.emitArgument(DottyBackendInterface.scala:308)
at dotty.tools.backend.jvm.DottyBackendInterface.emitArgument$$anonfun$4(DottyBackendInterface.scala:288)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:18)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:392)
at dotty.tools.backend.jvm.DottyBackendInterface.emitArgument(DottyBackendInterface.scala:289)
at dotty.tools.backend.jvm.DottyBackendInterface.emitAssocs$$anonfun$2(DottyBackendInterface.scala:325)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:18)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.TraversableLike$WithFilter.$anonfun$foreach$1(TraversableLike.scala:792)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:791)
at dotty.tools.backend.jvm.DottyBackendInterface.emitAssocs(DottyBackendInterface.scala:325)
at dotty.tools.backend.jvm.DottyBackendInterface.emitAnnotations$$anonfun$2(DottyBackendInterface.scala:318)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:18)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.TraversableLike$WithFilter.$anonfun$foreach$1(TraversableLike.scala:792)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:791)
at dotty.tools.backend.jvm.DottyBackendInterface.emitAnnotations(DottyBackendInterface.scala:319)
at dotty.tools.backend.jvm.BCodeHelpers$BCAnnotGen.emitAnnotations(BCodeHelpers.scala:277)
at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.initJClass(BCodeSkelBuilder.scala:152)
at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:93)
at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.visit(GenBCode.scala:213)
at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.run(GenBCode.scala:180)
at dotty.tools.backend.jvm.GenBCodePipeline.buildAndSendToDisk(GenBCode.scala:510)
at dotty.tools.backend.jvm.GenBCodePipeline.run(GenBCode.scala:476)
at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:54)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:309)
at scala.collection.immutable.List.map(List.scala:286)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:311)
at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:59)
at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:158)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:18)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198)
at dotty.tools.dotc.Run.runPhases$5(Run.scala:170)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:178)
at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:102)
at dotty.tools.dotc.Run.compileUnits(Run.scala:185)
at dotty.tools.dotc.Run.compileSources(Run.scala:120)
at dotty.tools.dotc.Run.compile(Run.scala:104)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:33)
at dotty.tools.dotc.Driver.process(Driver.scala:169)
at dotty.tools.dotc.Main.process(Main.scala)
at xsbt.CachedCompilerImpl.run(CachedCompilerImpl.java:69)
at xsbt.CompilerInterface.run(CompilerInterface.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:237)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:111)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:90)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:133)
at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:73)
at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:116)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:307)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:307)
at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:106)
at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:87)
at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:116)
at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:63)
at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:89)
at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:134)
at sbt.internal.inc.Incremental$.compile(Incremental.scala:80)
at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:67)
at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:311)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:269)
at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:159)
at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:238)
at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:69)
at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1549)
at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1523)
at scala.Function1.$anonfun$compose$1(Function1.scala:44)
at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:67)
at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
at sbt.Execute.work(Execute.scala:278)
at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

but when using =Enum.VALUE like so
expect = Expect.ACCEPTABLE
everything compiles fine

anatoliykmetyuk added a commit to dotty-staging/dotty that referenced this issue Apr 8, 2019
When emitting annotations' arguments from the `DottyBackendInterface`,
the case when the argument value can be an `Ident` is not considered.
This commit adds such a case and implements it similarly to that of
the `Select` one.
smarter added a commit that referenced this issue Apr 10, 2019
Fix #6151: MatchError for imported java enum Values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants