18716, "twesterhout", "Improve error messages when missing 'new' keyword", "2021-11-11T13:36:23Z"
This is a feature request.
It would be great if the error messages could be improved slightly in cases when one forgets the new
keyword.
Suppose, I write the following:
record Int {
var x : int;
}
var x = Int(10); // should have written new Int(10)
the compiler is kind enough to explain what's going on:
error: invalid type specifier 'Int(10)'
note: type 'Int' is not generic
note: did you forget the 'new' keyword?
However, suppose I now write the following:
var x : list(int) = list([1, 2, 3]); // should have written new list([1, 2, 3])
the error message isn't helpful at all
error: invalid type specifier 'list([domain(1,int(64),false)] int(64))'
note: type specifier did not match: list(type eltType, param parSafe)
note: cannot instantiate type field 'eltType' with non-type
because the compiler is actually talking about a completely different init
overload.
Is there something that can be done here? or is it too involved?