Skip to content

🐛 fix(check): use open records for dict literals and improve dead code detection#1677

Merged
harehare merged 1 commit into
mainfrom
fix/typechecker-open-records-and-narrowing
May 2, 2026
Merged

🐛 fix(check): use open records for dict literals and improve dead code detection#1677
harehare merged 1 commit into
mainfrom
fix/typechecker-open-records-and-narrowing

Conversation

@harehare

@harehare harehare commented May 2, 2026

Copy link
Copy Markdown
Owner
  • Dict literals with all-string keys now use a fresh row variable instead of RowEmpty, allowing dicts with different optional fields to be unified without spurious type mismatches (e.g. arrays of state dicts where some entries omit a field like "n")
  • resolve_record_field_accesses now follows row variable chains recursively to find fields added via unification, while still reporting UndefinedField when the row chain ends with no matching field
  • detect_dead_then_branch skips Variables initialized from non-literal expressions (calls, field accesses, etc.) since their runtime type may differ from the statically inferred type

…e detection

- Dict literals with all-string keys now use a fresh row variable instead
  of RowEmpty, allowing dicts with different optional fields to be unified
  without spurious type mismatches (e.g. arrays of state dicts where some
  entries omit a field like "n")
- resolve_record_field_accesses now follows row variable chains recursively
  to find fields added via unification, while still reporting UndefinedField
  when the row chain ends with no matching field
- detect_dead_then_branch skips Variables initialized from non-literal
  expressions (calls, field accesses, etc.) since their runtime type may
  differ from the statically inferred type
@harehare harehare merged commit eb2e669 into main May 2, 2026
4 checks passed
@harehare harehare deleted the fix/typechecker-open-records-and-narrowing branch May 2, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant