resolve Array/Map generic instantiation with Comptime(_) params #74
Loading…
Reference in a new issue
No description provided.
Delete branch "us71/generic-res-for-array-map-comptime-value-params"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #71.
Summary
InstantiationArg<'db> { Type(Ty), Value(Literal) }andTyKind::Instantiated { name, args, body }, so a generic call's resolved args (types and comptime values alike) become part of the resultingTy's identity -Array(Int, 3)andArray(Int, 5)now intern as distinctTys even though their evaluated struct bodies are identical.evaluate_generic_callnow recognizesComptime(_)-kinded params (peeking the param's declared type shape directly, since it can't be resolved viaresolve_type_expr) and binds them againstInstantiationArg::Value, reporting a newGenericArgKindMismatchdiagnostic when a param/arg kind pair doesn't match.check_array_literal's[N]T[...]branch, which was passing the size expression's type (Ty::int) into generic-call resolution instead of its actual literal value - the root cause ofArray(Int, 3)/Array(Int, 5)previously being indistinguishable.resolve_type_expr'sTypeExpr::Genericbranch now threadsGenericArg::Valuethrough instead of discarding it, so annotation-position generics (let x: Array(Int, 3) = ...) resolve through the same path as literal-position ones."List","Array","Map","Comptime","type","self", primitive type names) into a newconstantsmodule.Test plan
cargo check/cargo clippycleanArray(Int, 3)resolution, bothGenericArgKindMismatchdirections,Mapresolving via a real declarationcargo test -p twill-checkpasses locally