Skip to content

Commit

Permalink
Fix variance variance and forall naming
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikMcClure committed Jan 16, 2025
1 parent 7bff2c5 commit 366222a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions base-env.lua
Original file line number Diff line number Diff line change
Expand Up @@ -836,11 +836,16 @@ local function forall_impl(syntax, env)
---@cast env Environment
--print("moving on to return type")

local shadowed
local shadowed, inner_name
shadowed, env = env:enter_block(terms.block_purity.pure)
-- tail.start_anchor can be nil so we fall back to the start_anchor for this forall type if needed
-- TODO: use correct name in lambda parameter instead of adding an extra let
local inner_name = "forall(" .. table.concat(params_names, ", ") .. ")"
if params_single then
inner_name = "forall(" .. params_names .. ")"
else
inner_name = "forall(" .. table.concat(params_names, ", ") .. ")"
end

env = env:bind_local(
terms.binding.annotated_lambda(
inner_name,
Expand Down
6 changes: 3 additions & 3 deletions evaluator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1273,11 +1273,11 @@ add_comparer("value.variance_type", "value.variance_type", function(lctx, a, rct
local a_target = a:unwrap_variance_type()
local b_target = b:unwrap_variance_type()
typechecker_state:queue_subtype(
lctx,
a_target,
rctx,
b_target,
nestcause("variance target", cause, a_target, b_target)
lctx,
a_target,
nestcause("variance target", cause, b_target, a_target)
)
return true
end)
Expand Down

0 comments on commit 366222a

Please sign in to comment.