Skip to content

Commit

Permalink
Handle TypedValues in desugaring guards
Browse files Browse the repository at this point in the history
Since we desugar guards after type checking we need to make sure to
correctly handle `TypedValue` expressions.
  • Loading branch information
alexbiehl committed Apr 2, 2017
1 parent d8f2523 commit 433b99b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Language/PureScript/Sugar/CaseDeclarations.hs
Expand Up @@ -72,6 +72,7 @@ desugarGuardedExprs (Case scrut alternatives)
isTrivialExpr (Accessor _ e) = isTrivialExpr e
isTrivialExpr (Parens e) = isTrivialExpr e
isTrivialExpr (PositionedValue _ _ e) = isTrivialExpr e
isTrivialExpr (TypedValue _ e _) = isTrivialExpr e
isTrivialExpr _ = False

desugarGuardedExprs (Case scrut alternatives) =
Expand Down Expand Up @@ -261,6 +262,12 @@ desugarGuardedExprs (Case scrut alternatives) =
alts' <- desugarAlternatives alternatives
return $ optimize (Case scrut alts')

desugarGuardedExprs (TypedValue infered e ty) =
TypedValue infered <$> desugarGuardedExprs e <*> pure ty

desugarGuardedExprs (PositionedValue ss comms e) =
PositionedValue ss comms <$> desugarGuardedExprs e

desugarGuardedExprs v = pure v

-- |
Expand Down

0 comments on commit 433b99b

Please sign in to comment.