Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
obsidiansystems
GHC
Commits
91c15d65
Commit
91c15d65
authored
Aug 04, 2014
by
David Terei
Browse files
Better error messages for new per-instance overlap flags and Safe
Haskell.
parent
c79cbacb
Changes
7
Hide whitespace changes
Inline
Side-by-side
compiler/main/HscMain.hs
View file @
91c15d65
...
...
@@ -1025,13 +1025,21 @@ markUnsafe tcg_env whyUnsafe = do
whyUnsafe'
df
=
vcat
[
quotes
pprMod
<+>
text
"has been inferred as unsafe!"
,
text
"Reason:"
,
nest
4
$
(
vcat
$
badFlags
df
)
$+$
(
vcat
$
pprErrMsgBagWithLoc
whyUnsafe
)
(
vcat
$
pprErrMsgBagWithLoc
whyUnsafe
)
$+$
(
vcat
$
badInsts
$
tcg_insts
tcg_env
)
]
badFlags
df
=
concat
$
map
(
badFlag
df
)
unsafeFlagsForInfer
badFlag
df
(
str
,
loc
,
on
,
_
)
|
on
df
=
[
mkLocMessage
SevOutput
(
loc
df
)
$
text
str
<+>
text
"is not allowed in Safe Haskell"
]
|
otherwise
=
[]
badInsts
insts
=
concat
$
map
badInst
insts
badInst
ins
|
overlapMode
(
is_flag
ins
)
/=
NoOverlap
=
[
mkLocMessage
SevOutput
(
nameSrcSpan
$
getName
$
is_dfun
ins
)
$
ppr
(
overlapMode
$
is_flag
ins
)
<+>
text
"overlap mode isn't allowed in Safe Haskell"
]
|
otherwise
=
[]
-- | Figure out the final correct safe haskell mode
hscGetSafeMode
::
TcGblEnv
->
Hsc
SafeHaskellMode
...
...
testsuite/tests/safeHaskell/safeInfered/UnsafeInfered13.stderr
View file @
91c15d65
...
...
@@ -2,6 +2,8 @@
UnsafeInfered13.hs:1:16: Warning:
‘UnsafeInfered13’ has been inferred as unsafe!
Reason:
UnsafeInfered13.hs:8:27:
[overlap ok] overlap mode isn't allowed in Safe Haskell
<no location info>:
Failing due to -Werror.
testsuite/tests/safeHaskell/safeInfered/UnsafeInfered14.stderr
View file @
91c15d65
...
...
@@ -2,6 +2,8 @@
UnsafeInfered14.hs:1:16: Warning:
‘UnsafeInfered14’ has been inferred as unsafe!
Reason:
UnsafeInfered14.hs:8:31:
[overlappable] overlap mode isn't allowed in Safe Haskell
<no location info>:
Failing due to -Werror.
testsuite/tests/safeHaskell/safeInfered/UnsafeInfered15.stderr
View file @
91c15d65
...
...
@@ -2,6 +2,8 @@
UnsafeInfered15.hs:1:16: Warning:
‘UnsafeInfered15’ has been inferred as unsafe!
Reason:
UnsafeInfered15.hs:8:30:
[overlapping] overlap mode isn't allowed in Safe Haskell
<no location info>:
Failing due to -Werror.
testsuite/tests/safeHaskell/safeInfered/UnsafeInfered16.hs
0 → 100644
View file @
91c15d65
{-# OPTIONS_GHC -fwarn-unsafe -Werror #-}
{-# LANGUAGE FlexibleInstances #-}
module
UnsafeInfered15
where
class
C
a
where
f
::
a
->
String
instance
{-# OVERLAPPING #-}
C
a
where
f
_
=
"a"
instance
{-# OVERLAPS #-}
C
Int
where
f
_
=
"Int"
instance
{-# OVERLAPPABLE #-}
C
Bool
where
f
_
=
"Bool"
testsuite/tests/safeHaskell/safeInfered/UnsafeInfered16.stderr
0 → 100644
View file @
91c15d65
UnsafeInfered16.hs:1:16: Warning:
‘UnsafeInfered15’ has been inferred as unsafe!
Reason:
UnsafeInfered16.hs:8:30:
[overlapping] overlap mode isn't allowed in Safe Haskell
UnsafeInfered16.hs:11:27:
[overlap ok] overlap mode isn't allowed in Safe Haskell
UnsafeInfered16.hs:14:31:
[overlappable] overlap mode isn't allowed in Safe Haskell
<no location info>:
Failing due to -Werror.
testsuite/tests/safeHaskell/safeInfered/all.T
View file @
91c15d65
...
...
@@ -63,6 +63,7 @@ test('UnsafeInfered12', normal, compile_fail, [''])
test
('
UnsafeInfered13
',
normal
,
compile_fail
,
[''])
test
('
UnsafeInfered14
',
normal
,
compile_fail
,
[''])
test
('
UnsafeInfered15
',
normal
,
compile_fail
,
[''])
test
('
UnsafeInfered16
',
normal
,
compile_fail
,
[''])
# Mixed tests
test
('
Mixed01
',
normal
,
compile_fail
,
[''])
...
...
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