A failed value-param bind on a type-returning function (e.g.
`MakeC :: ($K: Count, $T: Type) -> Type { return [K]T; }` with
`a : MakeC(5_000_000_000, s64)`) emitted its correct range diagnostic
but then `instantiateTypeFunction` returned `null`, so
`resolveParameterizedWithBindings` fell through to an empty-struct
placeholder named after the function. The binding `a` got that
placeholder type, so a later `a.len` cascaded a bogus second error
`field 'len' not found on type 'MakeC'`.
The struct binder (`instantiateGenericStruct`) already returns
`.unresolved` here; the type-fn binder now matches it — a failed
value-param bind poisons to `.unresolved` instead of `null`, so the
caller propagates the diagnosed poison and the existing
`emitFieldError` suppression yields one clean diagnostic. Covers
every type-fn value-param failure mode: overflow via an aliased
constraint, a non-const arg, and an unknown type arg.
Regression: examples/1137-diagnostics-value-param-type-fn-no-cascade.sx
18 lines
607 B
Plaintext
18 lines
607 B
Plaintext
error: unknown type 'NoSuchType'
|
|
--> examples/1137-diagnostics-value-param-type-fn-no-cascade.sx:25:18
|
|
|
|
|
25 | c : MakeC(3, NoSuchType) = ---;
|
|
| ^^^^^^^^^^
|
|
|
|
error: value 5000000000 does not fit in u32 parameter K
|
|
--> examples/1137-diagnostics-value-param-type-fn-no-cascade.sx:23:15
|
|
|
|
|
23 | a : MakeC(5000000000, s64) = ---;
|
|
| ^^^^^^^^^^
|
|
|
|
error: generic value parameter 'K' must be a compile-time integer constant
|
|
--> examples/1137-diagnostics-value-param-type-fn-no-cascade.sx:24:15
|
|
|
|
|
24 | b : MakeC(get(), s64) = ---;
|
|
| ^^^^^
|