diff options
-rw-r--r-- | src/dotty/tools/dotc/parsing/JavaParsers.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 2 | ||||
-rw-r--r-- | tests/pos/i879.java | 11 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/parsing/JavaParsers.scala b/src/dotty/tools/dotc/parsing/JavaParsers.scala index 7b9d29ce3..2457400bb 100644 --- a/src/dotty/tools/dotc/parsing/JavaParsers.scala +++ b/src/dotty/tools/dotc/parsing/JavaParsers.scala @@ -145,9 +145,9 @@ object JavaParsers { // ------------- general parsing --------------------------- /** skip parent or brace enclosed sequence of things */ - def skipAhead(): Unit = { + def skipAhead(openBraces: Int = 0): Unit = { var nparens = 0 - var nbraces = 0 + var nbraces = openBraces do { in.token match { case LPAREN => diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 3ca728895..569e4f7d5 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -1027,7 +1027,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit */ def ensureConstrCall(cls: ClassSymbol, parents: List[Tree])(implicit ctx: Context): List[Tree] = { val firstParent :: otherParents = parents - if (firstParent.isType && !(cls is Trait)) + if (firstParent.isType && !(cls is Trait) && !cls.is(JavaDefined)) typed(untpd.New(untpd.TypedSplice(firstParent), Nil)) :: otherParents else parents } diff --git a/tests/pos/i879.java b/tests/pos/i879.java new file mode 100644 index 000000000..6db5b77ff --- /dev/null +++ b/tests/pos/i879.java @@ -0,0 +1,11 @@ +class Foo { + Foo(int i) { + } +} + + +class Bar extends Foo { + Bar() { + super(10); + } +}
\ No newline at end of file |