git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #862
commit92f17753d84dc2235aa1a5b37ef7711e0c08f482 authorPhil Freeman <paf31@cantab.net> dateSun 13 Sep 2015, 16:43 (11 years ago) parente2385f4
2 files changed+14−1
examples/passing/862.purs+8 src/Language/PureScript/TypeChecker/Types.hs+6−1
examples/passing/862.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console
5+
6+id' = (\x -> x) <$> \y -> y
7+
8+main = log (id' "Done")
src/Language/PureScript/TypeChecker/Types.hs+6−1
@@ -587,7 +587,12 @@ check' val kt@(KindedType ty kind) = do
587587 return $ TypedValue True val' kt
588588check' (PositionedValue pos _ val) ty =
589589 warnAndRethrowWithPosition pos $ check' val ty
590−check' val ty = throwError . errorMessage $ ExprDoesNotHaveType val ty
590+check' val ty = do
591+ TypedValue _ val' ty' <- infer val
592+ mt <- subsumes (Just val') ty' ty
593+ case mt of
594+ Nothing -> throwError . errorMessage $ SubsumptionCheckFailed
595+ Just v' -> return $ TypedValue True v' ty
591596
592597containsTypeSynonyms :: Type -> Bool
593598containsTypeSynonyms = everythingOnTypes (||) go where