git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Remove meet judgment, #1719
3d84af6Phil Freeman
src/Language/PureScript/TypeChecker/Types.hs+4−23
@@ -280,10 +280,10 @@ infer' (Case vals binders) = do
280 return $ TypedValue True (Case vals' binders') ret
280 return $ TypedValue True (Case vals' binders') ret
281infer' (IfThenElse cond th el) = do
281infer' (IfThenElse cond th el) = do
282 cond' <- check cond tyBoolean
282 cond' <- check cond tyBoolean
283− v2@(TypedValue _ _ t2) <- infer th
283+ th'@(TypedValue _ _ thTy) <- infer th
284− v3@(TypedValue _ _ t3) <- infer el
284+ el'@(TypedValue _ _ elTy) <- infer el
285− (v2', v3', t) <- meet v2 v3 t2 t3
285+ unifyTypes thTy elTy
286− return $ TypedValue True (IfThenElse cond' v2' v3') t
286+ return $ TypedValue True (IfThenElse cond' th' el') thTy
287infer' (Let ds val) = do
287infer' (Let ds val) = do
288 (ds', val'@(TypedValue _ _ valTy)) <- inferLetBinding [] ds val infer
288 (ds', val'@(TypedValue _ _ valTy)) <- inferLetBinding [] ds val infer
289 return $ TypedValue True (Let ds' val') valTy
289 return $ TypedValue True (Let ds' val') valTy
@@ -706,25 +706,6 @@ checkFunctionApplication' fn fnTy dict@TypeClassDictionary{} _ =
706 return (fnTy, App fn dict)
706 return (fnTy, App fn dict)
707checkFunctionApplication' _ fnTy arg _ = throwError . errorMessage $ CannotApplyFunction fnTy arg
707checkFunctionApplication' _ fnTy arg _ = throwError . errorMessage $ CannotApplyFunction fnTy arg
708
708
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−
728-- |
709-- |
729-- Ensure a set of property names and value does not contain duplicate labels
710-- Ensure a set of property names and value does not contain duplicate labels
730--
711--