Details
-
Bug
-
Resolution: Fixed
-
P4
-
repo-valhalla
-
generic
-
generic
Description
Reported by Remi in amber-dev:
The following program does not compile on Valhalla lworld head:
// ---
import java.util.List;
public class X {
@__inline__ static class Foo<V> {
int x;
Foo(int x) { this.x = x; }
}
static void m(Foo foo) {
System.out.println("inline");
}
static void m(Foo.ref foo) {
System.out.println("ref");
}
public static void main(String[] args) {
List<Foo.ref<Integer>> list = List.of(new Foo<Integer>(3));
list.stream().forEach(e -> m(e));
}
}
// --
error: cannot select a static class from a parameterized type
X.java:18: error: method forEach in interface Stream<T> cannot be applied to given types;
list.stream().forEach(e -> m(e));
^
required: Consumer<? super Foo$ref<Integer>>
found: (e)->m(e)
reason: argument mismatch; incompatible parameter types in lambda expression
where T is a type-variable:
T extends Object declared in interface Stream
2 errors
The following program does not compile on Valhalla lworld head:
// ---
import java.util.List;
public class X {
@__inline__ static class Foo<V> {
int x;
Foo(int x) { this.x = x; }
}
static void m(Foo foo) {
System.out.println("inline");
}
static void m(Foo.ref foo) {
System.out.println("ref");
}
public static void main(String[] args) {
List<Foo.ref<Integer>> list = List.of(new Foo<Integer>(3));
list.stream().forEach(e -> m(e));
}
}
// --
error: cannot select a static class from a parameterized type
X.java:18: error: method forEach in interface Stream<T> cannot be applied to given types;
list.stream().forEach(e -> m(e));
^
required: Consumer<? super Foo$ref<Integer>>
found: (e)->m(e)
reason: argument mismatch; incompatible parameter types in lambda expression
where T is a type-variable:
T extends Object declared in interface Stream
2 errors