File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -1383,7 +1383,11 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
1383
1383
/** Recover identifier prefix (e.g. this) if it exists */
1384
1384
def desugarIdentPrefix (tree : Ident )(using Context ): Tree = tree.tpe match {
1385
1385
case TermRef (prefix : TermRef , _) =>
1386
- ref(prefix)
1386
+ prefix.info match
1387
+ case mt : MethodType if mt.paramInfos.isEmpty && mt.resultType.typeSymbol.is(Module ) =>
1388
+ ref(mt.resultType.typeSymbol.sourceModule)
1389
+ case _ =>
1390
+ ref(prefix)
1387
1391
case TermRef (prefix : ThisType , _) =>
1388
1392
This (prefix.cls)
1389
1393
case _ =>
Original file line number Diff line number Diff line change
1
+ object MyApi {
2
+ enum MyEnum (a : Int ) {
3
+ case A extends MyEnum (1 )
4
+ }
5
+ case class Foo (a : MyEnum )
6
+ }
7
+
8
+ object Test {
9
+ export MyApi .*
10
+ import MyEnum .*
11
+ Foo (MyEnum .A ) match {
12
+ case Foo (a) =>
13
+ a match {
14
+ case A =>
15
+ }
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ object MyTypes :
2
+ enum MyEnum :
3
+ case Foo
4
+ case Bar
5
+
6
+ object MyApi :
7
+ export MyTypes .*
8
+
9
+ object MyUse :
10
+ import MyApi .MyEnum .Foo
11
+ def foo = Foo
12
+
13
+ @ main def Test = assert(MyUse .foo.toString == " Foo" )
You can’t perform that action at this time.
0 commit comments