Skip to content

Commit

Permalink
fix missing unbox argument and prim tuple compare
Browse files Browse the repository at this point in the history
  • Loading branch information
aiverson committed Dec 13, 2023
1 parent 0eab9ad commit c41232b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions evaluator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ end

-- types of types
add_comparer(value.prim_type_type.kind, value.prim_type_type.kind, always_fits_comparer)
add_comparer("value.tuple_type", "value.tuple_type", function(a, b)
local function tuple_compare(a, b)
-- fixme lol
local placeholder = value.neutral(neutral_value.free(free.unique({})))
local tuple_types_a, na = infer_tuple_type_unwrapped(a, placeholder)
Expand All @@ -345,7 +345,9 @@ add_comparer("value.tuple_type", "value.tuple_type", function(a, b)
end
end
return true
end)
end
add_comparer("value.tuple_type", "value.tuple_type", tuple_compare)
add_comparer("value.prim_tuple_type", "value.prim_tuple_type", tuple_compare)
add_comparer("value.pi", "value.pi", function(a, b)
if a == b then
return true
Expand Down
6 changes: 3 additions & 3 deletions testfile.alc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let prim-array-set =
array[index] = elem
end
:
prim-func-type (T : (boxed prim-type)) (arr : (unbox (prim-array-type T))) (index : prim-number) (elem : (unbox T)) ->
prim-func-type (T : (boxed prim-type)) (arr : (unbox prim-type (prim-array-type T))) (index : prim-number) (elem : (unbox prim-type T)) ->

let prim-array-get =
intrinsic
Expand All @@ -45,7 +45,7 @@ let prim-array-get =
return array[index]
end
:
prim-func-type (T : (boxed prim-type)) (arr : (unbox (prim-array-type T))) (index : prim-number) -> (elem : (unbox T))
prim-func-type (T : (boxed prim-type)) (arr : (unbox prim-type (prim-array-type T))) (index : prim-number) -> (elem : (unbox prim-type T))


let prim-array-new =
Expand All @@ -55,7 +55,7 @@ let prim-array-new =
return {}
end
:
prim-func-type (T : (boxed prim-type)) -> (arr : (unbox (prim-array-type T)))
prim-func-type (T : (boxed prim-type)) -> (arr : (unbox prim-type (prim-array-type T)))

let array-type =
lambda ((T : prim-type))
Expand Down

0 comments on commit c41232b

Please sign in to comment.