16308, “BryantLam”, “'param’ness is lost in initializer with param argument”, “2020-08-27T22:47:48Z”
Summary of Problem
This code has an initializer with a param int
argument that does not preserve the param
ness of that argument.
class C {
param val: int;
}
record R {
forwarding var data; // or just `var data`
proc init(param val: int) {
this.data = forall j in 1..10 do new owned C(val);
// Above does not work. This will work:
// param _val = val;
// this.data = forall j in 1..10 do new owned C(_val);
}
}
proc main() {
param val = 8;
var r = new R(val);
}
.code.tio.chpl:8: In initializer:
.code.tio.chpl:9: error: unresolved call 'C.init(int(64))'
.code.tio.chpl:1: note: this candidate did not match: C.init(param val: int(64))
.code.tio.chpl:9: note: because non-param call actual argument #1
.code.tio.chpl:2: note: is passed to param formal 'param val: int(64)'
.code.tio.chpl:15: Initializer instantiated as: init(param val = 8)
Affects chpl version
1.20 through 1.23 pre-release