Skip to content

Commit 1d65c5b

Browse files
committed
fix: imported symbol missing for companion module
1 parent 4992b4b commit 1d65c5b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Diff for: compiler/src/dotty/tools/dotc/core/ContextOps.scala

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ object ContextOps:
4141
else pre.findMember(name, pre, required, excluded)
4242
}
4343
else // we are in the outermost context belonging to a class; self is invisible here. See inClassContext.
44-
ctx.owner.findMember(name, ctx.owner.thisType, required, excluded)
44+
if ctx.isJava then
45+
javaFindMember(name, ctx.owner.thisType, lookInCompanion = true,required, excluded)
46+
else
47+
ctx.owner.findMember(name, ctx.owner.thisType, required, excluded)
4548
else
4649
ctx.scope.denotsNamed(name).filterWithFlags(required, excluded).toDenot(NoPrefix)
4750
}

Diff for: tests/pos/i17255/Baz.java

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package example;
2+
3+
import example.Foo$;
4+
5+
public class Baz {
6+
private static final Foo$ MOD = Foo$.MODULE$;
7+
}

0 commit comments

Comments
 (0)