Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex D
GHC
Commits
0424de2d
Commit
0424de2d
authored
Aug 08, 2019
by
Ömer Sinan Ağacan
Committed by
Marge Bot
Aug 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for
#16893
parent
422ffce0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
0 deletions
+93
-0
testsuite/tests/simplCore/should_run/T16893/Complex.hs
testsuite/tests/simplCore/should_run/T16893/Complex.hs
+68
-0
testsuite/tests/simplCore/should_run/T16893/T16893.hs
testsuite/tests/simplCore/should_run/T16893/T16893.hs
+21
-0
testsuite/tests/simplCore/should_run/T16893/all.T
testsuite/tests/simplCore/should_run/T16893/all.T
+4
-0
No files found.
testsuite/tests/simplCore/should_run/T16893/Complex.hs
0 → 100644
View file @
0424de2d
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module
Complex
(
Type
(
..
)
,
OpenComplex
(
..
)
,
CloseComplex
(
..
)
,
Complex
(
..
)
,
closeComplex
)
where
import
Data.ByteString
as
B
import
Data.ByteString.Short
as
BS
import
Data.Typeable
data
Type
=
OpenType
|
CloseType
data
OpenComplex
=
OpenComplex
{
openComplexSource
::
ByteString
}
data
CloseComplex
=
CloseComplex
{
closeComplexHash
::
ByteString
,
closeComplexSource
::
!
ByteString
}
data
Complex
(
t
::
Type
)
=
Complex
{
complexInner
::
!
(
ComplexFamily
t
)
}
type
family
ComplexFamily
(
t
::
Type
)
where
ComplexFamily
'OpenType
=
OpenComplex
ComplexFamily
'CloseType
=
CloseComplex
handleComplex
::
forall
t
a
.
Typeable
t
=>
Complex
t
->
(
Complex
'CloseType
->
a
)
->
a
handleComplex
complex
onClose
=
case
toCloseComplex
complex
of
Just
receiveComplex
->
onClose
receiveComplex
Nothing
->
undefined
toCloseComplex
::
forall
t
.
Typeable
t
=>
Complex
t
->
Maybe
(
Complex
'CloseType
)
toCloseComplex
x
=
fmap
(
\
Refl
->
x
)
(
eqT
::
Maybe
(
t
:~:
'CloseType
))
closeComplex
::
Typeable
t
=>
Complex
t
->
Close
closeComplex
complex
=
handleComplex
complex
receiveComplexToProtocolCloseComplex
receiveComplexToProtocolCloseComplex
::
Complex
'CloseType
->
Close
receiveComplexToProtocolCloseComplex
Complex
{
complexInner
=
inner
}
=
Close
(
hashToLink
(
closeComplexSource
inner
))
data
Close
=
Close
!
ShortByteString
hashToLink
::
ByteString
->
ShortByteString
hashToLink
bh
=
BS
.
toShort
bh
testsuite/tests/simplCore/should_run/T16893/T16893.hs
0 → 100644
View file @
0424de2d
{-# LANGUAGE DataKinds #-}
module
Main
(
main
)
where
import
Complex
badComplex
::
Complex
'OpenType
badComplex
=
Complex
{
complexInner
=
OpenComplex
{
openComplexSource
=
undefined
}
}
segFaultTrigger
::
IO
()
segFaultTrigger
=
closeComplex
badComplex
`
seq
`
pure
()
main
::
IO
()
main
=
segFaultTrigger
testsuite/tests/simplCore/should_run/T16893/all.T
0 → 100644
View file @
0424de2d
test
('
T16893
',
[
expect_broken
(
16893
),
extra_files
(['
Complex.hs
'])],
compile_and_run
,
['
-O1
'])
Write
Preview
Markdown
is supported
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