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 $@
--- /dev/null
+{-# 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" ++ _) = "_"
--- /dev/null
+
+tcfail089.hs:10:
+ `++' is not a data constructor
+ In the pattern: "hd" ++ _
+ In an equation for function `compute': compute ("hd" ++ _) = "_"
--- /dev/null
+{-# 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)
+ }
+
+
+
--- /dev/null
+[3,3,3]
+[True,False]