Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
curry
curry-frontend
Commits
18f66e93
Commit
18f66e93
authored
Feb 20, 2015
by
Jan Rasmus Tikovsky
Browse files
Fixed bug regarding export of record labels
parent
ce2237ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Checks/ExportCheck.hs
View file @
18f66e93
...
...
@@ -30,7 +30,7 @@ import Curry.Syntax
import
Base.Messages
(
Message
,
internalError
,
posMessage
)
import
Base.TopEnv
(
allEntities
,
origName
,
localBindings
,
moduleImports
)
import
Base.Types
(
DataConstr
(
..
))
import
Base.Types
(
DataConstr
(
..
)
,
constrIdent
,
recLabels
)
import
Base.Utils
(
findMultiples
)
import
Env.ModuleAlias
(
AliasEnv
)
...
...
@@ -151,10 +151,10 @@ expandTypeWith tc xs = do
case
qualLookupTC
tc
tcEnv
of
[]
->
report
(
errUndefinedType
tc
)
>>
return
[]
[
t
@
(
DataType
_
_
cs
)]
->
do
mapM_
(
checkElement
(
concatMap
visibleElems
cs
))
xs'
mapM_
(
checkElement
(
visibleElems
cs
))
xs'
return
[
ExportTypeWith
(
origName
t
)
xs'
]
[
t
@
(
RenamingType
_
_
c
)]
->
do
mapM_
(
checkElement
(
visibleElems
c
))
xs'
mapM_
(
checkElement
(
visibleElems
[
c
]
))
xs'
return
[
ExportTypeWith
(
origName
t
)
xs'
]
[
_
]
->
report
(
errNonDataType
tc
)
>>
return
[]
ts
->
report
(
errAmbiguousType
tc
ts
)
>>
return
[]
...
...
@@ -269,14 +269,13 @@ joinFun export _ = internalError $
-- ---------------------------------------------------------------------------
elements
::
TypeInfo
->
[
Ident
]
elements
(
DataType
_
_
cs
)
=
concatMap
visibleElems
cs
elements
(
RenamingType
_
_
c
)
=
visibleElems
c
elements
(
DataType
_
_
cs
)
=
visibleElems
cs
elements
(
RenamingType
_
_
c
)
=
visibleElems
[
c
]
elements
(
AliasType
_
_
_
)
=
[]
-- get visible constructor and label identifiers for given constructor
visibleElems
::
DataConstr
->
[
Ident
]
visibleElems
(
DataConstr
c
_
_
)
=
[
c
]
visibleElems
(
RecordConstr
c
_
ls
_
)
=
c
:
ls
visibleElems
::
[
DataConstr
]
->
[
Ident
]
visibleElems
cs
=
map
constrIdent
cs
++
(
nub
(
concatMap
recLabels
cs
))
-- ---------------------------------------------------------------------------
-- Error messages
...
...
test/HaskellRecords.curry
View file @
18f66e93
module HaskellRecords
(R (C), getL)
where
module HaskellRecords where
data R a = C { l :: Int, x :: a }
| D { l :: Int }
-- construction
r1 :: R Bool
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment