Skip to content

Commit af143fa

Browse files
fix: resolve type errors in lambda parameter inference
- Add explicit type annotation for exp_t parameter - Remove incorrect GenericType.t access in context.lua - Ensure proper type checking for FunctionType parameters Fixes compilation errors in context.tl:2387 and visitors.tl:1720
1 parent 03bb32b commit af143fa

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

teal/check/context.lua

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,14 +2378,9 @@ function Context:infer_lambda_parameters(node, expected)
23782378
return
23792379
end
23802380

2381-
-- normalize expected type (CRITICAL)
23822381
expected = self:to_structural(expected)
23832382

2384-
if expected.typename == "generic" then
2385-
expected = expected.t
2386-
end
2387-
2388-
if expected.typename ~= "function" then
2383+
if not (expected.typename == "function") then
23892384
return
23902385
end
23912386

teal/check/context.tl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,7 @@ function Context:infer_lambda_parameters(node: Node, expected: FunctionType)
23832383
-- Infer parameter types only if arity matches
23842384
if #actual_params == #expected_params then
23852385
for i, param in ipairs(actual_params) do
2386-
local exp_t = expected_params[i]
2386+
local exp_t: Type = expected_params[i]
23872387

23882388
if not param.argtype then
23892389
-- infer for unannotated parameters only

0 commit comments

Comments
 (0)