@@ -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