[GHC] #13838: -Wdeferred-type-errors; ghc: panic!; VoidRep; ((() -> ()) :: *) ~# (IO Any :: *)
GHC
ghc-devs at haskell.org
Sat Jun 17 02:02:57 UTC 2017
#13838: -Wdeferred-type-errors; ghc: panic!; VoidRep; ((() -> ()) :: *) ~# (IO Any
:: *)
-------------------------------------+-------------------------------------
Reporter: harry | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash or panic | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
Thanks for the bug report.
Interestingly, this program no longer panics with just `-fdefer-type-
errors` on GHC 8.2.1 or HEAD:
{{{
$ /opt/ghc/8.2.1/bin/ghc Bug.hs -fdefer-type-errors
[1 of 1] Compiling Main ( Bug.hs, Bug.o )
Bug.hs:2:1: warning: [-Wdeferred-type-errors]
• Couldn't match expected type ‘IO t0’ with actual type ‘() -> ()’
• Probable cause: ‘main’ is applied to too few arguments
In the expression: main
When checking the type of the IO action ‘main’
|
2 | main = () ()
| ^
Bug.hs:2:8: warning: [-Wdeferred-type-errors]
• Couldn't match expected type ‘() -> () -> ()’
with actual type ‘()’
• The function ‘()’ is applied to one argument,
but its type ‘()’ has none
In the expression: () ()
In an equation for ‘main’: main = () ()
|
2 | main = () ()
| ^^^^^
Linking Bug ...
}}}
(It also appears to be `-dcore-lint`-safe.)
However, the output isn't exactly what I'd expect from a type-incorrect
program that was compiled with `-fdefer-type-errors`:
{{{
$ ./Bug
Bug: main thread exited (uncaught exception)
}}}
I would have expected something like this:
{{{
$ ./Bug
Bug: Bug.hs:2:1: error:
• Couldn't match expected type ‘IO t0’ with actual type ‘() -> ()’
• Probable cause: ‘main’ is applied to too few arguments
In the expression: main
When checking the type of the IO action ‘main’
Bug: Bug.hs:2:8: error:
• Couldn't match expected type ‘() -> () -> ()’
with actual type ‘()’
• The function ‘()’ is applied to one argument,
but its type ‘()’ has none
In the expression: () ()
In an equation for ‘main’: main = () ()
}}}
I'll investigate which commit fixed the panic.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13838#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list