Improve error messages: unimported module qualifiers and nominal-vs-record mismatches - #10290
Draft
jaredramirez wants to merge 4 commits into
Draft
Improve error messages: unimported module qualifiers and nominal-vs-record mismatches#10290jaredramirez wants to merge 4 commits into
jaredramirez wants to merge 4 commits into
Conversation
jaredramirez
force-pushed
the
jared/unimported-module-and-nominal-hints
branch
10 times, most recently
from
July 24, 2026 19:18
55e30af to
af74c35
Compare
jaredramirez
force-pushed
the
jared/unimported-module-and-nominal-hints
branch
from
July 25, 2026 15:09
af74c35 to
b738d44
Compare
jaredramirez
marked this pull request as ready for review
July 25, 2026 16:41
jaredramirez
marked this pull request as draft
July 25, 2026 16:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two error-reporting improvements, one commit each.
1. Clearer error when a qualified ident's module or type cannot be found
Previously, using
Stdin.line!()withoutimport pf.Stdinreported only:which reads as "this function doesn't exist" when the real problem may be a missing import. When a qualified ident fails to resolve because its leading qualifier is neither an imported module nor a type in scope, canonicalization now keeps the existing
qualified_ident_does_not_existdiagnostic andDOES NOT EXISTtitle while adding clearer context to the body:The suggested import uses the file header's platform shorthand (or first package shorthand) when one exists, and falls back to a bare
import Stdinotherwise. The diagnostic carries explicit lookup context: the missing-module-or-type path records the unresolved name and complete suggested import, while the existing missing-exposed-value path has its own context and retains the shorter report body. This avoids a duplicate unresolved-qualified-identifier diagnostic tag while keeping the renderer's behavior explicit.2. Field-level hints for nominal-vs-record type mismatches
A record that mismatches a nominal annotation like
previously showed only the two types with no hint. The snapshot type diff now opens a nominal type on exactly one side of a structure-vs-structure comparison and compares its declaration backing, so the usual record hints apply:
This is gated on the backing being visible from the module reporting the error — the nominal type is transparent, or it was declared in that module — mirroring
types.NominalType.canLiftInner(the same rule as whether a nominal type can be opened).SnapshotNominalTypenow carriesis_opaqueto make that check possible at report time.Testing
test/snapshots/can_import_missing_import_suggestion.md,test/snapshots/nominal/nominal_record_mismatch_field_hint.md; existing snapshots regenerated.zig build run-test-zig-module-canpasses, and all affected snapshots pass--check-expected --check-outputvalidation.run-test-zigrun passed (3432 passed / 0 failures). Thejson_decoder/http_header_decoderplatform steps fail with an ARC-certifier panic, which I verified is byte-identical on a clean checkout ofmain(pre-existing, unrelated).🤖 Generated with Claude Code
https://claude.ai/code/session_01DGo1pdehucvHBTSoGBm22n