check map literals (bare, typed, keyed) #70
Loading…
Reference in a new issue
No description provided.
Delete branch "us57/map-literals"
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 #57.
Type-checks
Expr::MapLiteral:key_type/value_typewhen present are the source of truth for every entry (MapKeyMismatch/MapValueMismatchotherwise), otherwise every key and every value must each agree with the first entry's inferred type — same shape as #56's array-literal checking, including the samestarting_offset-based fix forTy::errorfallback symbols so two independently-broken entries can't collide into the same interned error type and silently dodge a mismatch diagnostic.Same result-type gap as #56, for the same reason: no
TyKindvariant exists yet for a generic container instantiation, so this returnsNonerather than a realMap(K, V)— tracked in #69 (repointed #56/#57's staleDependencynotes there, since #6 never actually covered this). The deadif has_mismatch { None } else { None }branches are left in deliberately, as a marker for what #69 needs to fill in.Test plan
cargo test --workspace(209 passing intwill-check; 8 new tests forcheck_map_literalcovering bare/typed matching, empty, mismatched key, and mismatched value)cargo clippy --workspace --all-targets --all-features