Commit 41903fec authored by Jan Rasmus Tikovsky 's avatar Jan Rasmus Tikovsky
Browse files

Represent hidden record type declarations in interface files as hiding data declarations

parent 2e7555db
......@@ -106,6 +106,8 @@ checkImport (HidingDataDecl p tc tvs)
| tc == tc' && length tvs == n' = Just ok
check (RenamingType tc' n' _)
| tc == tc' && length tvs == n' = Just ok
check (AliasType tc' n' (TypeRecord _ _))
| tc == tc' && length tvs == n' = Just ok
check _ = Nothing
checkImport (IDataDecl p tc tvs cs) = checkTypeInfo "data type" check p tc
where check (DataType tc' n' cs')
......
......@@ -76,10 +76,6 @@ bindType (IDataDecl _ tc _ cs) = qualBindTopEnv "" tc
constr (ConOpDecl _ _ _ op _) = op
bindType (INewtypeDecl _ tc _ nc) = qualBindTopEnv "" tc (Data tc [nconstr nc])
where nconstr (NewConstrDecl _ _ c _) = c
-- jrt 2014-10-16: record types are handled like data declarations; this is
-- necessary because type constructors of record types are not expanded anymore
-- and can occur in interfaces
bindType (ITypeDecl _ tc _ (RecordType _ _)) = qualBindTopEnv "" tc (Data tc [])
bindType (ITypeDecl _ tc _ _) = qualBindTopEnv "" tc (Alias tc)
bindType (IFunctionDecl _ _ _ _) = id
......
......@@ -179,11 +179,11 @@ identsType (RecordType fs rty) xs =
hiddenTypeDecl :: ModuleIdent -> TCEnv -> QualIdent -> IDecl
hiddenTypeDecl m tcEnv tc = case qualLookupTC (qualQualify m tc) tcEnv of
[DataType _ n _ ] -> hidingDataDecl tc n
[RenamingType _ n _ ] -> hidingDataDecl tc n
[DataType _ n _] -> hidingDataDecl tc n
[RenamingType _ n _] -> hidingDataDecl tc n
-- jrt 2014-10-16: Added for support of record types
[AliasType qi n ty] -> iTypeDecl ITypeDecl m qi n (fromQualType m ty)
_ -> internalError "Exports.hiddenTypeDecl"
[AliasType _ n _] -> hidingDataDecl tc n
_ -> internalError "Exports.hiddenTypeDecl"
where hidingDataDecl tc1 n = HidingDataDecl NoPos tc1 $ take n identSupply
hiddenTypes :: ModuleIdent -> [IDecl] -> [QualIdent]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment