File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import ast.Trees._
13
13
import NameOps ._
14
14
import typer .Mode
15
15
import TreeTransforms .TransformerInfo
16
+ import StdNames ._
16
17
17
18
/** The preceding lambda lift and flatten phases move symbols to different scopes
18
19
* and rename them. This miniphase cleans up afterwards and makes sure that all
@@ -33,6 +34,19 @@ class RestoreScopes extends MiniPhaseTransform with IdentityDenotTransformer { t
33
34
// For top-level classes this does nothing.
34
35
val cls = tree.symbol.asClass
35
36
val pkg = cls.owner.asClass
37
+
38
+ // Bring back companion links
39
+ val companionClass = cls.info.decls.lookup(nme.COMPANION_CLASS_METHOD )
40
+ val companionModule = cls.info.decls.lookup(nme.COMPANION_MODULE_METHOD )
41
+
42
+ if (companionClass.exists) {
43
+ restoredDecls.enter(companionClass)
44
+ }
45
+
46
+ if (companionModule.exists) {
47
+ restoredDecls.enter(companionModule)
48
+ }
49
+
36
50
pkg.enter(cls)
37
51
val cinfo = cls.classInfo
38
52
tree.symbol.copySymDenotation(
You can’t perform that action at this time.
0 commit comments