Skip to content

Suppress "no outer defs" check for Java sources #13108

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

Merged
merged 2 commits into from
Jul 23, 2021
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
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ class Typer extends Namer
if !curOwner.is(Package) || isDefinedInCurrentUnit(defDenot) then
result = checkNewOrShadowed(found, Definition) // no need to go further out, we found highest prec entry
found match
case found: NamedType if curOwner.isClass && isInherited(found.denot) =>
case found: NamedType
if curOwner.isClass && isInherited(found.denot) && !ctx.compilationUnit.isJava =>
checkNoOuterDefs(found.denot, ctx, ctx)
case _ =>
else
Expand Down
7 changes: 7 additions & 0 deletions tests/pos/i13106.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
final class A {
public static final class C { }
public static final class D {
public static final class C { }
public C foo() { return new C(); }
}
}