Handle DATA TYPE FOO IS (some record).

This commit is contained in:
Adam Sampson 2008-04-07 23:36:30 +00:00
parent 201788b478
commit feb0496d71

View File

@ -877,10 +877,14 @@ inferTypes = applyExplicitM10 doExpression doDimension doSubscript
-- | Resolve the @v[s]@ ambiguity: this takes the type that @v@ is, and
-- returns the correct 'Subscript'.
fixSubscript :: A.Type -> A.Subscript -> PassM A.Subscript
fixSubscript (A.Record _) (A.Subscript m _ (A.ExprVariable _ (A.Variable _ wrong)))
= do n <- nameToUnscoped wrong
return $ A.SubscriptField m n
fixSubscript t s = return s
fixSubscript t s@(A.Subscript m _ (A.ExprVariable _ (A.Variable _ wrong)))
= do underT <- resolveUserType m t
case underT of
A.Record _ ->
do n <- nameToUnscoped wrong
return $ A.SubscriptField m n
_ -> return s
fixSubscript _ s = return s
-- | Given a name that should really have been a tag, make it one.
nameToUnscoped :: A.Name -> PassM A.Name