Skip to content

Commit e8d081c

Browse files
authored
Merge pull request #15617 from dotty-staging/fix-15608
Don't check import selectors for Java code
2 parents e109dba + 747fa5c commit e8d081c

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,8 +1464,9 @@ trait Checking {
14641464
report.error(ImportRenamedTwice(sel.imported), sel.imported.srcPos)
14651465
seen += sel.name
14661466

1467-
for sel <- selectors do
1468-
if !sel.isWildcard then checkIdent(sel)
1467+
if !ctx.compilationUnit.isJava then
1468+
for sel <- selectors do
1469+
if !sel.isWildcard then checkIdent(sel)
14691470
end checkImportSelectors
14701471
}
14711472

tests/pos/i15608/bar/Test.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package bar
2+
3+
trait MDCAdapter
4+
5+
object ScalaMDCAdapter extends MDCAdapter {
6+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package foo;
2+
3+
import bar.MDCAdapter;
4+
import bar.ScalaMDCAdapter;
5+
import bar.ScalaMDCAdapter$;
6+
7+
public class JavaMDCBinder {
8+
public static final JavaMDCBinder SINGLETON = new JavaMDCBinder();
9+
10+
private JavaMDCBinder() {
11+
}
12+
13+
public MDCAdapter getMDCA() {
14+
return ScalaMDCAdapter$.MODULE$;
15+
}
16+
17+
public String getMDCAdapterClassStr() {
18+
return ScalaMDCAdapter.class.getName();
19+
}
20+
}

0 commit comments

Comments
 (0)