Repository navigation
Description
Corpus hit: snacks.nvim picker/source/lsp/init.lua:452 param-type-mismatch expected { …, filter: (fun(result: lsp.ResultItem) -> boolean)?, … }? but found { …, filter: fun(item: any), … }. It appeared with #80 (97247ef; corpus diff gate-d77de3fe-1121 gate-97247efb-1121). The handoff believed the table literal's closure was losing its return. Closer: the closure does return, a nil. That's because its param is typed with a name that doesn't resolve.
Repro
unresolved_param.lua, as-is (reduced from the snacks file with gndx emmylua reduce … --unless-bin=<gate-d77de3fe-1121>, then by hand):
---@param opts? {filter?:(fun(result:Missing):boolean)}
local function f(opts) return opts end
f({ filter = function(item) return item.kind end })
---@param filter fun(result:Missing):boolean
local function g(filter) return filter end
g(function(item) return item.kind end)
g(function(item) return true end)
return f, ggndx emmylua probe unresolved_param.lua --bin=~/.cache/gndx/emmylua-corpus/gate-d77de3fe-1121/emmylua_check (bin1 = pre-#80 fork d77de3f):
| hit | 0.25.1 | upstream | fork | bin1 | source |
|---|---|---|---|---|---|
unresolved_param.lua:1 type-not-found Type 'Missing' not found |
✓ | ✓ | ✓ | ✓ | ---@param opts? {filter?:(fun(result:Missing):boolean)} |
unresolved_param.lua:3 param-type-mismatch expected `{ filter: (fun(result: Missing) -> boolean)? }?` but found `{ filter: fun(item: any) }`. |
✓ | f({ filter = function(item) return item.kind end }) |
|||
unresolved_param.lua:3 undefined-field Undefined field `kind`. |
✓ | f({ filter = function(item) return item.kind end }) |
|||
unresolved_param.lua:3 undefined-field Undefined field: `kind` |
✓ | f({ filter = function(item) return item.kind end }) |
|||
unresolved_param.lua:5 type-not-found Type 'Missing' not found |
✓ | ✓ | ✓ | ✓ | ---@param filter fun(result:Missing):boolean |
unresolved_param.lua:7 param-type-mismatch expected `fun(result: Missing) -> boolean` but found `fun(item: unknown)`. |
✓ | ✓ | g(function(item) return item.kind end) |
||
unresolved_param.lua:7 undefined-field Undefined field `kind`. |
✓ | g(function(item) return item.kind end) |
|||
unresolved_param.lua:7 undefined-field Undefined field: `kind` |
✓ | ✓ | g(function(item) return item.kind end) |
||
unresolved_param.lua:8 unused item is never used, if this is intentional, prefix it with an underscore: _item |
✓ | ✓ | ✓ | ✓ | g(function(item) return true end) |
So the table-literal shape (L3) is new with #80. The bare-closure shape (L7) was already fork-only before it.
Why
On every 0.30 build, a field read on an unresolved type infers nil. (---@param m Missing then ---@type fun() local z = m.kind reports found nil on upstream and on the fork.) Upstream doesn't type this closure's item from the expected param (no undefined-field inside the closure on upstream). The fork does, so item: Missing, item.kind: nil, and the closure returns nil against -> boolean. Controls (each one feature changed from L7, all green on every build):
return true: the field read is load-bearing (L8 above);fun(result:any):boolean,fun(result:unknown):booleanorfun(result:table):boolean: the unresolved name is load-bearing;fun(result:Missing)(no return annotation): the return check is what reports.
In snacks, lsp.ResultItem = lsp.Symbol|lsp.CallHierarchyItem|{text?:string}. The lsp.* types don't resolve under the corpus's empty config. In a workspace that loads them, this shape doesn't arise. type-not-found already reports the cause.
Proposed: park
The corpus shows this once, only where a type doesn't resolve, and the root cause (a member of an unresolved type is nil, not unknown) is upstream's on every build. Fixing it would change how unresolved names lower, a new concept to remove 1 hit (AGENTS.md "Coarse and sound"). If it shows up in our repos, the Lua-side answer is the missing type or ---@cast.
Activity
mareklangiewicz commentedon Nov 22, 2026
Fixed in 8f00f19 (not pushed yet), but not the way this issue proposed: the "park" premise was wrong. Its root is not upstream design and it is not one hit.
nilfor everyRef/Defowner (vm.rsmissing_is_known), though its comment says "declared class instances". A name with no declaration knows nothing about its members; 0.25.1 reads it asunknown, and upstream's ownmember_missing_in_unionalready skips such a component. The same rule was wrong for an alias of a union (nil, where the inline union isunknown). Newmissing_member_is_known: a declared class/enum is known (nilstays), an alias reads like its target, an undeclared name isunknown.test_member_of_an_unresolved_type_is_unknown_not_nil, red → green, with guards (a declared class's and an object alias's missing member staynil;undefined-fieldstill reports every read). Mutant: making the alias arm answertruegoes RED on the two alias reads.gate-8f00f19a-1122vsgate-e18788c1-1122(60/60): +6 −586, net −580 (need-check-nil −483, param-type-mismatch −44, unnecessary-if −31, …). Againstv0251-1120(59 trees): 562 agree, 6 differ. The removed lines are falsenilhits whereverlsp.*/uv.*types do not resolve under the corpus's empty config.lsp/init.lua:452, is still reported. The--unless-binreduction above slid onto the nearby mechanism. The real one is a whole-literal check that endsUnresolvedand is reported as a mismatch; the 6 added lines share it. Filed as A table-literal argument is reported when its check against an expected alias of an unresolved name is Unresolved (fork-only via #80) #84 (proposed park, with the rejected fix and the upstream tests that pin that rule).gndx emmylua test2284 pass, lint PASS,install --with-gateCANDIDATE PASSES (luagnd, myhypr, neospector, config-nvim, ai-lsp CLEAN; corpus 60/60; determinism), installed0.30.0-main-8f00f19a;gndx gate allPASS,gndx nvim dev check emmyluaCLEAN.fix(infer): a member missing from an unresolved name or an alias of a…
docs/agents: a hit count is measured; a fix is confirmed on its corpu…
mareklangiewicz commentedon Nov 22, 2026
Upstream draft PR 1451 opened 2026-11-22, branch
fix-missing-member-of-unresolved-type(net vm.rs of 8f00f19 + 4a14dd9, hand-applied to main 70dbcf4; test adapted to main: the two closure cells dropped, since main does not type those closure params;texts_by_codehelper added).--red-at=origin/main:…/vm.rsRED -> GREEN; 1982 pass; lint PASS.Corpus
up-70dbcf4d-1120→up83-1122: 57387 → 54524 (−2873), much more than on the fork (−580). By code: need-check-nil −2794 (gitsigns −1724, grug-far −444). 2809 of 2828 changed lines agree withv0251-1120. Added: treesitter-contextcontext.lua:219unnecessary-if (looks true; not on the fork or 0.25.1); #84-shape blinkcompletion.lua:79, oil 600/628, sidekickquickfix.lua:54(the same as the fork); blinkconfig/sources.lua:80/81messages vary run to run on the port (1 of 3, then 0 of 4:corpus repeat rep83-1122,rep83b-1122), but not on main (3 of 3 the same,repmain-1122). Stacking upstream PR 1437 did not stop it (rep83s-1122). Not root-caused; the PR body says so.mareklangiewicz commentedon Nov 22, 2026
Upstream 1451: answered the bot review (EmmyLuaLs#1451 (comment)), no code change. Alias cycles (
A A,B C/C B) give no hits and no hang on 0.25.1, main, the fork and the port; no source found that reaches thevisitedguard. Still a draft.mareklangiewicz commentedon Nov 23, 2026
On the blink.cmp
config/sources.lua:76/80/81lines that varied on the 1451 port: upstream main 48ef52a varies there too.corpus repeat noise48-1123with 4 runs gives the pattern [1 0 1 1] / [0 1 0 0], so this is main's own run-to-run noise, not something 1451 adds. Measured while re-checking 1448 (#78).mareklangiewicz commentedon Nov 23, 2026
Upstream 1451 body updated 2026-11-23: the blink
config/sources.luacaveat now says the variation is main's own noise (4 runs of main 48ef52a, 1 differs). The branch a8b6139 still merges cleanly onto main 48ef52a. Still a draft.mareklangiewicz commentedon Nov 23, 2026
Re-measured upstream 1451 on main 48ef52a and marked it ready (2026-11-23). Merged main in (1f72bc3, pushed). Tests 1986 + 243 pass; lint PASS.
test_member_of_an_unresolved_type_is_unknown_not_nilgoes RED → GREEN with--red-at=origin/main:…/vm.rs. Corpusup-48ef52a0-1123→up83-1123: 57302 → 54436 (−2866); 2812 of the 2831 changed lines agree with 0.25.1. The added lines are the same ones as on 70dbcf4 (the four #84-shape lines, treesitter-contextcontext.lua:219, and main's noise). Body updated. CI green.