Make pushTypeContext handle Infer as no context.
This commit is contained in:
parent
bfd7b079a7
commit
2d15eb800c
|
@ -569,7 +569,9 @@ evalBytesInType t
|
||||||
-- | Run an operation in a given type context.
|
-- | Run an operation in a given type context.
|
||||||
inTypeContext :: Maybe A.Type -> PassM a -> PassM a
|
inTypeContext :: Maybe A.Type -> PassM a -> PassM a
|
||||||
inTypeContext ctx body
|
inTypeContext ctx body
|
||||||
= do pushTypeContext ctx
|
= do pushTypeContext (case ctx of
|
||||||
|
Just A.Infer -> Nothing
|
||||||
|
_ -> ctx)
|
||||||
v <- body
|
v <- body
|
||||||
popTypeContext
|
popTypeContext
|
||||||
return v
|
return v
|
||||||
|
@ -894,10 +896,7 @@ inferTypes = applyExplicitM9 doExpression doDimension doSubscript
|
||||||
_ -> diePC m $ formatCode "Table literal is not valid for type %" wantT
|
_ -> diePC m $ formatCode "Table literal is not valid for type %" wantT
|
||||||
-- An expression: descend into it with the right context.
|
-- An expression: descend into it with the right context.
|
||||||
doArrayElem wantT (A.ArrayElemExpr e)
|
doArrayElem wantT (A.ArrayElemExpr e)
|
||||||
= do let ctx = case wantT of
|
= do e' <- inTypeContext (Just wantT) $ doExpression descend e
|
||||||
A.Infer -> Nothing
|
|
||||||
_ -> Just wantT
|
|
||||||
e' <- inTypeContext ctx $ doExpression descend e
|
|
||||||
t <- typeOfExpression e'
|
t <- typeOfExpression e'
|
||||||
checkType (findMeta e') wantT t
|
checkType (findMeta e') wantT t
|
||||||
return (t, A.ArrayElemExpr e')
|
return (t, A.ArrayElemExpr e')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user