Fixed woring order of monomorphization in ECase
This commit is contained in:
parent
e70eae776a
commit
4038f34cc5
1 changed files with 1 additions and 5 deletions
|
|
@ -47,7 +47,6 @@ import Data.Coerce (coerce)
|
||||||
import Data.Map qualified as Map
|
import Data.Map qualified as Map
|
||||||
import Data.Maybe (catMaybes)
|
import Data.Maybe (catMaybes)
|
||||||
import Data.Set qualified as Set
|
import Data.Set qualified as Set
|
||||||
--import Debug.Trace
|
|
||||||
import Grammar.Print (printTree)
|
import Grammar.Print (printTree)
|
||||||
|
|
||||||
{- | EnvM is the monad containing the read-only state as well as the
|
{- | EnvM is the monad containing the read-only state as well as the
|
||||||
|
|
@ -232,8 +231,8 @@ morphExp expectedType exp = case exp of
|
||||||
morphExp t' exp
|
morphExp t' exp
|
||||||
T.ECase (exp, t) bs -> do
|
T.ECase (exp, t) bs -> do
|
||||||
t' <- getMonoFromPoly t
|
t' <- getMonoFromPoly t
|
||||||
bs' <- mapM morphBranch bs
|
|
||||||
exp' <- morphExp t' exp
|
exp' <- morphExp t' exp
|
||||||
|
bs' <- mapM morphBranch bs
|
||||||
return $ M.ECase (exp', t') (catMaybes bs')
|
return $ M.ECase (exp', t') (catMaybes bs')
|
||||||
-- Ideally constructors should be EInj, though this code handles them
|
-- Ideally constructors should be EInj, though this code handles them
|
||||||
-- as well.
|
-- as well.
|
||||||
|
|
@ -263,9 +262,6 @@ morphExp expectedType exp = case exp of
|
||||||
exp' <- morphExp tExp' exp
|
exp' <- morphExp tExp' exp
|
||||||
return $ M.ELet (M.Bind (identB, tB') [] (expB', tExpB')) (exp', tExp')
|
return $ M.ELet (M.Bind (identB, tB') [] (expB', tExpB')) (exp', tExp')
|
||||||
|
|
||||||
-- ELet (Bind' t) (ExpT' t)
|
|
||||||
-- Bind (Id' t) [Id' t] (ExpT' t)
|
|
||||||
|
|
||||||
-- | Monomorphizes case-of branches.
|
-- | Monomorphizes case-of branches.
|
||||||
morphBranch :: T.Branch -> EnvM (Maybe M.Branch)
|
morphBranch :: T.Branch -> EnvM (Maybe M.Branch)
|
||||||
morphBranch (T.Branch (p, pt) (e, et)) = do
|
morphBranch (T.Branch (p, pt) (e, et)) = do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue