Commit 706c439f authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Add test for tagToEnum#

parent 35dc8da5
...@@ -148,3 +148,4 @@ test('tcfail160', normal, compile_fail, ['']) ...@@ -148,3 +148,4 @@ test('tcfail160', normal, compile_fail, [''])
test('tcfail161', normal, compile_fail, ['']) test('tcfail161', normal, compile_fail, [''])
test('tcfail162', normal, compile_fail, ['']) test('tcfail162', normal, compile_fail, [''])
test('tcfail163', normal, compile_fail, ['']) test('tcfail163', normal, compile_fail, [''])
test('tcfail164', normal, compile_fail, [''])
{-# OPTIONS_GHC -fglasgow-exts #-}
-- Tests tagToEnum# hacks
module ShouldFail where
import GHC.Base
-- Test 1: Polymorphic
f :: a
f = tagToEnum# 0#
-- Test 2: Int value (not an Enumeration TyCon)
class Unboxable value where
readUnboxable :: Int -> value
instance Unboxable Int where
readUnboxable (I# value#) = tagToEnum# value#
tcfail164.hs:11:4:
Bad call to tagToEnum# at type a
Specify the type by giving a type signature
e.g. (tagToEnum# x) :: Bool
In the call (tagToEnum# 0#)
In the expression: tagToEnum# 0#
In the definition of `f': f = tagToEnum# 0#
tcfail164.hs:17:33:
Bad call to tagToEnum# at type Int
Specify the type by giving a type signature
e.g. (tagToEnum# x) :: Bool
In the call (tagToEnum# value#)
In the expression: tagToEnum# value#
In the definition of `readUnboxable':
readUnboxable (I# value#) = tagToEnum# value#
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment