Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Suppress "no outer defs" check for Java sources
Fixes #13106
  • Loading branch information
odersky committed Jul 19, 2021
commit ebe190d37e65e5e80d2a7ad04db165673b12e299
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 @@
public final class A {
public static final class C { }
public static final class D {
public static final class C { }
public C foo() { return new C(); }
}
}