-
Bug
-
Resolution: Fixed
-
P4
-
repo-valhalla
-
generic
-
generic
Reported by Remi in Valhalla-dev:
The following program fails to compile:
public final __ByValue class GenBug<E> {
private final boolean value;
private GenBug() {
value = false;
throw new AssertionError();
}
public static <E> GenBug<E> create() {
GenBug<E> bug = __MakeDefault GenBug<E>();
bug = __WithField(bug.value, true);
return bug;
}
}
X.java:11: error: incompatible types: GenBug<E#1> cannot be converted to GenBug<E#2>
bug = __WithField(bug.value, true);
^
where E#1,E#2 are type-variables:
E#1 extends Object declared in class GenBug
E#2 extends Object declared in method <E#2>create()
The following program fails to compile:
public final __ByValue class GenBug<E> {
private final boolean value;
private GenBug() {
value = false;
throw new AssertionError();
}
public static <E> GenBug<E> create() {
GenBug<E> bug = __MakeDefault GenBug<E>();
bug = __WithField(bug.value, true);
return bug;
}
}
X.java:11: error: incompatible types: GenBug<E#1> cannot be converted to GenBug<E#2>
bug = __WithField(bug.value, true);
^
where E#1,E#2 are type-variables:
E#1 extends Object declared in class GenBug
E#2 extends Object declared in method <E#2>create()