- changed status to resolved
Missing type error in enhanced for when using type variable as iterated type
Issue #199
resolved
ExtendJ 8.0.1-166-gb66a11e Java SE 8
ExtendJ does not handle type analysis of the iterated expression in an enhanced for correctly.
The following should generate a type error:
// .result=COMPILE_FAIL
import java.util.List;
public class Test {
public <T extends List<Integer>> String join(T list) {
String str = "";
for (String a : list) {
str += a;
}
return str;
}
}
The attribute TypeDecl.iterableElementType()
is used to compute the element type of the expression in the enhanced for, however it does not compute the correct type when the type of the expression is represented by a type variable.
Comments (1)
-
reporter - Log in to comment
Improve type analysis for enhanced for
Added equation for iterableElementType() in TypeVariable.
fixes
#199(bitbucket)→ <<cset 94430cebedb3>>