Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Glasgow Haskell Compiler
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
Ara Adkins
Glasgow Haskell Compiler
Commits
f9007960
Commit
f9007960
authored
Sep 12, 2013
by
twanvl
Committed by
Herbert Valerio Riedel
Sep 18, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for MINIMAL pragma (#7633)
parent
b6d90d10
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
213 additions
and
0 deletions
+213
-0
testsuite/tests/warnings/Makefile
testsuite/tests/warnings/Makefile
+3
-0
testsuite/tests/warnings/minimal/Makefile
testsuite/tests/warnings/minimal/Makefile
+3
-0
testsuite/tests/warnings/minimal/WarnMinimal.hs
testsuite/tests/warnings/minimal/WarnMinimal.hs
+116
-0
testsuite/tests/warnings/minimal/WarnMinimal.stderr
testsuite/tests/warnings/minimal/WarnMinimal.stderr
+52
-0
testsuite/tests/warnings/minimal/WarnMinimalFail1.hs
testsuite/tests/warnings/minimal/WarnMinimalFail1.hs
+5
-0
testsuite/tests/warnings/minimal/WarnMinimalFail1.stderr
testsuite/tests/warnings/minimal/WarnMinimalFail1.stderr
+3
-0
testsuite/tests/warnings/minimal/WarnMinimalFail2.hs
testsuite/tests/warnings/minimal/WarnMinimalFail2.hs
+8
-0
testsuite/tests/warnings/minimal/WarnMinimalFail2.stderr
testsuite/tests/warnings/minimal/WarnMinimalFail2.stderr
+3
-0
testsuite/tests/warnings/minimal/WarnMinimalFail3.hs
testsuite/tests/warnings/minimal/WarnMinimalFail3.hs
+13
-0
testsuite/tests/warnings/minimal/WarnMinimalFail3.stderr
testsuite/tests/warnings/minimal/WarnMinimalFail3.stderr
+3
-0
testsuite/tests/warnings/minimal/all.T
testsuite/tests/warnings/minimal/all.T
+4
-0
No files found.
testsuite/tests/warnings/Makefile
0 → 100644
View file @
f9007960
TOP
=
../..
include
$(TOP)/mk/boilerplate.mk
include
$(TOP)/mk/test.mk
testsuite/tests/warnings/minimal/Makefile
0 → 100644
View file @
f9007960
TOP
=
../../..
include
$(TOP)/mk/boilerplate.mk
include
$(TOP)/mk/test.mk
testsuite/tests/warnings/minimal/WarnMinimal.hs
0 → 100644
View file @
f9007960
module
WarnMinimal
where
class
Fine
a
where
instance
Fine
Int
-------------------
class
Foo
a
where
foo1
::
a
foo2
::
a
foo1
=
foo2
foo2
=
foo1
{-# MINIMAL foo1 | foo2 #-}
-- this should generate a warning
instance
Foo
Int
where
-- WARNING LINE
-- this should generate no warning
instance
Foo
Char
where
foo1
=
'x'
-- nor should this
instance
Foo
Bool
where
foo2
=
True
instance
Foo
Double
where
foo1
=
1
foo2
=
2
-------------------
class
Monad'
f
where
return'
::
a
->
f
a
fmap'
::
(
a
->
b
)
->
f
a
->
f
b
join'
::
f
(
f
a
)
->
f
a
bind'
::
f
a
->
(
a
->
f
b
)
->
f
b
{-# MINIMAL return', (fmap',join' | bind') #-}
fmap'
f
x
=
bind'
x
(
return'
.
f
)
join'
x
=
bind'
x
id
bind'
x
f
=
join'
(
fmap'
f
x
)
instance
Monad'
[]
where
return'
=
return
fmap'
=
map
join'
=
concat
-- no warning
instance
Monad'
Maybe
where
return'
=
Just
bind'
=
(
>>=
)
-- no warning
instance
Monad'
IO
where
return'
=
return
bind'
=
(
>>=
)
fmap'
=
fmap
join'
=
(
>>=
id
)
-- no warning
instance
Monad'
((
->
)
e
)
where
-- WARNING LINE
return'
=
const
fmap'
=
(
.
)
-- warning!
newtype
Id
a
=
Id
a
instance
Monad'
Id
where
-- WARNING LINE
fmap'
f
(
Id
x
)
=
Id
(
f
x
)
join'
(
Id
x
)
=
x
-- warning!
newtype
Id2
a
=
Id2
a
instance
Monad'
Id2
where
-- WARNING LINE
fmap'
f
(
Id2
x
)
=
Id2
(
f
x
)
join'
(
Id2
x
)
=
x
bind'
(
Id2
x
)
f
=
f
x
-- warning!
newtype
Id3
a
=
Id3
a
instance
Monad'
Id3
where
-- WARNING LINE
---------
-- incorrect minimal spec
class
Cheater
a
where
-- WARNING LINE
cheater
::
a
{-# MINIMAL #-}
-- warning!
class
Cheater2
a
where
_cheater2
::
a
{-# MINIMAL #-}
-- no warning
class
Cheater3
a
where
-- WARNING LINE
cheater3
,
cheater3b
::
a
{-# MINIMAL cheater3 #-}
-- warning!
---------
-- new style warning for classes without explicit spec
instance
Num
Bool
where
-- WARNING LINE
class
NoExplicit
a
where
needed
::
a
_optional
::
a
instance
NoExplicit
Int
where
-- WARNING LINE
---------
data
Blarg
=
Blarg
class
Eq'
a
where
(
===
)
::
a
->
a
->
Bool
(
/==
)
::
a
->
a
->
Bool
x
===
y
=
not
(
x
/==
y
)
x
/==
y
=
not
(
x
===
y
)
{-# MINIMAL (===) | (/==) #-}
instance
Eq'
Blarg
where
-- WARNING LINE
testsuite/tests/warnings/minimal/WarnMinimal.stderr
0 → 100644
View file @
f9007960
WarnMinimal.hs:16:10: Warning:
No explicit implementation for
either ‛foo1’ or ‛foo2’
In the instance declaration for ‛Foo Int’
WarnMinimal.hs:60:10: Warning:
No explicit implementation for
either ‛join'’ or ‛bind'’
In the instance declaration for ‛Monad' ((->) e)’
WarnMinimal.hs:66:10: Warning:
No explicit implementation for
‛return'’
In the instance declaration for ‛Monad' Id’
WarnMinimal.hs:72:10: Warning:
No explicit implementation for
‛return'’
In the instance declaration for ‛Monad' Id2’
WarnMinimal.hs:79:10: Warning:
No explicit implementation for
‛return'’ and (either (‛fmap'’ and ‛join'’) or ‛bind'’)
In the instance declaration for ‛Monad' Id3’
WarnMinimal.hs:84:1: Warning:
The MINIMAL pragma does not require:
‛cheater’
but there is no default implementation.
In the class declaration for ‛Cheater’
WarnMinimal.hs:92:1: Warning:
The MINIMAL pragma does not require:
‛cheater3b’
but there is no default implementation.
In the class declaration for ‛Cheater3’
WarnMinimal.hs:99:10: Warning:
No explicit implementation for
‛+’, ‛*’, ‛abs’, ‛signum’, and ‛fromInteger’
In the instance declaration for ‛Num Bool’
WarnMinimal.hs:105:10: Warning:
No explicit implementation for
‛needed’
In the instance declaration for ‛NoExplicit Int’
WarnMinimal.hs:116:10: Warning:
No explicit implementation for
either ‛===’ or ‛/==’
In the instance declaration for ‛Eq' Blarg’
testsuite/tests/warnings/minimal/WarnMinimalFail1.hs
0 → 100644
View file @
f9007960
module
WarnMinimalFail1
where
global
::
Int
global
=
0
{-# MINIMAL global #-}
-- invalid, should only be used inside a class declaration
testsuite/tests/warnings/minimal/WarnMinimalFail1.stderr
0 → 100644
View file @
f9007960
WarnMinimalFail1.hs:5:1:
Misplaced MINIMAL pragma: {-# MINIMAL global #-}
testsuite/tests/warnings/minimal/WarnMinimalFail2.hs
0 → 100644
View file @
f9007960
module
WarnMinimalFail2
where
global
::
Int
global
=
0
class
Foo
a
where
local
::
a
{-# MINIMAL global #-}
testsuite/tests/warnings/minimal/WarnMinimalFail2.stderr
0 → 100644
View file @
f9007960
WarnMinimalFail2.hs:8:15:
‛global’ is not a (visible) method of class ‛Foo’
testsuite/tests/warnings/minimal/WarnMinimalFail3.hs
0 → 100644
View file @
f9007960
{-# LANGUAGE DefaultSignatures #-}
module
WarnMinimalFail3
where
class
Parent
a
where
parent
::
a
default
parent
::
Child
a
=>
a
parent
=
child
class
Parent
a
=>
Child
a
where
child
::
a
child
=
parent
{-# MINIMAL parent | child #-}
-- we would like this to work, but it doesn't yet.
testsuite/tests/warnings/minimal/WarnMinimalFail3.stderr
0 → 100644
View file @
f9007960
WarnMinimalFail3.hs:12:15:
‛parent’ is not a (visible) method of class ‛Child’
testsuite/tests/warnings/minimal/all.T
0 → 100644
View file @
f9007960
test
('
WarnMinimal
',
normal
,
compile
,
[''])
test
('
WarnMinimalFail1
',
normal
,
compile_fail
,
[''])
test
('
WarnMinimalFail2
',
normal
,
compile_fail
,
[''])
test
('
WarnMinimalFail3
',
normal
,
compile_fail
,
[''])
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