Skip to content

Commit

Permalink
ES: CaseHoisting now handles defaults alternatives correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Anabra committed Jan 22, 2020
1 parent 6e093d6 commit 05de7f9
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ hoistAlts :: Name -> (Alt, Alt) -> NameM Alt
hoistAlts lpatName (Alt cpat1 altName1 alt1, Alt cpat2 altName2 alt2) = do
freshLPatName <- deriveNewName lpatName
let nameMap = Map.singleton lpatName freshLPatName
(freshAlt2, _) <- case cpat2 of
DefaultPat -> refreshNames nameMap alt2
_ -> refreshNames nameMap $ EBind (SReturn $ Var freshLPatName) (VarPat altName2) alt2
(freshAlt2, _) <- refreshNames nameMap $
EBind (SReturn $ Var freshLPatName) (VarPat altName2) alt2
pure . Alt cpat1 altName1 $ EBind (SBlock alt1) (VarPat freshLPatName) freshAlt2

disjointMatch :: [(Set Tag, Alt)] -> [Alt] -> Maybe [(Alt, Alt)]
Expand Down

0 comments on commit 05de7f9

Please sign in to comment.