File tree 2 files changed +29
-10
lines changed
compiler/src/dotty/tools/dotc/transform
2 files changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -28,15 +28,21 @@ class ElimOpaque extends MiniPhase with DenotTransformer {
28
28
// base types of opaque aliases change
29
29
override def changesBaseTypes = true
30
30
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))
31
+ def transform (ref : SingleDenotation )(implicit ctx : Context ): SingleDenotation = {
32
+ val sym = ref.symbol
33
+ ref match {
34
+ case ref : SymDenotation if sym.isOpaqueHelper =>
35
+ ref.copySymDenotation(
36
+ info = TypeAlias (ref.opaqueAlias),
37
+ initFlags = ref.flags &~ (Opaque | Deferred ))
38
+ case ref : SymDenotation if sym.isOpaqueCompanion =>
39
+ val ref1 = ref.copySymDenotation(initFlags = ref.flags &~ Opaque )
40
+ ref1.registeredCompanion = NoSymbol
41
+ ref1
42
+ case _ if sym.isOpaqueHelper =>
43
+ ref.derivedSingleDenotation(sym, TypeAlias (ref.info.extractOpaqueAlias))
44
+ case _ =>
45
+ ref
40
46
}
41
- else ref
47
+ }
42
48
}
Original file line number Diff line number Diff line change
1
+ object O {
2
+ def m () = {
3
+ opaque type T = Int
4
+ object T
5
+ }
6
+ }
7
+ object A {
8
+ {
9
+ opaque type T = Int
10
+ object T
11
+ println
12
+ }
13
+ }
You can’t perform that action at this time.
0 commit comments