diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-10-09 10:03:24 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-10-09 10:11:54 +1000 |
commit | 44807a78522fdbc770ec9dbb56b6c8f7614f13b1 (patch) | |
tree | 16544ef6005d04fa3f3113e1e0c7444f5f41bd0a /src/reflect/scala/reflect/internal/Definitions.scala | |
parent | 9a8703450b09d5a671132865d3c26f64c3c2cfdf (diff) | |
download | scala-44807a78522fdbc770ec9dbb56b6c8f7614f13b1.tar.gz scala-44807a78522fdbc770ec9dbb56b6c8f7614f13b1.tar.bz2 scala-44807a78522fdbc770ec9dbb56b6c8f7614f13b1.zip |
SI-6613 Make Java enums work in FSC / REPL
We needed to hop from the enum's owner to its companion
module in an early phase of the compiler.
The enclosed test used to fail when this lookup returned
NoSymbol on the second run of the resident compiler when
triggered from `MixinTransformer`: the lookup didn't work
after the flatten info transform. This is related to the
fact that module classes are flattened into the enclosing
package, but module accessors remain in the enclosing class.
Diffstat (limited to 'src/reflect/scala/reflect/internal/Definitions.scala')
-rw-r--r-- | src/reflect/scala/reflect/internal/Definitions.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index 02578e2038..f5662b47c2 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -904,12 +904,14 @@ trait Definitions extends api.StandardDefinitions { ) } - def EnumType(sym: Symbol) = + def EnumType(sym: Symbol) = { // given (in java): "class A { enum E { VAL1 } }" // - sym: the symbol of the actual enumeration value (VAL1) // - .owner: the ModuleClassSymbol of the enumeration (object E) // - .linkedClassOfClass: the ClassSymbol of the enumeration (class E) - sym.owner.linkedClassOfClass.tpe + // SI-6613 Subsequent runs of the resident compiler demand the phase discipline here. + enteringPhaseNotLaterThan(picklerPhase)(sym.owner.linkedClassOfClass).tpe + } /** Given a class symbol C with type parameters T1, T2, ... Tn * which have upper/lower bounds LB1/UB1, LB1/UB2, ..., LBn/UBn, |