@@ -592,7 +592,12 @@ check' val kt@(KindedType ty kind) = do
592592 return $ TypedValue True val' kt
593593check' (PositionedValue pos _ val) ty =
594594 warnAndRethrowWithPosition pos $ check' val ty
595−check' val ty = throwError . errorMessage $ ExprDoesNotHaveType val ty
595+check' val ty = do
596+ TypedValue _ val' ty' <- infer val
597+ mt <- subsumes (Just val') ty' ty
598+ case mt of
599+ Nothing -> throwError . errorMessage $ SubsumptionCheckFailed
600+ Just v' -> return $ TypedValue True v' ty
596601
597602containsTypeSynonyms :: Type -> Bool
598603containsTypeSynonyms = everythingOnTypes (||) go where