-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:infercompat:javaitype:bugregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore
Description
Compiler version
3.8.0-RC1, 3.8.0-RC2, and latest nightly 3.8.1-RC1-bin-20251202-9eb843d-NIGHTLY
Minimized code
Put the two files below in a directory, cd into it, and run scala-cli compile .
TestJava.java
package example;
public abstract class TestJava<T> {
public abstract T create(String foo);
// Note that this is the method that's called from Scala code
public T create() { return create(""); }
public static class Concrete extends TestJava<String> {
@Override public String create(String foo) { return foo; }
}
}TestScala.scala
//> using scala 3.8.1-RC1-bin-20251202-9eb843d-NIGHTLY
val s = new example.TestJava.Concrete().create
val s2: String = sOutput
[error] ./TestScala.scala:3:18
[error] Found: (s : T)
[error] Required: String
[error] val s2: String = sExpectation
val s should be typed as a String since Concrete#create returns one. Interesting things to note:
- If I call
createascreate(), then the type is inferred correctly asString - If I annotate it as
val s: String, then the type is correct
noti0na1
Metadata
Metadata
Assignees
Labels
area:infercompat:javaitype:bugregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore