Fixed the handling of types for function returns
Function returns are done in Rain by assigning to the function name, so we need a bit of extra code when checking assignments to see if the LHS is a function name.
This commit is contained in:
parent
7f387ae6a9
commit
2b3783d845
|
@ -214,7 +214,15 @@ markAssignmentTypes = checkDepthM checkAssignment
|
|||
= do am <- abbrevModeOfVariable v
|
||||
when (am == A.ValAbbrev) $
|
||||
diePC m $ formatCode "Cannot assign to a constant variable: %" v
|
||||
markUnify v e
|
||||
-- Assignments also includes assignments to function names,
|
||||
-- so we need a little extra logic:
|
||||
case v of
|
||||
A.Variable _ n ->
|
||||
do st <- specTypeOfName n
|
||||
case st of
|
||||
A.Function _ _ [t] _ _ -> markUnify t e
|
||||
_ -> markUnify v e
|
||||
_ -> markUnify v e
|
||||
checkAssignment (A.Assign m _ _) = dieInternal (Just m,"Rain checker found occam-style assignment")
|
||||
checkAssignment st = return ()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user