Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: X10 2.0.3
-
Fix Version/s: X10 2.3.2
-
Labels:None
-
Environment:all
-
Testcase included:yes
-
Number of attachments :
Description
Given a class Foo with operator this: Baz, the following code does not compile:
val lf: List[Foo] = new ArrayList[Foo](); for (i: Baz in lf) { Console.OUT.println(i); }
./IterableTest.x10:24-26: ERROR: Loop domain x10.util.List[IterableTest.Foo]
{self==lf} is not a subtype of Iterable[IterableTest.Baz].
1 error.
Issue Links
- is depended upon by
-
XTENLANG-1365
Support for periodic array access
-
-
XTENLANG-2439
X10 2.2 language design decisions (umbrella)
-
- relates to
-
XTENLANG-1415
"for loops" are rejected if the constraint is wrong even for DYNAMIC_CALLS
-
A related problem is that a subclass of any Iterable class is not itself Iterable if the interface implementation refers to a field of the supertype.
Concretely, this means that a subclass of DistArray cannot be iterated, because DistArray implements Iterable[Point(dist.region.rank)]. A simplified example is attached in TestIterableSubclass.x10