Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: X10 2.3
-
Component/s: X10 Compiler: Front-end
-
Labels:None
-
Environment:Managed X10, java-interop-exceptions branch r24306.
-
Number of attachments :
Description
This is the reason of post-compilation failure with SelfArrayReference_* tests.
Following is the X10 source code and the generated Java code for SelfArrayReference_1.MyArray.
If you compare the lines labeled with XXX, you will see that the definition of val local variable ma is missing in AST level but it is included in arguments of AssignPropertyCall_c node.
SelfArrayReference_1.x10
class SelfArrayReference_1[T] {
class MyArray[ET](a:Array[ET], size: Int) {
def this(s: Int, e: ET) : MyArray[ET] {self.size == s} {
val ma = new Array[ET](s, e); // XXX definition of local variable ma is missing in the generated Java code
property(ma, s);
// property(new Array[ET](s, e), s); // this is OK
}
}
}
SelfArrayReference_1.java
class SelfArrayReference_1<$T> {
static class MyArray<$ET, $T1949> {
// constructor just for allocation
MyArray(java.lang.System[] $dummy, x10.rtt.Type $ET, x10.rtt.Type $T1949) {
$initParams(this, $ET, $T1949);
}
x10.rtt.Type $ET;
x10.rtt.Type $T1949;
// initializer of type parameters
static void $initParams(MyArray $this, x10.rtt.Type $ET, x10.rtt.Type $T1949) {
$this.$ET = $ET;
$this.$T1949 = $T1949;
}
x10.array.Array<$ET> a;
int size;
SelfArrayReference_1<$T1949> out$;
// creation method for java code (1-phase java constructor)
MyArray(x10.rtt.Type $ET,
x10.rtt.Type $T1949,
SelfArrayReference_1<$T1949> out$,
int s,
$ET e,
__0$1SelfArrayReference_1$MyArray$$T1949$2__2SelfArrayReference_1$MyArray$$ET $dummy) {
this((java.lang.System[]) null, $ET, $T1949);
SelfArrayReference_1$MyArray$$init$S(out$,s,e, (__0$1SelfArrayReference_1$MyArray$$T1949$2__2SelfArrayReference_1$MyArray$$ET) null);
}
// constructor for non-virtual call
MyArray<$ET, $T1949> SelfArrayReference_1$MyArray$$init$S(SelfArrayReference_1<$T1949> out$,
int s,
$ET e,
__0$1SelfArrayReference_1$MyArray$$T1949$2__2SelfArrayReference_1$MyArray$$ET $dummy) {
this.out$ = out$;
this.a = ma; // XXX definition of local variable ma is missing in the generated Java code
this.size = s;
return this;
}
MyArray SelfArrayReference_1$MyArray$$SelfArrayReference_1$MyArray$this() {
return MyArray.this;
}
SelfArrayReference_1 SelfArrayReference_1$MyArray$$SelfArrayReference_1$this() {
SelfArrayReference_1 t1951 = this.out$;
return t1951;
}
// synthetic type for parameter mangling
abstract static class __0$1SelfArrayReference_1$MyArray$$T1949$2__2SelfArrayReference_1$MyArray$$ET {}
}
}
Shrunk code a bit:
class SelfArrayReference_1 { class MyArray(myprop:Int) { def this() { val localVar = 42; property(localVar); } } }This code also works with native backend.