git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Remove meet judgment, #1719
commit3d84af651fbc59b04ba595c6a872b637ef23bd0f authorPhil Freeman <paf31@cantab.net> dateSun 20 Dec 2015, 17:46 (11 years ago) parent1e8f4aa
1 file changed+4−23
src/Language/PureScript/TypeChecker/Types.hs+4−23
src/Language/PureScript/TypeChecker/Types.hs+4−23
@@ -280,10 +280,10 @@ infer' (Case vals binders) = do
280280 return $ TypedValue True (Case vals' binders') ret
281281infer' (IfThenElse cond th el) = do
282282 cond' <- check cond tyBoolean
283− v2@(TypedValue _ _ t2) <- infer th
284− v3@(TypedValue _ _ t3) <- infer el
285− (v2', v3', t) <- meet v2 v3 t2 t3
286− return $ TypedValue True (IfThenElse cond' v2' v3') t
283+ th'@(TypedValue _ _ thTy) <- infer th
284+ el'@(TypedValue _ _ elTy) <- infer el
285+ unifyTypes thTy elTy
286+ return $ TypedValue True (IfThenElse cond' th' el') thTy
287287infer' (Let ds val) = do
288288 (ds', val'@(TypedValue _ _ valTy)) <- inferLetBinding [] ds val infer
289289 return $ TypedValue True (Let ds' val') valTy
@@ -706,25 +706,6 @@ checkFunctionApplication' fn fnTy dict@TypeClassDictionary{} _ =
706706 return (fnTy, App fn dict)
707707checkFunctionApplication' _ fnTy arg _ = throwError . errorMessage $ CannotApplyFunction fnTy arg
708708
709−-- | Compute the meet of two types, i.e. the most general type which both types subsume.
710−-- TODO: is this really needed?
711−meet ::
712− (Functor m, Applicative m, MonadState CheckState m, MonadError MultipleErrors m) =>
713− Expr ->
714− Expr ->
715− Type ->
716− Type ->
717− m (Expr, Expr, Type)
718−meet e1 e2 (ForAll ident t1 _) t2 = do
719− t1' <- replaceVarWithUnknown ident t1
720− meet e1 e2 t1' t2
721−meet e1 e2 t1 (ForAll ident t2 _) = do
722− t2' <- replaceVarWithUnknown ident t2
723− meet e1 e2 t1 t2'
724−meet e1 e2 t1 t2 = do
725− unifyTypes t1 t2
726− return (e1, e2, t1)
727−
728709-- |
729710-- Ensure a set of property names and value does not contain duplicate labels
730711--