Details
-
Type:
Bug
-
Status:
Reopened
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: X10 2.3.2
-
Component/s: X10 Compiler: Front-end Typechecking
-
Labels:None
-
Number of attachments :
Description
The following should not compile, because Ithree requires two boom fields (with different values, for fun, though the spec excludes the case where they are the same.) It does compile.
interface Ione { public static val boom = 1; } interface Itwo { public static val boom = 2; } interface Ithree extends Ione, Itwo {}
The fix is not easy. First it is in polyglot's code:
try {
return ts.findField(this.currentClass(), ts.FieldMatcher(this.currentClass(), name, this));
}
catch (SemanticException e) {
return null; // todo: we loose the error message! e.g., "Field XXX is ambiguous; it is defined in both ..."
}
Second, you need to fix this pattern of findVariableSilent, which should simply call findVariable, and if there is an exception, return null. But instead it does the opposite.
This should most definitely compile, because static fields can be (a) shadowed, and (b) unambiguously resolved by prepending them with the name of the containing class or interface. Any code that uses Ithree.boom should not compile, because of an ambiguity in referencing boom, but simply defining Ithree should not cause a compilation error.
If there is text in the spec that says that this should not compile, please reopen the issue and we'll see how that can be addressed (perhaps by fixing the spec).