-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label
Description
Compiler version
3.8.0-RC1
3.3.7
Minimized code
Foo.java
public class Foo<A> {
public <E> Foo(E i) {}
}
Test.scala
object Test {
val x1 = new Foo(1)
val x2 = new Foo[Int](1)
val x3 = new Foo[Int, Int](1)
}
Output
[error] -- [E007] Type Mismatch Error: Test.scala:2:8
[error] 10 | val x1 = new Foo(1)
[error] | ^
[error] | Found: Foo[Object, E]
[error] | Required: Foo[Object, E]
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] -- [E023] Syntax Error: Test.scala:3:15
[error] 11 | val x2 = new Foo[Int](1)
[error] | ^^^^^^^^^^^^^^^^
[error] | Not enough type arguments for Foo.<init>[A, E]
[error] | expected: [A, E]
[error] | actual: [Int]
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] -- [E023] Syntax Error: Test.scala:4:15
[error] 12 | val x3 = new Foo[Int, Int](1)
[error] | ^^^^^^^^^^^^^^^^^^^^^
[error] | Too many type arguments for Foo[A]
[error] | expected: [A]
[error] | actual: [Int, Int]
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] three errors found
[error] (Compile / compileIncremental) Compilation failedExpectation
I expect both x1 and x2 to compile cleanly. I only included x3 as a joke, since that is what the compiler urges you to write with that Not enough type arguments error message.
Metadata
Metadata
Assignees
Labels
itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label