Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't check import selectors for Java code #15617

Merged
merged 2 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Checking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1460,8 +1460,9 @@ trait Checking {
report.error(ImportRenamedTwice(sel.imported), sel.imported.srcPos)
seen += sel.name

for sel <- selectors do
if !sel.isWildcard then checkIdent(sel)
if !ctx.compilationUnit.isJava then
for sel <- selectors do
if !sel.isWildcard then checkIdent(sel)
end checkImportSelectors
}

Expand Down
6 changes: 6 additions & 0 deletions tests/pos/i15608/bar/Test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package bar

trait MDCAdapter

object ScalaMDCAdapter extends MDCAdapter {
}
20 changes: 20 additions & 0 deletions tests/pos/i15608/foo/JavaMDCBinder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package foo;

import bar.MDCAdapter;
import bar.ScalaMDCAdapter;
import bar.ScalaMDCAdapter$;

public class JavaMDCBinder {
public static final JavaMDCBinder SINGLETON = new JavaMDCBinder();

private JavaMDCBinder() {
}

public MDCAdapter getMDCA() {
return ScalaMDCAdapter$.MODULE$;
}

public String getMDCAdapterClassStr() {
return ScalaMDCAdapter.class.getName();
}
}