diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 14e4aecd55c9..f421c75f9287 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -1000,6 +1000,8 @@ class Namer { typer: Typer => ) match case Some(other) => No(i"overrides ${other.showLocated}, which is already a member of $cls") case None => Yes + else if sym.isAllOf(JavaModule) then + Skip else Yes } diff --git a/tests/neg/12249.scala b/tests/neg/12249.scala new file mode 100644 index 000000000000..81e8ce053584 --- /dev/null +++ b/tests/neg/12249.scala @@ -0,0 +1,9 @@ + +export java.util.UUID + +def bar = println(new UUID(1, 2)) // OK + +def foo = println(UUID.randomUUID()) // error +// ^^^^ +// Not found: UUID +