diff --git a/flap/src/hopix/hopixTypechecker.ml b/flap/src/hopix/hopixTypechecker.ml index a7140cd..b4c22d1 100644 --- a/flap/src/hopix/hopixTypechecker.ml +++ b/flap/src/hopix/hopixTypechecker.ml @@ -116,6 +116,7 @@ and synth_pattern = fun env Position.{ value = p; position = pos } -> match p with +<<<<<<< HEAD | PWildcard -> assert false | PLiteral l -> synth_literal l.value, env | PVariable pv -> assert false @@ -125,6 +126,68 @@ and synth_pattern | PAnd plist -> failwith "synth_pattern | PAnd" | PTaggedValue (cons, tlist, plist) -> failwith "synth_pattern | PTagged" | PRecord (plist, tlist) -> failwith "synth_pattern | PRecord" +======= + | PWildcard -> pattern_wildcard pos + | PLiteral l -> pattern_literal env l + | PVariable _ -> pattern_variable pos + | PTypeAnnotation (p, ty) -> pattern_tannot env p ty + | PTuple plist -> pattern_tuple env plist + | POr plist -> pattern_or env plist + | PAnd plist -> pattern_and env plist + | PTaggedValue (cons, tlist, plist) -> pattern_tagval env cons tlist plist + | PRecord (plist, tlist) -> pattern_record env plist tlist + +and pattern_wildcard : Position.t -> HopixTypes.aty * HopixTypes.typing_environment = + fun pos -> HopixTypes.type_error pos "No types found." + +and pattern_literal + : HopixTypes.typing_environment -> HopixAST.literal Position.located + -> HopixTypes.aty * HopixTypes.typing_environment + = + fun tenv l -> failwith "synth_pattern | Pliteral" + +and pattern_variable : Position.t -> HopixTypes.aty * HopixTypes.typing_environment = + fun pos -> HopixTypes.type_error pos "No types found." + +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" + +and pattern_tuple + : HopixTypes.typing_environment -> HopixAST.pattern Position.located list + -> HopixTypes.aty * HopixTypes.typing_environment + = + fun tenv plist -> failwith "synth_pattern | PTuple" + +and pattern_or + : HopixTypes.typing_environment -> HopixAST.pattern Position.located list + -> HopixTypes.aty * HopixTypes.typing_environment + = + fun tenv plist -> failwith "synth_pattern | POr" + +and pattern_and + : HopixTypes.typing_environment -> HopixAST.pattern Position.located list + -> HopixTypes.aty * HopixTypes.typing_environment + = + fun tenv plist -> failwith "synth_pattern | PAnd" + +and pattern_tagval + : HopixTypes.typing_environment -> HopixAST.constructor Position.located + -> HopixAST.ty Position.located list option -> HopixAST.pattern Position.located list + -> HopixTypes.aty * HopixTypes.typing_environment + = + fun tenv cons tlist plist -> failwith "synth_pattern | PTagged" + +and pattern_record + : HopixTypes.typing_environment + -> (HopixAST.label Position.located * HopixAST.pattern Position.located) list + -> HopixAST.ty Position.located list option + -> HopixTypes.aty * HopixTypes.typing_environment + = + fun tenv plist tlist -> failwith "synth_pattern | PRecord" +>>>>>>> 1eab8ed491425b58b8d3d912b6ca2f4d056e75da and synth_variable : HopixTypes.typing_environment -> identifier Position.located