diff --git a/flap/src/hopix/hopixTypechecker.ml b/flap/src/hopix/hopixTypechecker.ml index 74b98c8..38c7437 100644 --- a/flap/src/hopix/hopixTypechecker.ml +++ b/flap/src/hopix/hopixTypechecker.ml @@ -137,7 +137,7 @@ and pattern_literal : HopixTypes.typing_environment -> HopixAST.literal Position.located -> HopixTypes.aty * HopixTypes.typing_environment = - fun tenv l -> failwith "synth_pattern | Pliteral" + fun tenv l -> synth_literal l.value, tenv and pattern_variable : Position.t -> HopixTypes.aty * HopixTypes.typing_environment = fun pos -> HopixTypes.type_error pos "No types found." @@ -146,7 +146,13 @@ and pattern_tannot : HopixTypes.typing_environment -> HopixAST.pattern Position.located -> HopixAST.ty Position.located -> HopixTypes.aty * HopixTypes.typing_environment = - fun tenv p ty -> failwith "synth_pattern | PTypeAnnot" + fun tenv p ty -> + let aty_of_ty = HopixTypes.internalize_ty tenv ty in + match p.value with + | PWildcard -> aty_of_ty, tenv + | PVariable i -> aty_of_ty,HopixTypes.bind_value i.value (HopixTypes.monomorphic_type_scheme aty_of_ty) tenv + | _ -> let pattern_type, tenv = synth_pattern tenv p in + check_equal_types p.position ~expected:aty_of_ty ~given:pattern_type; pattern_type, tenv and pattern_tuple : HopixTypes.typing_environment -> HopixAST.pattern Position.located list