Skip to content

Commit f28d708

Browse files
authored
Fix isJavaOverride test (#17096)
Fixes #17066
2 parents db170aa + 790051e commit f28d708

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ class ElimRepeated extends MiniPhase with InfoTransformer { thisPhase =>
8787
* signatures of a Java varargs method and a Scala varargs override are not the same.
8888
*/
8989
private def overridesJava(sym: Symbol)(using Context) =
90-
sym.owner.info.baseClasses.drop(1).exists { bc =>
90+
sym.memberCanMatchInheritedSymbols
91+
&& sym.owner.info.baseClasses.drop(1).exists { bc =>
9192
bc.is(JavaDefined) && {
9293
val other = bc.info.nonPrivateDecl(sym.name)
9394
other.hasAltWith { alt =>

tests/pos/i17066/Bar.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class Bar extends Foo:
2+
def this(xs: String*) = this()

tests/pos/i17066/Foo.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public class Foo {
2+
public Foo(String... xs) { }
3+
}

0 commit comments

Comments
 (0)