Commit 37d56f58 authored by Matt Renaud's avatar Matt Renaud

Add tests exercising new -Werror behaviour with DEPRECATED symbols.

- When only -Werror is specified, use of DEPRECATED symbols will still
  successfully compile, but with warnings.
- Use of -Werror=deprecations will cause a compile failure when
  DEPRECATED symbols are used.
parent 71b73094
Pipeline #975 passed with stages
in 444 minutes and 41 seconds
-- This test verfies that use of DEPRECATED symbols (record fields here)
-- when compiled with -Werror does not result in a compile failure. Only
-- by explicitly requesting -Werror=deprecations will this result in a
-- compile failure.
--
-- See the test OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation which
-- verified that -Werror=deprecations results in a compile failure.
{-# LANGUAGE DuplicateRecordFields #-}
{-# OPTIONS_GHC -Werror #-}
import OverloadedRecFldsWithDeprecatedFields_A
data S = MkS { foo :: Bool }
f :: T -> T
f e = e { foo = 3, bar = 3 }
s :: T -> Int
s = foo
main = return ()
OverloadedRecFldsWithDeprecatedFields.hs:16:11: warning: [-Wdeprecations (in -Wdefault)]
In the use of ‘foo’
(imported from OverloadedRecFldsWithDeprecatedFields_A):
Deprecated: "Deprecated foo"
OverloadedRecFldsWithDeprecatedFields.hs:16:20: warning: [-Wdeprecations (in -Wdefault)]
In the use of ‘bar’
(imported from OverloadedRecFldsWithDeprecatedFields_A):
Deprecated: "Deprecated bar"
OverloadedRecFldsWithDeprecatedFields.hs:19:5: warning: [-Wdeprecations (in -Wdefault)]
In the use of ‘foo’
(imported from OverloadedRecFldsWithDeprecatedFields_A):
Deprecated: "Deprecated foo"
module OverloadedRecFldsWithDeprecatedFields_A where
{-# DEPRECATED foo "Deprecated foo" #-}
{-# DEPRECATED bar "Deprecated bar" #-}
data T = MkT { foo :: Int, bar :: Int }
test('T11173', [], multimod_compile, ['T11173', '-v0'])
test('T12609', normal, compile, [''])
test('OverloadedRecFldsWithDeprecatedFields', [], multimod_compile, ['OverloadedRecFldsWithDeprecatedFields', '-v0'])
-- This test verifies that use of DEPRECATED symbols (record fields here)
-- when compiled with -Werror=deprecations results in a compile failure.
--
-- This test differs slightly from the overloadedrecfldsfail12 test in that this
-- marks the fields with DEPRECATED instead of WARNING and is thus unaffected by
-- -Werror by default (which leaves use of DEPRECATED symbols as a warning).
--
-- See the test OverloadedRecFldsWithDeprecatedFields which verifies that when
-- only -Werror is set the code still compiles (but still issues warnings).
{-# LANGUAGE DuplicateRecordFields #-}
{-# OPTIONS_GHC -Werror=deprecations #-}
import OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation_A
data S = MkS { foo :: Bool }
f :: T -> T
f e = e { foo = 3, bar = 3 }
s :: T -> Int
s = foo
main = return ()
[1 of 2] Compiling OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation_A ( OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation_A.hs, OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation_A.o )
[2 of 2] Compiling Main ( OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation.hs, OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation.o )
OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation.hs:18:11: [-Wdeprecations (in -Wdefault), -Werror=deprecations]
In the use of ‘foo’
(imported from OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation_A):
Deprecated: "Deprecated foo"
OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation.hs:18:20: [-Wdeprecations (in -Wdefault), -Werror=deprecations]
In the use of ‘bar’
(imported from OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation_A):
Deprecated: "Deprecated bar"
OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation.hs:21:5: [-Wdeprecations (in -Wdefault), -Werror=deprecations]
In the use of ‘foo’
(imported from OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation_A):
Deprecated: "Deprecated foo"
module OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation_A where
{-# DEPRECATED foo "Deprecated foo" #-}
{-# DEPRECATED bar "Deprecated bar" #-}
data T = MkT { foo :: Int, bar :: Int }
......@@ -32,3 +32,4 @@ test('hasfieldfail03', normal, compile_fail, [''])
test('T14953', [extra_files(['T14953_A.hs', 'T14953_B.hs'])],
multimod_compile_fail, ['T14953', ''])
test('DuplicateExports', normal, compile_fail, [''])
test('OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation', [extra_files(['OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation_A.hs'])], multimod_compile_fail, ['OverloadedRecFldsFailDeprecatedFieldsWerrordeprecation', ''])
\ No newline at end of file
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