git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
If blocks without else blocks never result in unreachable code
commit1bb682bb97b03ab32a4e703868718e4a1f470cf4 authorPhil Freeman <paf31@cantab.net> dateThu 31 Oct 2013, 20:58 (13 years ago) parentda9f74c
1 file changed+2−2
src/PureScript/TypeChecker/Types.hs+2−2
src/PureScript/TypeChecker/Types.hs+2−2
@@ -500,8 +500,8 @@ typeConstraintsForStatement m mass ret (Return val) = do
500500typeConstraintsForIfStatement :: M.Map Ident Int -> M.Map Ident Int -> Int -> IfStatement -> Check ([TypeConstraint], Bool)
501501typeConstraintsForIfStatement m mass ret (IfStatement val thens Nothing) = do
502502 (cs1, n1) <- typeConstraints m val
503− (cs2, allCodePathsReturn, _) <- typeConstraintsForBlock m mass ret thens
504− return ((TypeConstraint n1 Boolean (ValueOrigin val)) : cs1 ++ cs2, allCodePathsReturn)
503+ (cs2, _, _) <- typeConstraintsForBlock m mass ret thens
504+ return ((TypeConstraint n1 Boolean (ValueOrigin val)) : cs1 ++ cs2, False)
505505typeConstraintsForIfStatement m mass ret (IfStatement val thens (Just elses)) = do
506506 (cs1, n1) <- typeConstraints m val
507507 (cs2, allCodePathsReturn1, _) <- typeConstraintsForBlock m mass ret thens