chapel icon indicating copy to clipboard operation
chapel copied to clipboard

Partial instantiations should not allow overriding of instantiated fields via named arguments

Open benharsh opened this issue 2 months ago • 1 comments

Consider the following program:

record pair { type fst; type snd; }

type x = pair(int, ?);
type y = x(fst=bool);

writeln(y : string); // produces pair(bool)

x is a pair(int, ?), but y is a pair(bool, ?). This, to me, is not consistent with the original intent of partial instantiations (the ability to incrementally build a generic type), and is potentially confusing.

We should make this an error and inform the user that the field fst is already instantiated.

benharsh avatar Sep 25 '25 21:09 benharsh

This came up in #27861 where the current behavior was replicated in dyno. If we decide to change this in the future, it will be much easier to do so in dyno where the behavior is clearly identified.

benharsh avatar Sep 25 '25 21:09 benharsh