@@ -8,6 +8,7 @@ import Types._
8
8
import Contexts .Context
9
9
import Symbols ._
10
10
import Decorators ._
11
+ import Denotations .SingleDenotation
11
12
import SymDenotations .SymDenotation
12
13
import DenotTransformers ._
13
14
import TypeUtils ._
@@ -17,7 +18,7 @@ object ElimOpaque {
17
18
}
18
19
19
20
/** Rewrites opaque type aliases to normal alias types */
20
- class ElimOpaque extends MiniPhase with SymTransformer {
21
+ class ElimOpaque extends MiniPhase with DenotTransformer {
21
22
22
23
override def phaseName : String = ElimOpaque .name
23
24
@@ -27,14 +28,15 @@ class ElimOpaque extends MiniPhase with SymTransformer {
27
28
// base types of opaque aliases change
28
29
override def changesBaseTypes = true
29
30
30
- override def transformNonSymInfo (tp : Type , sym : Symbol )(implicit ctx : Context ): Type =
31
- if (sym.isOpaqueHelper) TypeAlias (tp.extractOpaqueAlias) else tp
32
-
33
- def transformSym (sym : SymDenotation )(implicit ctx : Context ): SymDenotation =
34
- if (sym.isOpaqueHelper) {
35
- sym.copySymDenotation(
36
- info = TypeAlias (sym.opaqueAlias),
37
- initFlags = sym.flags &~ (Opaque | Deferred ))
31
+ def transform (ref : SingleDenotation )(implicit ctx : Context ): SingleDenotation =
32
+ if (ref.symbol.isOpaqueHelper)
33
+ ref match {
34
+ case sym : SymDenotation =>
35
+ sym.copySymDenotation(
36
+ info = TypeAlias (sym.opaqueAlias),
37
+ initFlags = sym.flags &~ (Opaque | Deferred ))
38
+ case _ =>
39
+ ref.derivedSingleDenotation(ref.symbol, TypeAlias (ref.info.extractOpaqueAlias))
38
40
}
39
- else sym
41
+ else ref
40
42
}
0 commit comments