Repository navigation
Fix two checker diagnostics found while dogfooding - #309
Merged
Merged
Conversation
The diagnostics for selecting from or calling a list method on a GraphQL
object list suggested `value.{id}`, the Dang 1.x selection syntax. In 2.x
that is a dot-block, so following the hint gave a syntax error. Suggest
`value.{{id}}` like the case-pattern hint already does, with the same
wording, and cover the select variant with a golden test.
Also refresh comments that still described selection (and inline fragment
bodies) with single braces.
Signed-off-by: Alex Suraci <[email protected]>
When `let c = <expr that fails to type-check>` failed in a block, a lambda or a function body, every later use of `c` also reported `"c" not found`. At the top level the binding fell back to a fresh type variable instead, which turned uses into errors about a type it never had (`Select.Infer: expected NonNullType or TypeScope, got hm.TypeVariable`). A failed declaration now binds its name to poisonType, at the top level and in blocks. Reading it (as a name, or a member through `self` or a type) fails with a poisonedError that InferenceErrors keeps as a failure without reporting, so the expression fails quietly, a declaration reading it is poisoned in turn, and only the original error is reported. Unrelated errors around it still are. A name the declaration gives a type itself keeps it, so its uses are still checked: an annotation, a function's declared signature (block-local functions included), or a type's hoisted constructor. A REPL entry that fails restores what it redefined and takes back what it declared, so a poisoned name never outlives it. The poisoned type shows as `unknown` in hover and completion: `<error>` broke Neovim's completion of nearby names. Signed-off-by: Alex Suraci <[email protected]>
Deploying dang with
|
| Latest commit: |
df051bc
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0980c3c0.dang-3kk.pages.dev |
| Branch Preview URL: | https://dogfood-diagnostic-fixes.dang-3kk.pages.dev |
vito
force-pushed
the
dogfood-diagnostic-fixes
branch
from
November 13, 2026 03:19
9cf374f to
df051bc
Compare
vito
added a commit
to dagger/dagger
that referenced
this pull request
Nov 13, 2026
Pulls in pitfall diagnostics (vito/dang#302), tree-sitter compiled to WebAssembly and run by wazero (vito/dang#303, #307): Dang no longer needs cgo anywhere, and its highlighter (dang.Highlight) is usable from any binary. Also checker diagnostics fixes (vito/dang#309): GraphQL object list hints suggest `value.{{id}}`, and a failed declaration no longer cascades "not found" errors through its uses. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
to dagger/dagger
that referenced
this pull request
Nov 13, 2026
Pulls in pitfall diagnostics (vito/dang#302), tree-sitter compiled to WebAssembly and run by wazero (vito/dang#303, #307): Dang no longer needs cgo anywhere, and its highlighter (dang.Highlight) is usable from any binary. Also checker diagnostics fixes (vito/dang#309): GraphQL object list hints suggest `value.{{id}}`, and a failed declaration no longer cascades "not found" errors through its uses. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
to dagger/dagger
that referenced
this pull request
Nov 13, 2026
Pulls in pitfall diagnostics (vito/dang#302), tree-sitter compiled to WebAssembly and run by wazero (vito/dang#303, #307): Dang no longer needs cgo anywhere, and its highlighter (dang.Highlight) is usable from any binary. Also checker diagnostics fixes (vito/dang#309): GraphQL object list hints suggest `value.{{id}}`, and a failed declaration no longer cascades "not found" errors through its uses. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 13, 2026
Hints for common mistakes get a section, with two errors as printed. Faster Dagger modules, failed declarations reported once and the GraphQL object list hint join the smaller changes. Go embedders learn that Dang no longer needs cgo, and about LoadTreeSitter. The lede and sources cover them, verified at 2918064. Signed-off-by: Alex Suraci <[email protected]>
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 checker/diagnostic bugs found while dogfooding, one commit each.
1. GraphQL object list hints suggested 1.x selection syntax
The hints for selecting from (or calling a list method on) a GraphQL object list suggested
value.{id}. In 2.x that's a dot-block, so following the hint literally gave a syntax error. They now sayvalue.{{id}}, worded like the existing case-pattern hint (ast_patterns.go). I also fixed comments and doc comments that still showed single-brace selections and inline-fragment bodies.Before:
After:
New golden:
select_on_graphql_object_list.2. Failed declarations no longer cascade
When
let c = <bad>failed in a block, a lambda or a function body, every later use reported"c" not found. At the top level the binding fell back to a fresh type variable, so uses failed with internal errors about a type it never had.A failed declaration now binds its name to
poisonType. Reading it, as a name or as a member throughself/a type, fails with apoisonedError.InferenceErrors.Addkeeps that as a failure without reporting it, so the reading expression fails quietly and a declaration that reads it is poisoned in turn. The original error is reported once, and unrelated errors are still reported.When the declaration itself gives the name a type, the name keeps that type, so its uses are still checked against it. That covers an annotation, a function's declared signature (including block-local functions) and a type's hoisted constructor. A REPL entry that fails now restores what it redefined and removes what it declared, so a poisoned name never outlives the entry.
Before:
After: only the original errors (
failed_declaration_does_not_cascade.golden):Two existing goldens lost their cascaded errors:
flow_sensitive_null_else_branch(aSelect.Infer ... hm.TypeVariableerror) andnarrowing_invalidated_nested_param_call(a"g" not founderror).Tests: the
TestFailedDeclarationsDontCascadetable (poison_test.go) covers top-level, block, lambda, function-body, nested-function, type-field,selfand annotation cases, plus cases where independent errors must still be reported.TestReplFailedEntryDeclaresNothingcovers the REPL.Notes for review:
unknown.<error>broke Neovim omni-completion of nearby names inTestLSP..agents/skills/testing/SKILL.mdgets a short section on the mechanism, because a new error collector that bypassesInferenceErrorswould leak"c" failed to type-check.letat all, because the types phase runs before the variables phase. It reports "not found" whether or not theletfailed.pubfield's initializer fails, the type has no constructor signature, so the type's name is poisoned. That's on purpose: there's no signature to check uses against.Checks: all Go test packages (including
TestLSP),fmt/stale,docs,test/nocgoandgo generatestaleness for every package pass.