chapel
chapel copied to clipboard
dyno: resolving `init` of generic record causes assertion failure
This comes up when trying to resolve chpl_build_bounded_range
, which is how the production compiler resolves range literals like 1..10
. The minimal reproducer is as follows:
record myRange {
type idxType;
proc init(type idxType) {}
}
var rng = new myRange(int);
Likely this should be an error (idxType
isn't being set by the constructor). If I add this.idxType = idxType
to the body of the init
, the code above goes through. However, I'm also getting this while trying to resolve a plain range.init
, which does properly set idxType
:
proc range.init(type idxType, low: idxType, high: idxType) {
this.idxType = idxType;
this.bounds = boundKind.both;
this._low = chpl__idxToInt(low);
this._high = chpl__idxToInt(high);
}
So, the two TODOs are:
- Figure out why
range.init
is throwing an assertion here, despite havingidxType
set. - Make this not be an assertion error.