Commit 09711029 authored by simonpj's avatar simonpj
Browse files

[project @ 2005-12-05 10:08:53 by simonpj]

Add an expected-failure test
parent fd9fbf66
......@@ -208,6 +208,7 @@ test('tc195', only_compiler_types(['ghc']), compile, [''])
test('tc196', normal, compile, [''])
test('tc197', normal, compile, [''])
test('tc198', normal, compile, [''])
test('tc199', expect_fail_if_compiler_type('ghc'), compile, [''])
test('syn-perf', normal, compile, ['-fcontext-stack=30'])
test('LoopOfTheDay1', normal, compile, [''])
{-# OPTIONS -fglasgow-exts #-}
-- This code defines a default method with a highly dubious type,
-- because 'v' is not mentioned, and there are no fundeps
-- However, arguably the instance declaration should be accepted,
-- beause it's equivalent to
-- instance Baz Int Int where { foo x = x }
-- which *does* typecheck
-- GHC does not actually macro-expand the instance decl. Instead, it
-- defines a default method function, thus
-- $dmfoo :: Baz v x => x -> x
-- $dmfoo y = y
-- Notice that this is an ambiguous type: you can't call $dmfoo
-- without triggering an error. And when you write an instance decl,
-- it calls the default method:
-- instance Baz Int Int where foo = $dmfoo
-- I'd never thought of that. You might think that we should just
-- *infer* the type of the default method (here forall a. a->a), but
-- in the presence of higher rank types etc we can't necessarily do
-- that.
module Foo1 where
class Baz v x where
foo :: x -> x
foo y = y
instance Baz Int Int
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