eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
164 stars 130 forks source link

[23] ECJ report "Short is not compatible with type short" in record pattern in switch #2936

Closed jarthana closed 1 month ago

jarthana commented 1 month ago

Here's the test case:

record Record<Short>(Short s) {}
public class X {
    public static <Short> short foo(Record<Short> s) {
        return switch (s) {
            case Record(short s1) -> s1; // error here
            default -> 0;
        };
    }
    public static void main(String[] args) {}
}

Javac accepts this, but ecj rejects with Record component with type Short is not compatible with type short

stephan-herrmann commented 1 month ago

Closing as fixed by #2947

(github doesn't autoclose in branches other than master)