Commit 53389e36 authored by simonpj's avatar simonpj
Browse files

[project @ 2000-12-19 10:50:51 by simonpj]

Add two tests
parent 7b4c4250
......@@ -10,6 +10,8 @@ HS_SRCS = $(wildcard *.hs)
tcfail045_HC_OPTS = -fglasgow-exts -package lang
tcfail068_HC_OPTS = -fglasgow-exts -package lang
tcfail080_HC_OPTS = -fglasgow-exts -package lang
tcfail089_HC_OPTS = -O
# The -O can't go in {-# OPTIONS #-} because it's static
Inst82_1.o : Inst82_1.hs Data82.hi
$(HC) $(HC_OPTS) -c $< -o $@
......
{-# OPTIONS -fglasgow-exts #-}
-- !!! Check non-constructors in patterns fail tidily
-- !!! The -O made ghc 4.08 go into a loop!
-- Unfortunately the -O has to go in the Makefile
module ShouldFail where
compute :: String -> String
compute ("hd" ++ _) = "_"
tcfail089.hs:10:
`++' is not a data constructor
In the pattern: "hd" ++ _
In an equation for function `compute': compute ("hd" ++ _) = "_"
{-# OPTIONS -fglasgow-exts #-}
-- !!! Check that record selectors for polymorphic fields work right
module Main where
import IO
class Foo a where
bar :: a -> [a]
instance Foo Int where
bar x = replicate x x
instance Foo Bool where
bar x = [x, not x]
data Record = R {
blub :: Foo a => a -> [a]
}
main = do { let r = R {blub = bar}
; print (blub r (3::Int))
; print (blub r True)
}
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