Skip to content

Commit 16ae587

Browse files
committed
Fix #5010: check type parents have type arguments
We modify t3613 as it was written when AbstractListModel had no type parameter. We could alternatively infer type arguments (see scala/bug#11111), as scalac does, but that seems typically unhelpful. Instead, we only infer them for constructor applications.
1 parent 615fdc9 commit 16ae587

File tree

6 files changed

+6
-4
lines changed

6 files changed

+6
-4
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,7 @@ class Typer extends Namer
15931593
}
15941594
else seenParents += psym
15951595
if (tree.isType) {
1596+
checkSimpleKinded(result) // Not needed for constructor calls, as type arguments will be inferred.
15961597
if (psym.is(Trait) && !cls.is(Trait) && !cls.superClass.isSubClass(psym))
15971598
result = maybeCall(result, psym, psym.primaryConstructor.info)
15981599
}

tests/neg/i1643.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
trait T extends Array { // error
1+
trait T extends Array { // error // error
22
def t1(as: String*): Array[String] = { varargs1(as: _*) } // error
33
def t2(as: String*): Array[String] = { super.varargs1(as: _*) } // error
44
}

tests/neg/i5010.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class i0 extends Function0 // error

tests/neg/parser-stability-16.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class x0[x0] {
22
val x1 : x0
33
}
4-
trait x3 extends x0 {
4+
trait x3 extends x0 { // error
55
x1 = 0 object // error
66
// error

tests/neg/parser-stability-7.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class x0[x1] {
22
def x2: x1
33
}
4-
trait x3 extends x0 {
4+
trait x3 extends x0 { // error
55
class x2
66
var x2 = 0 // error
77
var x4 = x5 x2 // error

tests/run/t3613.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class Boopy {
22
private val s = new Schnuck
33
def observer : PartialFunction[ Any, Unit ] = s.observer
44

5-
private class Schnuck extends javax.swing.AbstractListModel {
5+
private class Schnuck extends javax.swing.AbstractListModel[Nothing] {
66
model =>
77
val observer : PartialFunction[ Any, Unit ] = {
88
case "Boopy" => fireIntervalAdded( model, 0, 1 )

0 commit comments

Comments
 (0)