Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit df5efbe

Browse files
committedApr 8, 2019
Fix #6151: MatchError for imported java enum Values
When emitting annotations' arguments from the `DottyBackendInterface`, the case when the argument value can be an `Ident` is not considered. This commit generalises the `Select` case to `RefTree`, so that both `Select` and `Ident` are considered.
1 parent 574fd0c commit df5efbe

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed
 

‎compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
254254
}
255255
case t: TypeApply if (t.fun.symbol == Predef_classOf) =>
256256
av.visit(name, t.args.head.tpe.classSymbol.denot.info.toTypeKind(bcodeStore)(innerClasesStore).toASMType)
257-
case t: tpd.Select =>
257+
case t: tpd.RefTree =>
258258
if (t.symbol.denot.owner.is(Flags.JavaEnum)) {
259259
val edesc = innerClasesStore.typeDescriptor(t.tpe.asInstanceOf[bcodeStore.int.Type]) // the class descriptor of the enumeration class.
260260
val evalue = t.symbol.name.mangledString // value the actual enumeration value.

‎tests/pos/i6151/Expect.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public enum Expect { ExpectVal }

‎tests/pos/i6151/Outcome.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public @interface Outcome { Expect enm(); }

‎tests/pos/i6151/Test.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Expect._
2+
@Outcome(ExpectVal)
3+
class SimpleTest

0 commit comments

Comments
 (0)
Please sign in to comment.