[GHC] #15899: Testcase tcfail158 is broken
GHC
ghc-devs at haskell.org
Thu Nov 15 09:26:19 UTC 2018
#15899: Testcase tcfail158 is broken
-------------------------------------+-------------------------------------
Reporter: RolandSenn | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.8.1
Component: Test Suite | Version: 8.7
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Other
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Test testsuite/tests/typecheck/should_fail/tcfail158.hs contains the
following code:
{{{#!hs
{-# LANGUAGE ExplicitForAll #-}
-- This one actually crashed in 6.4.1
-- There's a kind error in the signature for bar,
-- and we were recovering, and then crashing when we found
-- a scoped type variable not in scope
data Val v sm = Val
foo :: forall v sm. Val v sm
foo = undefined
where foo1 :: Val v sm
foo1 = bar
-- Correct type signature: bar :: forall v sm. Val v sm
bar :: forall v. Val v
bar = undefined foo
}}}
The expected test result in
testsuite/tests/typecheck/should_fail/tcfail158.stderr is:
{{{
tcfail158.hs:1:1: error:
The IO action ‘main’ is not defined in module ‘Main’
}}}
== Issues:
1. With a very high probability, the intention of this test was not to
test on the missing main function. The intention was to test the error
message for the type signature of function ''bar'' .
2. The code for the definitions and functions start in column 2 and not in
column 1.
3. With an added main function GHC Versions 8.0, 8.2, 8.4 and 8.6 report
the following error:
{{{
tcfail158.hs:17:18: error:
• Expecting one more argument to ‘Val v’
Expected a type, but ‘Val v’ has kind ‘* -> *’
• In the type signature:
bar :: forall v. Val v
}}}
4. GHC HEAD version 8.7.20181112, however, reports:
{{{
tcfail158.hs:15:17: error:
• Couldn't match expected type ‘Val v1 sm1’
with actual type ‘Val v0’
• In the expression: bar
In an equation for ‘foo1’: foo1 = bar
In an equation for ‘foo’:
foo
= undefined
where
foo1 :: Val v sm
foo1 = bar
• Relevant bindings include
foo1 :: Val v1 sm1 (bound at tcfail158.hs:15:10)
tcfail158.hs:17:18: error:
• Expecting one more argument to ‘Val v’
Expected a type, but ‘Val v’ has kind ‘* -> *’
• In the type signature: bar :: forall v. Val v
^^^^^
tcfail158.hs:18:7: error:
• Couldn't match kind ‘* -> *’ with ‘*’
When matching types
t0 :: *
Val v :: * -> *
• In the expression: undefined foo
In an equation for ‘bar’: bar = undefined foo
• Relevant bindings include
bar :: Val v (bound at tcfail158.hs:18:1)
}}}
GHC HEAD reports errors in 3 different lines 15, 17 and 18. Fix the type
signature in line 17 and GHC compiles successfully. The error messages
produced by GHC HEAD are very confusing!
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15899>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list