-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix backend assertion when using an exported enum
An exported enum is a <static> final method of the enum object. When selecting an inner enum case from it, that method will be the prefix. The method doesn't have a type symbol, we have to widen to method type and reach for its result type before we can get a handle on the type symbol to key off of. I wonder whether this widening and going to the result type is something that should happen during Erasure's denotation transformation though... Co-authored-by: Seth Tisue <[email protected]>
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
object MyApi { | ||
enum MyEnum(a: Int) { | ||
case A extends MyEnum(1) | ||
} | ||
case class Foo(a: MyEnum) | ||
} | ||
|
||
object Test { | ||
export MyApi.* | ||
import MyEnum.* | ||
Foo(MyEnum.A) match { | ||
case Foo(a) => | ||
a match { | ||
case A => | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
object MyTypes: | ||
enum MyEnum: | ||
case Foo | ||
case Bar | ||
|
||
object MyApi: | ||
export MyTypes.* | ||
|
||
object MyUse: | ||
import MyApi.MyEnum.Foo | ||
def foo = Foo | ||
|
||
@main def Test = assert(MyUse.foo.toString == "Foo") |