diff --git a/tests/rename/should_fail/T5892a.hs b/tests/rename/should_fail/T5892a.hs new file mode 100644 index 000000000..c0ad9891f --- /dev/null +++ b/tests/rename/should_fail/T5892a.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE RecordWildCards #-} +{-# OPTIONS_GHC -Werror #-} + +module T5892a where + +import Data.Version ( Version( Version, versionBranch )) +-- Not importing its field: versionTags + +foo :: Version -> Version +foo (Version {..}) -- Pattern match does not bind versionTags + = let versionBranch = [] + in Version {..} -- Hence warning here diff --git a/tests/rename/should_fail/T5892a.stderr b/tests/rename/should_fail/T5892a.stderr new file mode 100644 index 000000000..9eecad61b --- /dev/null +++ b/tests/rename/should_fail/T5892a.stderr @@ -0,0 +1,10 @@ + +T5892a.hs:12:8: Warning: + Fields of `Version' not initialised: Data.Version.versionTags + In the expression: Version {..} + In the expression: let versionBranch = [] in Version {..} + In an equation for `foo': + foo (Version {..}) = let versionBranch = [] in Version {..} + +: +Failing due to -Werror. diff --git a/tests/rename/should_fail/T5892b.hs b/tests/rename/should_fail/T5892b.hs new file mode 100644 index 000000000..6bcea2785 --- /dev/null +++ b/tests/rename/should_fail/T5892b.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE RecordWildCards #-} +module T5892b where + +import Data.Version ( Version( Version, versionBranch )) +-- Not importing its field: versionTags + +Version{..} = Version [] [] +-- Binds versionBranch only + +foo = T5892b.versionBranch +bar = T5892b.versionTags diff --git a/tests/rename/should_fail/T5892b.stderr b/tests/rename/should_fail/T5892b.stderr new file mode 100644 index 000000000..10d6c3692 --- /dev/null +++ b/tests/rename/should_fail/T5892b.stderr @@ -0,0 +1,4 @@ + +T5892b.hs:11:7: + Not in scope: `T5892b.versionTags' + Perhaps you meant `T5892b.versionBranch' (line 7) diff --git a/tests/rename/should_fail/all.T b/tests/rename/should_fail/all.T index c0e4f54c5..c762efcf4 100644 --- a/tests/rename/should_fail/all.T +++ b/tests/rename/should_fail/all.T @@ -99,3 +99,5 @@ test('T5657', normal, compile_fail, ['']) test('T5745', extra_clean(['T5745a.hi', 'T5745a.o', 'T5745b.hi', 'T5745b.o']), multimod_compile_fail, ['T5745', '-v0']) +test('T5892a', normal, compile_fail, ['']) +test('T5892b', normal, compile_fail, [''])