mirror of
https://github.com/anoma/juvix.git
synced 2024-12-12 14:28:08 +03:00
Add _caseTypeWholeExpression
to Internal (#1860)
This commit is contained in:
parent
23f34403f5
commit
e0b2d202ed
@ -251,6 +251,7 @@ instance HasExpressions Case where
|
||||
_caseBranches :: NonEmpty CaseBranch <- traverse (leafExpressions f) (l ^. caseBranches)
|
||||
_caseExpression <- leafExpressions f (l ^. caseExpression)
|
||||
_caseExpressionType <- traverse (leafExpressions f) (l ^. caseExpressionType)
|
||||
_caseExpressionWholeType <- traverse (leafExpressions f) (l ^. caseExpressionWholeType)
|
||||
pure Case {..}
|
||||
where
|
||||
_caseParens = l ^. caseParens
|
||||
|
@ -155,8 +155,10 @@ instance Hashable CaseBranch
|
||||
|
||||
data Case = Case
|
||||
{ _caseExpression :: Expression,
|
||||
-- | The typechecker fills this field
|
||||
-- | The type of the cased expression. The typechecker fills this field
|
||||
_caseExpressionType :: Maybe Expression,
|
||||
-- | The type of the whole case expression. The typechecker fills this field
|
||||
_caseExpressionWholeType :: Maybe Expression,
|
||||
_caseBranches :: NonEmpty CaseBranch,
|
||||
_caseParens :: Bool
|
||||
}
|
||||
|
@ -347,6 +347,7 @@ goCase c = do
|
||||
_caseBranches <- mapM goCaseBranch (c ^. Abstract.caseBranches)
|
||||
let _caseParens = c ^. Abstract.caseParens
|
||||
_caseExpressionType :: Maybe Expression = Nothing
|
||||
_caseExpressionWholeType :: Maybe Expression = Nothing
|
||||
return Case {..}
|
||||
|
||||
goCaseBranch :: Members '[NameIdGen] r => Abstract.CaseBranch -> Sem r CaseBranch
|
||||
|
@ -357,6 +357,7 @@ checkCase ari l = do
|
||||
_caseExpression <- checkExpression ArityUnit (l ^. caseExpression)
|
||||
let _caseParens = l ^. caseParens
|
||||
_caseExpressionType :: Maybe Expression = Nothing
|
||||
_caseExpressionWholeType :: Maybe Expression = Nothing
|
||||
return Case {..}
|
||||
where
|
||||
checkCaseBranch :: CaseBranch -> Sem r CaseBranch
|
||||
|
@ -556,6 +556,7 @@ inferExpression' hint e = case e of
|
||||
typedCaseExpression <- inferExpression' Nothing (c ^. caseExpression)
|
||||
let _caseExpression = typedCaseExpression ^. typedExpression
|
||||
_caseExpressionType = Just (typedCaseExpression ^. typedType)
|
||||
_caseExpressionWholeType = Just ty
|
||||
goBranch :: CaseBranch -> Sem r CaseBranch
|
||||
goBranch b =
|
||||
traverseOf
|
||||
|
Loading…
Reference in New Issue
Block a user