From 29922d1411a75f9fb4259d66e427070aae72b3d3 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 12 Aug 2022 17:49:40 -0400 Subject: Fixed test suite. --- stdlib/source/library/lux.lux | 62 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 9 deletions(-) (limited to 'stdlib/source/library/lux.lux') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 84f0ddf14..df7b4ef66 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -4298,6 +4298,56 @@ bound (type_variable idx bindings')))) +(def (clean_type variables it) + (-> (List [Nat (Maybe Type)]) Type Type) + (when it + {#Primitive name parameters} + {#Primitive name (list#each (clean_type variables) parameters)} + + {#Sum left right} + {#Sum (clean_type variables left) + (clean_type variables right)} + + {#Product left right} + {#Product (clean_type variables left) + (clean_type variables right)} + + {#Function left right} + {#Function (clean_type variables left) + (clean_type variables right)} + + {#Apply left right} + {#Apply (clean_type variables left) + (clean_type variables right)} + + {#UnivQ environment unquantified} + {#UnivQ (list#each (clean_type variables) environment) + (clean_type variables unquantified)} + + {#ExQ environment unquantified} + {#ExQ (list#each (clean_type variables) environment) + (clean_type variables unquantified)} + + {#Named name anonymous} + it + + {#Parameter _} + it + + {#Ex _} + it + + {#Var id} + (when (type_variable id variables) + {#None} + it + + {#Some {#Var _}} + it + + {#Some it} + (clean_type variables it)))) + (def (type_definition full_name) (-> Symbol (Meta Type)) (do meta#monad @@ -4324,22 +4374,16 @@ _ {#Left (all text#composite "Unknown var: " (symbol#encoded full_name))})))] (when temp - {#Right [compiler {#Var type_id}]} + {#Right [compiler temp]} (let [[..#info _ ..#source _ ..#current_module _ ..#modules _ ..#scopes _ ..#type_context type_context ..#host _ ..#seed _ ..#expected _ ..#location _ ..#extensions extensions ..#scope_type_vars _ ..#eval _eval] compiler [..#ex_counter _ ..#var_counter _ ..#var_bindings var_bindings] type_context] - (when (type_variable type_id var_bindings) - {#None} - temp - - {#Some actualT} - {#Right [compiler actualT]})) + {#Right [compiler (clean_type var_bindings temp)]}) _ - temp)) - ))) + temp))))) (def (list#all choice items) (All (_ a b) (-> (-> a (Maybe b)) (List a) (List b))) -- cgit v1.2.3