Skip to content

Fix undefined field access tests to assert TypeError::UndefinedField specifically#1366

Merged
harehare merged 2 commits intofix/typechecker-undefined-field-errorfrom
copilot/sub-pr-1365
Mar 1, 2026
Merged

Fix undefined field access tests to assert TypeError::UndefinedField specifically#1366
harehare merged 2 commits intofix/typechecker-undefined-field-errorfrom
copilot/sub-pr-1365

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 1, 2026

The undefined field access tests only asserted !result.is_empty(), which would pass for any type error—not just UndefinedField. Tests now assert the specific error variant and field name.

Changes

  • test_selector_undefined_field_on_closed_record — asserts TypeError::UndefinedField { field: "c", .. }
  • test_bracket_access_undefined_field_on_closed_record — asserts TypeError::UndefinedField { field: "missing", .. }
// Before
assert!(!result.is_empty(), "...");

// After
assert!(
    result.iter().any(|e| matches!(e, TypeError::UndefinedField { field, .. } if field == "missing")),
    "..."
);

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Address feedback on undefined field access error reporting Fix undefined field access tests to assert TypeError::UndefinedField specifically Mar 1, 2026
@harehare harehare marked this pull request as ready for review March 1, 2026 02:27
@harehare harehare merged commit 729c1e8 into fix/typechecker-undefined-field-error Mar 1, 2026
@harehare harehare deleted the copilot/sub-pr-1365 branch March 1, 2026 02:27
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.

2 participants