diff options
Diffstat (limited to 'testsuite')
161 files changed, 982 insertions, 413 deletions
diff --git a/testsuite/tests/backpack/reexport/T23080a.bkp b/testsuite/tests/backpack/reexport/T23080a.bkp new file mode 100644 index 0000000000..3ca2d22cda --- /dev/null +++ b/testsuite/tests/backpack/reexport/T23080a.bkp @@ -0,0 +1,9 @@ +unit t23080-unit1 where + signature H1 where + data T +unit t23080-unit2 where + dependency t23080-unit1[H1=<H2>] + module B where + data T = MkT + signature H2 (T(MkT)) where + import B diff --git a/testsuite/tests/backpack/reexport/T23080b.bkp b/testsuite/tests/backpack/reexport/T23080b.bkp new file mode 100644 index 0000000000..bb4d86ab9e --- /dev/null +++ b/testsuite/tests/backpack/reexport/T23080b.bkp @@ -0,0 +1,9 @@ +unit t23080-unit1 where + signature H1 where + data T +unit t23080-unit2 where + dependency t23080-unit1[H1=<H2>] + module B where + data T = MkT { fld :: T } + signature H2 (T(fld)) where + import B diff --git a/testsuite/tests/backpack/reexport/all.T b/testsuite/tests/backpack/reexport/all.T index f677f01f2e..5bab153169 100644 --- a/testsuite/tests/backpack/reexport/all.T +++ b/testsuite/tests/backpack/reexport/all.T @@ -9,3 +9,5 @@ test('bkpreex07', normal, backpack_typecheck, ['']) test('bkpreex08', normal, backpack_typecheck, ['']) test('bkpreex09', normal, backpack_typecheck, ['']) test('bkpreex10', normal, backpack_typecheck, ['']) +test('T23080a', expect_broken(23080), backpack_typecheck, ['']) +test('T23080b', expect_broken(23080), backpack_typecheck, ['']) diff --git a/testsuite/tests/backpack/reexport/bkpreex05.bkp b/testsuite/tests/backpack/reexport/bkpreex05.bkp index e496ed76fa..811ff69b89 100644 --- a/testsuite/tests/backpack/reexport/bkpreex05.bkp +++ b/testsuite/tests/backpack/reexport/bkpreex05.bkp @@ -1,28 +1,28 @@ unit bar where - signature A(bar) where - data A = A { foo :: Int, bar :: Bool } + signature H1(bar) where + data A = MkA { foo :: Int, bar :: Bool } unit foo where - signature A(foo) where - data A = A { foo :: Int, bar :: Bool } + signature H2(foo) where + data A = MkA { foo :: Int, bar :: Bool } unit impl where - module A1 where - data A = A { foo :: Int, bar :: Bool } - module A2 where - data A = A { foo :: Int, bar :: Bool } - module A(foo, bar) where - import A1(foo) - import A2(bar) + module M1 where + data A = MkA { foo :: Int, bar :: Bool } + module M2 where + data A = MkA { foo :: Int, bar :: Bool } + module M(foo, bar) where + import M1(foo) + import M2(bar) -- Kind of boring test now haha unit barimpl where - dependency bar[A=impl:A] + dependency bar[H1=impl:M] unit fooimpl where - dependency foo[A=impl:A] + dependency foo[H2=impl:M] unit foobarimpl where - dependency foo[A=impl:A] - dependency bar[A=impl:A] + dependency foo[H2=impl:M] + dependency bar[H1=impl:M] diff --git a/testsuite/tests/count-deps/CountDepsAst.stdout b/testsuite/tests/count-deps/CountDepsAst.stdout index efd58af99f..652a35a9b7 100644 --- a/testsuite/tests/count-deps/CountDepsAst.stdout +++ b/testsuite/tests/count-deps/CountDepsAst.stdout @@ -201,7 +201,6 @@ GHC.Types.Avail GHC.Types.Basic GHC.Types.BreakInfo GHC.Types.CompleteMatch -GHC.Types.ConInfo GHC.Types.CostCentre GHC.Types.CostCentre.State GHC.Types.Cpr @@ -213,6 +212,7 @@ GHC.Types.Fixity GHC.Types.Fixity.Env GHC.Types.ForeignCall GHC.Types.ForeignStubs +GHC.Types.GREInfo GHC.Types.Hint GHC.Types.Hint.Ppr GHC.Types.HpcInfo diff --git a/testsuite/tests/count-deps/CountDepsParser.stdout b/testsuite/tests/count-deps/CountDepsParser.stdout index f1116f5198..4850f57f96 100644 --- a/testsuite/tests/count-deps/CountDepsParser.stdout +++ b/testsuite/tests/count-deps/CountDepsParser.stdout @@ -208,7 +208,6 @@ GHC.Types.Avail GHC.Types.Basic GHC.Types.BreakInfo GHC.Types.CompleteMatch -GHC.Types.ConInfo GHC.Types.CostCentre GHC.Types.CostCentre.State GHC.Types.Cpr @@ -220,6 +219,7 @@ GHC.Types.Fixity GHC.Types.Fixity.Env GHC.Types.ForeignCall GHC.Types.ForeignStubs +GHC.Types.GREInfo GHC.Types.Hint GHC.Types.Hint.Ppr GHC.Types.HpcInfo diff --git a/testsuite/tests/deriving/should_compile/T13919.stderr b/testsuite/tests/deriving/should_compile/T13919.stderr index e57fc77371..02cfb71aaa 100644 --- a/testsuite/tests/deriving/should_compile/T13919.stderr +++ b/testsuite/tests/deriving/should_compile/T13919.stderr @@ -1,3 +1,3 @@ T13919.hs:13:19: warning: [-Wunused-top-binds (in -Wextra, -Wunused-binds)] - Defined but not used: ‘bar4’ + Defined but not used: record field of Foo4 ‘bar4’ diff --git a/testsuite/tests/gadt/T18191.stderr b/testsuite/tests/gadt/T18191.stderr index b8c6c60bdc..ce877d0332 100644 --- a/testsuite/tests/gadt/T18191.stderr +++ b/testsuite/tests/gadt/T18191.stderr @@ -1,20 +1,26 @@ T18191.hs:6:11: error: - GADT constructor type signature cannot contain nested ‘forall’s or contexts - In the definition of data constructor ‘MkT’ + • GADT constructor type signature cannot contain nested ‘forall’s or contexts + • In the definition of data constructor ‘MkT’ T18191.hs:9:11: error: - GADT constructor type signature cannot contain nested ‘forall’s or contexts - In the definition of data constructor ‘MkS’ + • GADT constructor type signature cannot contain nested ‘forall’s or contexts + • In the definition of data constructor ‘MkS’ T18191.hs:12:11: error: - GADT constructor type signature cannot contain nested ‘forall’s or contexts - In the definition of data constructor ‘MkU’ + • GADT constructor type signature cannot contain nested ‘forall’s or contexts + • In the definition of data constructor ‘MkU’ T18191.hs:15:21: error: - GADT constructor type signature cannot contain nested ‘forall’s or contexts - In the definition of data constructor ‘MkZ1’ + • GADT constructor type signature cannot contain nested ‘forall’s or contexts + • In the definition of data constructor ‘MkZ1’ + +T18191.hs:15:31: error: [GHC-89246] + Record syntax is illegal here: {unZ1 :: (a, b)} T18191.hs:16:19: error: - GADT constructor type signature cannot contain nested ‘forall’s or contexts - In the definition of data constructor ‘MkZ2’ + • GADT constructor type signature cannot contain nested ‘forall’s or contexts + • In the definition of data constructor ‘MkZ2’ + +T18191.hs:16:27: error: [GHC-89246] + Record syntax is illegal here: {unZ1 :: (a, b)} diff --git a/testsuite/tests/ghci.debugger/scripts/break006.stderr b/testsuite/tests/ghci.debugger/scripts/break006.stderr index 80419e9f35..705e9b359c 100644 --- a/testsuite/tests/ghci.debugger/scripts/break006.stderr +++ b/testsuite/tests/ghci.debugger/scripts/break006.stderr @@ -8,7 +8,7 @@ instance Show Ordering -- Defined in ‘GHC.Show’ instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ ...plus 25 others - ...plus 12 instances involving out-of-scope types + ...plus 13 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In a stmt of an interactive GHCi command: print it @@ -21,6 +21,6 @@ instance Show Ordering -- Defined in ‘GHC.Show’ instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ ...plus 25 others - ...plus 12 instances involving out-of-scope types + ...plus 13 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In a stmt of an interactive GHCi command: print it diff --git a/testsuite/tests/ghci.debugger/scripts/print019.stderr b/testsuite/tests/ghci.debugger/scripts/print019.stderr index 0febc62927..ce45768335 100644 --- a/testsuite/tests/ghci.debugger/scripts/print019.stderr +++ b/testsuite/tests/ghci.debugger/scripts/print019.stderr @@ -8,6 +8,6 @@ instance Show Ordering -- Defined in ‘GHC.Show’ instance Show TyCon -- Defined in ‘GHC.Show’ ...plus 32 others - ...plus 13 instances involving out-of-scope types + ...plus 14 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In a stmt of an interactive GHCi command: print it diff --git a/testsuite/tests/ghci/scripts/T22125.script b/testsuite/tests/ghci/scripts/T22125.script new file mode 100644 index 0000000000..166d650dd9 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T22125.script @@ -0,0 +1,6 @@ +:seti -XTypeFamilies -XDuplicateRecordFields -XDerivingStrategies +data family D a +data instance D Int = MkD0 | MkDInt { x :: Int, y :: Bool } deriving Show +data instance D Bool = MkDBool { x :: Int } +f r = r { y = True, x = 14 } +f (MkDInt 3 False) diff --git a/testsuite/tests/ghci/scripts/T22125.stdout b/testsuite/tests/ghci/scripts/T22125.stdout new file mode 100644 index 0000000000..1a6c1af6ab --- /dev/null +++ b/testsuite/tests/ghci/scripts/T22125.stdout @@ -0,0 +1 @@ +MkDInt {x = 14, y = True} diff --git a/testsuite/tests/ghci/scripts/T23062.script b/testsuite/tests/ghci/scripts/T23062.script new file mode 100644 index 0000000000..ee46726247 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T23062.script @@ -0,0 +1,5 @@ +:seti -XDuplicateRecordFields -XDerivingStrategies +data A = MkA { foo :: Int, bar :: Int } deriving stock Show +data B = MkB { foo :: Int } +f r = r { foo = 3, bar = 4 } +f (MkA { foo = 2, bar = 3 }) diff --git a/testsuite/tests/ghci/scripts/T23062.stdout b/testsuite/tests/ghci/scripts/T23062.stdout new file mode 100644 index 0000000000..fe41ddb4e5 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T23062.stdout @@ -0,0 +1 @@ +MkA {foo = 3, bar = 4} diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index fa22b7ae8d..90c3b05514 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -370,6 +370,8 @@ test('T21110', [extra_files(['T21110A.hs'])], ghci_script, test('T17830', [filter_stdout_lines(r'======.*')], ghci_script, ['T17830.script']) test('T21294a', normal, ghci_script, ['T21294a.script']) test('T21507', normal, ghci_script, ['T21507.script']) +test('T22125', normal, ghci_script, ['T22125.script']) test('T22695', normal, ghci_script, ['T22695.script']) test('T22817', normal, ghci_script, ['T22817.script']) test('T22908', normal, ghci_script, ['T22908.script']) +test('T23062', normal, ghci_script, ['T23062.script']) diff --git a/testsuite/tests/ghci/scripts/ghci065.stdout b/testsuite/tests/ghci/scripts/ghci065.stdout index e4048832cc..543a6caf20 100644 --- a/testsuite/tests/ghci/scripts/ghci065.stdout +++ b/testsuite/tests/ghci/scripts/ghci065.stdout @@ -9,13 +9,13 @@ Data3 :: * -- Type constructor defined at ghci065.hs:20:1 Data4 :: Int -> Data4 -- Data constructor defined at ghci065.hs:25:3 -- | This is the haddock comment of a data constructor for Data4. -dupeField :: DupeFields2 -> Int - -- Identifier defined at ghci065.hs:32:9 --- ^ This is the second haddock comment of a duplicate record field. - dupeField :: DupeFields1 -> Int -- Identifier defined at ghci065.hs:28:9 -- ^ This is the first haddock comment of a duplicate record field. + +dupeField :: DupeFields2 -> Int + -- Identifier defined at ghci065.hs:32:9 +-- ^ This is the second haddock comment of a duplicate record field. func1 :: Int -> Int -> Int -- Identifier defined at ghci065.hs:41:1 -- | This is the haddock comment of a function declaration for func1. diff --git a/testsuite/tests/linters/notes.stdout b/testsuite/tests/linters/notes.stdout index 0a8b2161fe..51fef76584 100644 --- a/testsuite/tests/linters/notes.stdout +++ b/testsuite/tests/linters/notes.stdout @@ -6,48 +6,43 @@ ref compiler/GHC/Core/Opt/Simplify/Iteration.hs:4009:8: Note [Lambda-boun ref compiler/GHC/Core/Opt/Simplify/Utils.hs:1343:37: Note [Gentle mode] ref compiler/GHC/Core/Opt/Specialise.hs:1790:28: Note [Arity decrease] ref compiler/GHC/Core/TyCo/Rep.hs:1556:31: Note [What prevents a constraint from floating] -ref compiler/GHC/Driver/Main.hs:1761:34: Note [simpleTidyPgm - mkBootModDetailsTc] -ref compiler/GHC/Driver/Session.hs:3976:49: Note [Eta-reduction in -O0] -ref compiler/GHC/Hs/Expr.hs:191:63: Note [Pending Splices] -ref compiler/GHC/Hs/Expr.hs:1706:87: Note [Lifecycle of a splice] -ref compiler/GHC/Hs/Expr.hs:1742:7: Note [Pending Splices] +ref compiler/GHC/Driver/Main.hs:1762:34: Note [simpleTidyPgm - mkBootModDetailsTc] +ref compiler/GHC/Driver/Session.hs:3993:49: Note [Eta-reduction in -O0] +ref compiler/GHC/Hs/Expr.hs:194:63: Note [Pending Splices] +ref compiler/GHC/Hs/Expr.hs:1736:87: Note [Lifecycle of a splice] +ref compiler/GHC/Hs/Expr.hs:1772:7: Note [Pending Splices] ref compiler/GHC/Hs/Extension.hs:146:5: Note [Strict argument type constraints] ref compiler/GHC/Hs/Pat.hs:143:74: Note [Lifecycle of a splice] ref compiler/GHC/HsToCore/Pmc/Solver.hs:858:20: Note [COMPLETE sets on data families] ref compiler/GHC/HsToCore/Quote.hs:1476:7: Note [How brackets and nested splices are handled] -ref compiler/GHC/Rename/Pat.hs:890:29: Note [Disambiguating record fields] ref compiler/GHC/Stg/Unarise.hs:442:32: Note [Renaming during unarisation] ref compiler/GHC/StgToCmm.hs:106:18: Note [codegen-split-init] ref compiler/GHC/StgToCmm.hs:109:18: Note [pipeline-split-init] ref compiler/GHC/StgToCmm/Expr.hs:585:4: Note [case on bool] ref compiler/GHC/StgToCmm/Expr.hs:853:3: Note [alg-alt heap check] -ref compiler/GHC/Tc/Gen/Expr.hs:1212:23: Note [Disambiguating record fields] -ref compiler/GHC/Tc/Gen/Expr.hs:1427:7: Note [Disambiguating record fields] -ref compiler/GHC/Tc/Gen/Expr.hs:1530:11: Note [Deprecating ambiguous fields] -ref compiler/GHC/Tc/Gen/HsType.hs:557:56: Note [Skolem escape prevention] -ref compiler/GHC/Tc/Gen/HsType.hs:2622:7: Note [Matching a kind signature with a declaration] +ref compiler/GHC/Tc/Gen/HsType.hs:556:56: Note [Skolem escape prevention] +ref compiler/GHC/Tc/Gen/HsType.hs:2621:7: Note [Matching a kind signature with a declaration] ref compiler/GHC/Tc/Gen/Pat.hs:176:20: Note [Typing patterns in pattern bindings] ref compiler/GHC/Tc/Gen/Pat.hs:1127:7: Note [Matching polytyped patterns] ref compiler/GHC/Tc/Gen/Sig.hs:81:10: Note [Overview of type signatures] -ref compiler/GHC/Tc/Gen/Splice.hs:359:16: Note [How brackets and nested splices are handled] -ref compiler/GHC/Tc/Gen/Splice.hs:534:35: Note [PendingRnSplice] -ref compiler/GHC/Tc/Gen/Splice.hs:658:7: Note [How brackets and nested splices are handled] -ref compiler/GHC/Tc/Gen/Splice.hs:891:11: Note [How brackets and nested splices are handled] +ref compiler/GHC/Tc/Gen/Splice.hs:357:16: Note [How brackets and nested splices are handled] +ref compiler/GHC/Tc/Gen/Splice.hs:532:35: Note [PendingRnSplice] +ref compiler/GHC/Tc/Gen/Splice.hs:656:7: Note [How brackets and nested splices are handled] +ref compiler/GHC/Tc/Gen/Splice.hs:889:11: Note [How brackets and nested splices are handled] ref compiler/GHC/Tc/Instance/Family.hs:474:35: Note [Constrained family instances] -ref compiler/GHC/Tc/Module.hs:708:15: Note [Extra dependencies from .hs-boot files] +ref compiler/GHC/Tc/Module.hs:711:15: Note [Extra dependencies from .hs-boot files] ref compiler/GHC/Tc/Solver/Rewrite.hs:1008:7: Note [Stability of rewriting] -ref compiler/GHC/Tc/TyCl.hs:1119:6: Note [Unification variables need fresh Names] -ref compiler/GHC/Tc/Types.hs:697:33: Note [Extra dependencies from .hs-boot files] -ref compiler/GHC/Tc/Types.hs:1428:47: Note [Care with plugin imports] -ref compiler/GHC/Tc/Types/Constraint.hs:223:34: Note [NonCanonical Semantics] +ref compiler/GHC/Tc/TyCl.hs:1120:6: Note [Unification variables need fresh Names] +ref compiler/GHC/Tc/Types.hs:692:33: Note [Extra dependencies from .hs-boot files] +ref compiler/GHC/Tc/Types.hs:1423:47: Note [Care with plugin imports] +ref compiler/GHC/Tc/Types/Constraint.hs:255:34: Note [NonCanonical Semantics] ref compiler/GHC/Types/Demand.hs:306:25: Note [Preserving Boxity of results is rarely a win] ref compiler/GHC/Unit/Module/Deps.hs:81:13: Note [Structure of dep_boot_mods] -ref compiler/GHC/Utils/Monad.hs:400:34: Note [multiShotIO] +ref compiler/GHC/Utils/Monad.hs:410:34: Note [multiShotIO] ref compiler/Language/Haskell/Syntax/Binds.hs:200:31: Note [fun_id in Match] -ref compiler/Language/Haskell/Syntax/Pat.hs:356:12: Note [Disambiguating record fields] ref configure.ac:210:10: Note [Linking ghc-bin against threaded stage0 RTS] ref docs/core-spec/core-spec.mng:177:6: Note [TyBinders] -ref hadrian/src/Expression.hs:134:30: Note [Linking ghc-bin against threaded stage0 RTS] +ref hadrian/src/Expression.hs:145:30: Note [Linking ghc-bin against threaded stage0 RTS] ref linters/lint-notes/Notes.hs:32:29: Note [" <> T.unpack x <> "] ref linters/lint-notes/Notes.hs:69:22: Note [...] ref testsuite/config/ghc:272:10: Note [WayFlags] diff --git a/testsuite/tests/overloadedrecflds/ghci/GHCiDRF.stdout b/testsuite/tests/overloadedrecflds/ghci/GHCiDRF.stdout index 08406f9387..c912c3c4ee 100644 --- a/testsuite/tests/overloadedrecflds/ghci/GHCiDRF.stdout +++ b/testsuite/tests/overloadedrecflds/ghci/GHCiDRF.stdout @@ -3,18 +3,18 @@ GHCiDRF.foo :: T -> Int <interactive>:1:1: error: Ambiguous occurrence ‘GHCiDRF.bar’ It could refer to - either the field ‘bar’ of record ‘U’, defined at GHCiDRF.hs:4:16 - or the field ‘bar’ of record ‘T’, defined at GHCiDRF.hs:3:28 + either the field ‘bar’ of record ‘T’, defined at GHCiDRF.hs:3:28 + or the field ‘bar’ of record ‘U’, defined at GHCiDRF.hs:4:16 type T :: * data T = MkT {foo :: Int, ...} -- Defined at GHCiDRF.hs:3:16 -type U :: * -data U = MkU {GHCiDRF.bar :: Bool} - -- Defined at GHCiDRF.hs:4:16 - type T :: * -data T = MkT {..., GHCiDRF.bar :: Int} +data T = MkT {..., bar :: Int} -- Defined at GHCiDRF.hs:3:28 + +type U :: * +data U = MkU {bar :: Bool} + -- Defined at GHCiDRF.hs:4:16 GHCiDRF.foo :: GHCiDRF.T -> Int <interactive>:1:1: error: diff --git a/testsuite/tests/overloadedrecflds/ghci/T19664.hs b/testsuite/tests/overloadedrecflds/ghci/T19664.hs new file mode 100644 index 0000000000..e7e38193a0 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/ghci/T19664.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE QuasiQuotes, TemplateHaskell, DuplicateRecordFields #-} + +module T19664 where + +import Language.Haskell.TH + +left = undefined + +([] <$) $ runIO . print =<< [d| + data Tree + = Node { left :: Tree, right :: Tree } + | Leaf { value :: Int } + deriving Show + |] diff --git a/testsuite/tests/overloadedrecflds/ghci/T19664.script b/testsuite/tests/overloadedrecflds/ghci/T19664.script new file mode 100644 index 0000000000..92f69cfe8c --- /dev/null +++ b/testsuite/tests/overloadedrecflds/ghci/T19664.script @@ -0,0 +1,2 @@ +:seti -XDuplicateRecordFields +:l T19664 diff --git a/testsuite/tests/overloadedrecflds/ghci/T19664.stdout b/testsuite/tests/overloadedrecflds/ghci/T19664.stdout new file mode 100644 index 0000000000..3742c489c8 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/ghci/T19664.stdout @@ -0,0 +1 @@ +[DataD [] Tree_6989586621679019412 [] Nothing [RecC Node_6989586621679019413 [(left_6989586621679019416,Bang NoSourceUnpackedness NoSourceStrictness,ConT Tree_6989586621679019412),(right_6989586621679019415,Bang NoSourceUnpackedness NoSourceStrictness,ConT Tree_6989586621679019412)],RecC Leaf_6989586621679019414 [(value_6989586621679019417,Bang NoSourceUnpackedness NoSourceStrictness,ConT GHC.Types.Int)]] [DerivClause Nothing [ConT GHC.Show.Show]]] diff --git a/testsuite/tests/overloadedrecflds/ghci/all.T b/testsuite/tests/overloadedrecflds/ghci/all.T index 17f4f82ff5..6e775149e5 100644 --- a/testsuite/tests/overloadedrecflds/ghci/all.T +++ b/testsuite/tests/overloadedrecflds/ghci/all.T @@ -4,3 +4,4 @@ test('T13438', [expect_broken(13438), combined_output], ghci_script, ['T13438.sc test('GHCiDRF', [extra_files(['GHCiDRF.hs']), combined_output], ghci_script, ['GHCiDRF.script']) test('T19322', combined_output, ghci_script, ['T19322.script']) test('T19314', combined_output, ghci_script, ['T19314.script']) +test('T19664', [ignore_stdout, extra_files(['T19664.hs'])], ghci_script, ['T19664.script']) diff --git a/testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.script b/testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.script index 2aa0a15be8..cca0b8a93f 100644 --- a/testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.script +++ b/testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.script @@ -5,13 +5,12 @@ data T a = MkT { foo :: Bool, bar :: a -> a } let t = MkT { foo = True, bar = id } (\MkT{foo=foo} -> foo) t :info foo -:type foo -foo (MkS 42) bar (MkT True id) True :set -XNoDuplicateRecordFields -- Should be ambiguous :type foo data U = MkU { foo :: Int } -- New foo should shadow the old ones +:info foo :type foo foo (MkU 42) diff --git a/testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.stdout b/testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.stdout index ae87b8ea19..b34e509ecc 100644 --- a/testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.stdout +++ b/testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.stdout @@ -1,15 +1,20 @@ True +type S :: * +data S = MkS {foo :: Int} + -- Defined at <interactive>:3:16 + type T :: * -> * data T a = MkT {foo :: Bool, ...} -- Defined at <interactive>:4:18 -foo :: T a -> Bool - -<interactive>:9:6: error: [GHC-83865] - • Couldn't match expected type ‘T a0’ with actual type ‘S’ - • In the first argument of ‘foo’, namely ‘(MkS 42)’ - In the expression: foo (MkS 42) - In an equation for ‘it’: it = foo (MkS 42) True -foo :: T a -> Bool + +<interactive>:1:1: error: + Ambiguous occurrence ‘foo’ + It could refer to + either the field ‘foo’ of record ‘S’, defined at <interactive>:3:16 + or the field ‘foo’ of record ‘T’, defined at <interactive>:4:18 +type U :: * +data U = MkU {foo :: Int} + -- Defined at <interactive>:12:16 foo :: U -> Int 42 diff --git a/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport.hs b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport.hs new file mode 100644 index 0000000000..a0e527f1b3 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport.hs @@ -0,0 +1,8 @@ +module BootFldReexport where + +import {-# SOURCE #-} BootFldReexport_N + ( fld {- variable -} ) +import BootFldReexport_O + ( fld {- record field -} ) + +test3 = fld diff --git a/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport.stderr b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport.stderr new file mode 100644 index 0000000000..0830beb7fc --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport.stderr @@ -0,0 +1,11 @@ + +BootFldReexport.hs:8:9: error: + Ambiguous occurrence ‘fld’ + It could refer to + either ‘BootFldReexport_N.fld’, + imported from ‘BootFldReexport_N’ at BootFldReexport.hs:4:5-7 + (and originally defined in ‘BootFldReexport_O’ + at BootFldReexport_O.hs-boot:4:1-13) + or the field ‘fld’ of record ‘BootFldReexport_O.O’, + imported from ‘BootFldReexport_O’ at BootFldReexport.hs:6:5-7 + (and originally defined at BootFldReexport_O.hs:5:16-18) diff --git a/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_B.hs b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_B.hs new file mode 100644 index 0000000000..8d8024313c --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_B.hs @@ -0,0 +1,5 @@ +module BootFldReexport_B where + +import {-# SOURCE #-} BootFldReexport_N + +test2 = fld diff --git a/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_N.hs b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_N.hs new file mode 100644 index 0000000000..8a28e3705c --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_N.hs @@ -0,0 +1,5 @@ +module BootFldReexport_N ( module BootFldReexport_O ) where +import BootFldReexport_O +import BootFldReexport + +test1 = fld diff --git a/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_N.hs-boot b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_N.hs-boot new file mode 100644 index 0000000000..49c9c7c996 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_N.hs-boot @@ -0,0 +1,2 @@ +module BootFldReexport_N ( module BootFldReexport_O ) where +import {-# SOURCE #-} BootFldReexport_O
\ No newline at end of file diff --git a/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_O.hs b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_O.hs new file mode 100644 index 0000000000..733f7e3ed6 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_O.hs @@ -0,0 +1,5 @@ +module BootFldReexport_O where + +import BootFldReexport_B + +data O = MkO { fld :: O } diff --git a/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_O.hs-boot b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_O.hs-boot new file mode 100644 index 0000000000..617ec6fb90 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/BootFldReexport_O.hs-boot @@ -0,0 +1,4 @@ +module BootFldReexport_O where + +data O +fld :: O -> O diff --git a/testsuite/tests/overloadedrecflds/should_compile/DupFldFixity1.hs b/testsuite/tests/overloadedrecflds/should_compile/DupFldFixity1.hs new file mode 100644 index 0000000000..58e7afe673 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/DupFldFixity1.hs @@ -0,0 +1,9 @@ + + +{-# LANGUAGE DuplicateRecordFields #-} + +module DupFldFixity1 where + +data A = MkA { fld :: A -> A } + +infixr 4 `fld` diff --git a/testsuite/tests/overloadedrecflds/should_compile/DupFldFixity2.hs b/testsuite/tests/overloadedrecflds/should_compile/DupFldFixity2.hs new file mode 100644 index 0000000000..85811c3b0f --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/DupFldFixity2.hs @@ -0,0 +1,12 @@ + +{-# LANGUAGE NoFieldSelectors #-} + +module DupFldFixity2 where + +data A = MkA { fld :: A -> A } +data B + +fld :: B -> B -> B +fld x _ = x + +infixr 4 `fld` diff --git a/testsuite/tests/overloadedrecflds/should_compile/DupFldFixity3.hs b/testsuite/tests/overloadedrecflds/should_compile/DupFldFixity3.hs new file mode 100644 index 0000000000..73d8490d57 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/DupFldFixity3.hs @@ -0,0 +1,9 @@ + +{-# LANGUAGE DuplicateRecordFields #-} + +module DupFldFixity3 where + +data A = MkA { fld :: A -> A } +data B = MkB { fld :: A -> A } + +infixr 4 `fld` diff --git a/testsuite/tests/overloadedrecflds/should_compile/NoDRFModuleExport.hs b/testsuite/tests/overloadedrecflds/should_compile/NoDRFModuleExport.hs new file mode 100644 index 0000000000..11a21af800 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/NoDRFModuleExport.hs @@ -0,0 +1,6 @@ +-- Test that we can re-export a module defining +-- duplicate record fields, without ourselves enabling +-- the DuplicateRecordFields extension. + +module NoDRFModuleExport ( module NoDRFModuleExport_aux ) where + import NoDRFModuleExport_aux diff --git a/testsuite/tests/overloadedrecflds/should_compile/NoDRFModuleExport_aux.hs b/testsuite/tests/overloadedrecflds/should_compile/NoDRFModuleExport_aux.hs new file mode 100644 index 0000000000..4720fdd547 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/NoDRFModuleExport_aux.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE DuplicateRecordFields #-} +module NoDRFModuleExport_aux where + data A = MkA { foo :: A } + data B = MkB { foo :: B } diff --git a/testsuite/tests/overloadedrecflds/should_compile/OverloadedRecFlds10_A.hs b/testsuite/tests/overloadedrecflds/should_compile/OverloadedRecFlds10_A.hs new file mode 100644 index 0000000000..ae25153621 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/OverloadedRecFlds10_A.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE TypeFamilies #-} +module OverloadedRecFlds10_A where + +data family F a +data instance F Int = MkFInt { foo :: Int } diff --git a/testsuite/tests/overloadedrecflds/should_compile/OverloadedRecFlds10_B.hs b/testsuite/tests/overloadedrecflds/should_compile/OverloadedRecFlds10_B.hs new file mode 100644 index 0000000000..0f7be47880 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/OverloadedRecFlds10_B.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE TypeFamilies #-} +module OverloadedRecFlds10_B (F(..)) where + +import OverloadedRecFlds10_A hiding (foo) + +data instance F Bool = MkFBool { foo :: Int } diff --git a/testsuite/tests/overloadedrecflds/should_compile/OverloadedRecFlds10_C.hs b/testsuite/tests/overloadedrecflds/should_compile/OverloadedRecFlds10_C.hs new file mode 100644 index 0000000000..29c4863334 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/OverloadedRecFlds10_C.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE DuplicateRecordFields, TypeFamilies #-} +module OverloadedRecFlds10_C (F(..)) where + +import OverloadedRecFlds10_A + +data instance F Char = MkFChar { foo :: Char } diff --git a/testsuite/tests/overloadedrecflds/should_fail/T11103.hs b/testsuite/tests/overloadedrecflds/should_compile/T11103.hs index 2791dc4fca..6662b29cfa 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/T11103.hs +++ b/testsuite/tests/overloadedrecflds/should_compile/T11103.hs @@ -1,9 +1,7 @@ --- When using DuplicateRecordFields with TemplateHaskell, it is not possible to --- reify ambiguous names that are output by reifying field labels. --- See also overloadedrecflds/should_run/overloadedrecfldsrun04.hs - {-# LANGUAGE DuplicateRecordFields, TemplateHaskell #-} +module T11103 where + import Language.Haskell.TH import Language.Haskell.TH.Syntax diff --git a/testsuite/tests/overloadedrecflds/should_compile/T13352.hs b/testsuite/tests/overloadedrecflds/should_compile/T13352.hs new file mode 100644 index 0000000000..9d85b725b6 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T13352.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE DuplicateRecordFields #-} +module T13352 (S(foo), T(foo)) where + import T13352_A (S(..)) + import T13352_B (T(..)) diff --git a/testsuite/tests/overloadedrecflds/should_compile/T13352_A.hs b/testsuite/tests/overloadedrecflds/should_compile/T13352_A.hs new file mode 100644 index 0000000000..2639b4bb38 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T13352_A.hs @@ -0,0 +1,2 @@ +module T13352_A where + data S = MkS { foo :: Int } diff --git a/testsuite/tests/overloadedrecflds/should_compile/T13352_B.hs b/testsuite/tests/overloadedrecflds/should_compile/T13352_B.hs new file mode 100644 index 0000000000..b04cd1168f --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T13352_B.hs @@ -0,0 +1,2 @@ +module T13352_B where + data T = MkT { foo :: Int } diff --git a/testsuite/tests/overloadedrecflds/should_compile/T13352_hard.hs b/testsuite/tests/overloadedrecflds/should_compile/T13352_hard.hs new file mode 100644 index 0000000000..982305e71d --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T13352_hard.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE DuplicateRecordFields #-} +module T13352_hard (S(foo), T(foo)) where + import T13352_hard_A (S(..)) + import T13352_hard_B (T(..)) diff --git a/testsuite/tests/overloadedrecflds/should_compile/T13352_hard.stderr b/testsuite/tests/overloadedrecflds/should_compile/T13352_hard.stderr new file mode 100644 index 0000000000..bd4bf93121 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T13352_hard.stderr @@ -0,0 +1,9 @@ + +T13352_hard.hs:2:29: error: [GHC-69158] + Conflicting exports for ‘foo’: + ‘S(foo)’ exports ‘T13352_hard_A.foo’ + imported from ‘T13352_hard_A’ at T13352_hard.hs:3:25-29 + (and originally defined at T13352_hard_A.hs:3:16-18) + ‘T(foo)’ exports ‘T13352_hard_B.foo’ + imported from ‘T13352_hard_B’ at T13352_hard.hs:4:25-29 + (and originally defined at T13352_hard_B.hs:3:16-18) diff --git a/testsuite/tests/overloadedrecflds/should_compile/T13352_hard_A.hs b/testsuite/tests/overloadedrecflds/should_compile/T13352_hard_A.hs new file mode 100644 index 0000000000..3fcba12280 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T13352_hard_A.hs @@ -0,0 +1,3 @@ +{-# LANGUAGE DuplicateRecordFields #-} +module T13352_hard_A where + data S = C { foo :: Int } diff --git a/testsuite/tests/overloadedrecflds/should_compile/T13352_hard_B.hs b/testsuite/tests/overloadedrecflds/should_compile/T13352_hard_B.hs new file mode 100644 index 0000000000..7271dda542 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T13352_hard_B.hs @@ -0,0 +1,3 @@ +{-# LANGUAGE DuplicateRecordFields #-} +module T13352_hard_B where + data T = C { foo :: Int } diff --git a/testsuite/tests/overloadedrecflds/should_compile/T14848.hs b/testsuite/tests/overloadedrecflds/should_compile/T14848.hs new file mode 100644 index 0000000000..f19ebbecca --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T14848.hs @@ -0,0 +1,10 @@ +{-# language TemplateHaskell #-} +{-# language DuplicateRecordFields #-} + +module T14848 where +import Language.Haskell.TH +import Language.Haskell.TH.Syntax + +data A = A {x :: Int, y :: String} +a = A 3 "test" +test = $([e|case a of A {x = b} -> b|]) diff --git a/testsuite/tests/overloadedrecflds/should_compile/T17551.hs b/testsuite/tests/overloadedrecflds/should_compile/T17551.hs new file mode 100644 index 0000000000..8fe5d9f808 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T17551.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE TemplateHaskell #-} + +module T17551 where + +import Language.Haskell.TH + +data Foo = Foo { foo :: Int } +data Bar = Bar { foo :: Int } + +$(do + TyConI (DataD _ _ _ _ [RecC con [(field, _, _)]] _) <- reify ''Bar + reify field + pure [] + ) diff --git a/testsuite/tests/overloadedrecflds/should_compile/T21720.hs b/testsuite/tests/overloadedrecflds/should_compile/T21720.hs new file mode 100644 index 0000000000..072bde217a --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T21720.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# OPTIONS_GHC -dcore-lint #-} + +module T21720 where + +import Language.Haskell.TH + +main :: IO () +main = pure () + +$(do + let noBang = Bang NoSourceUnpackedness NoSourceStrictness + let mkData tn cn fn = DataD [] tn [] Nothing [RecC cn [(fn, noBang, ConT ''Integer)]] [] + r1 <- mkData <$> newName "R1" <*> newName "C1" <*> newName "f" + r2 <- mkData <$> newName "R2" <*> newName "C2" <*> newName "f" + pure [r1,r2] + ) diff --git a/testsuite/tests/overloadedrecflds/should_compile/T21898.hs b/testsuite/tests/overloadedrecflds/should_compile/T21898.hs new file mode 100644 index 0000000000..b7b0b051e8 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T21898.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE DuplicateRecordFields, PatternSynonyms #-} + +module T21898 where + +pattern P :: Int -> Int -> (Int, Int) +pattern P { proj_x, proj_y } = (proj_x, proj_y) + +pattern Q1 :: Int -> Int +pattern Q1 { proj_x } = proj_x + +pattern Q2 :: Int -> Int +pattern Q2 { proj_y } = proj_y + +blah :: (Int, Int) -> (Int, Int) +blah p = p { proj_x = 0, proj_y = 1 } diff --git a/testsuite/tests/overloadedrecflds/should_compile/T22160.hs b/testsuite/tests/overloadedrecflds/should_compile/T22160.hs new file mode 100644 index 0000000000..28aaa3c735 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T22160.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE DisambiguateRecordFields #-} + +module T22160 where + +import T22160_A +import T22160_B +import T22160_C + +eg r = r { x = 1, y = 1 } diff --git a/testsuite/tests/overloadedrecflds/should_compile/T22160_A.hs b/testsuite/tests/overloadedrecflds/should_compile/T22160_A.hs new file mode 100644 index 0000000000..341df010ba --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T22160_A.hs @@ -0,0 +1,3 @@ +module T22160_A where + +data A = MkA { x :: Int } diff --git a/testsuite/tests/overloadedrecflds/should_compile/T22160_B.hs b/testsuite/tests/overloadedrecflds/should_compile/T22160_B.hs new file mode 100644 index 0000000000..2da5511e6c --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T22160_B.hs @@ -0,0 +1,3 @@ +module T22160_B where + +data B = MkB { y :: Int } diff --git a/testsuite/tests/overloadedrecflds/should_compile/T22160_C.hs b/testsuite/tests/overloadedrecflds/should_compile/T22160_C.hs new file mode 100644 index 0000000000..450463e0a6 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T22160_C.hs @@ -0,0 +1,3 @@ +module T22160_C where + +data C = MkC { x, y :: Int } diff --git a/testsuite/tests/overloadedrecflds/should_compile/T23010.hs b/testsuite/tests/overloadedrecflds/should_compile/T23010.hs new file mode 100644 index 0000000000..7ae1ff5f98 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T23010.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE DuplicateRecordFields #-} + +module T23010 ( A(..) ) where + +import T23010_aux ( X ) + +data A = MkA { fld :: A, other :: X } +data B = MkB { fld :: B } diff --git a/testsuite/tests/overloadedrecflds/should_compile/T23010.hs-boot b/testsuite/tests/overloadedrecflds/should_compile/T23010.hs-boot new file mode 100644 index 0000000000..ea72bd20f6 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T23010.hs-boot @@ -0,0 +1,7 @@ +{-# LANGUAGE DuplicateRecordFields #-} + +module T23010 where + +data A + +fld :: A -> A diff --git a/testsuite/tests/overloadedrecflds/should_compile/T23010_aux.hs b/testsuite/tests/overloadedrecflds/should_compile/T23010_aux.hs new file mode 100644 index 0000000000..1f1280b26a --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T23010_aux.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE DuplicateRecordFields #-} + +module T23010_aux where + +import {-# SOURCE #-} T23010 ( fld ) + +data X +bar = fld diff --git a/testsuite/tests/overloadedrecflds/should_compile/all.T b/testsuite/tests/overloadedrecflds/should_compile/all.T index 9d49752f2b..000fd696e4 100644 --- a/testsuite/tests/overloadedrecflds/should_compile/all.T +++ b/testsuite/tests/overloadedrecflds/should_compile/all.T @@ -12,3 +12,38 @@ test('T19154', normal, compile, ['']) test('T20723', normal, compile, ['']) test('T20989', normal, compile, ['']) test('T21625', [], multimod_compile, ['T21625', '-v0']) +test('DupFldFixity1', normal, compile, ['']) +test('DupFldFixity2', normal, compile, ['']) +test('T23010', [extra_files(['T23010.hs-boot', 'T23010_aux.hs'])] + , multimod_compile + , ['T23010', '-v0']) +test('T14848', req_th, compile, ['']) +test('T17551', req_th, compile, ['']) +test('T11103', req_th, compile, ['']) +test('T13352' + , [extra_files(['T13352_A.hs', 'T13352_B.hs'])] + , multimod_compile, ['T13352_A T13352_B T13352', '-v0']) +test('T13352_hard' + , [extra_files(['T13352_hard_A.hs', 'T13352_hard_B.hs'])] + , multimod_compile_fail, ['T13352_hard_A T13352_hard_B T13352_hard', '-v0']) +test('T21720', req_th, compile, ['']) +test('T21898', normal, compile, ['']) +test('T22160', [extra_files(['T22160_A.hs', 'T22160_B.hs', 'T22160_C.hs'])] + , multimod_compile, ['T22160_A T22160_B T22160_C T22160', '-v0']) +test('DupFldFixity3', normal, compile, ['']) +test('overloadedrecflds10' + , [extra_files(['OverloadedRecFlds10_A.hs', 'OverloadedRecFlds10_B.hs', 'OverloadedRecFlds10_C.hs'])] + , multimod_compile + , ['overloadedrecflds10', '-v0']) +test('NoDRFModuleExport' + , [extra_files(['NoDRFModuleExport_aux.hs'])] + , multimod_compile + , ['NoDRFModuleExport', '-v0']) +test('BootFldReexport' + , [extra_files([ 'BootFldReexport_N.hs', 'BootFldReexport_N.hs-boot' + , 'BootFldReexport_O.hs', 'BootFldReexport_O.hs-boot' + , 'BootFldReexport_B.hs' ])] + , multimod_compile_fail + # Should either pass or give an ambiguity error when compiling + # the final module (BootFldReexport), but not fail earlier. + , ['BootFldReexport', '-v0']) diff --git a/testsuite/tests/overloadedrecflds/should_compile/overloadedrecflds10.hs b/testsuite/tests/overloadedrecflds/should_compile/overloadedrecflds10.hs new file mode 100644 index 0000000000..c85d303d0e --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/overloadedrecflds10.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE DuplicateRecordFields #-} +module Main (main, F(..)) where + +import OverloadedRecFlds10_B +import OverloadedRecFlds10_C + +main = return () diff --git a/testsuite/tests/overloadedrecflds/should_fail/DRF9156.stderr b/testsuite/tests/overloadedrecflds/should_fail/DRF9156.stderr index ea1d10dc10..5e18bdf59a 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/DRF9156.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/DRF9156.stderr @@ -1,5 +1,3 @@ -DRF9156.hs:4:19: error: - Multiple declarations of ‘f1’ - Declared at: DRF9156.hs:3:15 - DRF9156.hs:4:19 +DRF9156.hs:4:19: error: [GHC-85524] + Duplicate field name ‘f1’ in record declaration diff --git a/testsuite/tests/overloadedrecflds/should_fail/DRFHoleFits.stderr b/testsuite/tests/overloadedrecflds/should_fail/DRFHoleFits.stderr index 61779352c3..1fb78b2175 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/DRFHoleFits.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/DRFHoleFits.stderr @@ -1,5 +1,3 @@ -[1 of 2] Compiling DRFHoleFits_A ( DRFHoleFits_A.hs, DRFHoleFits_A.o ) -[2 of 2] Compiling DRFHoleFits ( DRFHoleFits.hs, DRFHoleFits.o ) DRFHoleFits.hs:7:7: error: [GHC-88464] • Found hole: _ :: T -> Int @@ -19,6 +17,6 @@ DRFHoleFits.hs:8:7: error: [GHC-88464] baz :: A.S -> Int (bound at DRFHoleFits.hs:8:1) Valid hole fits include baz :: A.S -> Int (defined at DRFHoleFits.hs:8:1) - DRFHoleFits_A.foo :: A.S -> Int + A.foo :: A.S -> Int (imported qualified from ‘DRFHoleFits_A’ at DRFHoleFits.hs:3:1-35 (and originally defined at DRFHoleFits_A.hs:5:16-18)) diff --git a/testsuite/tests/overloadedrecflds/should_fail/DRFUnused.stderr b/testsuite/tests/overloadedrecflds/should_fail/DRFUnused.stderr index e020e8cd82..88e9e6537f 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/DRFUnused.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/DRFUnused.stderr @@ -2,6 +2,6 @@ DRFUnused.hs:18:5: error: Ambiguous occurrence ‘foo’ It could refer to - either the field ‘foo’ of record ‘U’, defined at DRFUnused.hs:12:16 + either the field ‘foo’ of record ‘S’, defined at DRFUnused.hs:10:16 or the field ‘foo’ of record ‘T’, defined at DRFUnused.hs:11:16 - or the field ‘foo’ of record ‘S’, defined at DRFUnused.hs:10:16 + or the field ‘foo’ of record ‘U’, defined at DRFUnused.hs:12:16 diff --git a/testsuite/tests/overloadedrecflds/should_fail/NFS9156.stderr b/testsuite/tests/overloadedrecflds/should_fail/NFS9156.stderr index 66ab58fcbd..c735f618e8 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/NFS9156.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/NFS9156.stderr @@ -1,5 +1,3 @@ -NFS9156.hs:4:19: error: - Multiple declarations of ‘f1’ - Declared at: NFS9156.hs:3:15 - NFS9156.hs:4:19 +NFS9156.hs:4:19: error: [GHC-85524] + Duplicate field name ‘f1’ in record declaration diff --git a/testsuite/tests/overloadedrecflds/should_fail/NFSExport.hs b/testsuite/tests/overloadedrecflds/should_fail/NFSExport.hs index 839b32bae4..86c21c2dcf 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/NFSExport.hs +++ b/testsuite/tests/overloadedrecflds/should_fail/NFSExport.hs @@ -1,3 +1,3 @@ {-# LANGUAGE NoFieldSelectors #-} module NFSExport (T(foo), foo) where -- only T(foo) is supported -data T = MkT { foo :: Bool } +data T = MkT { foo :: T } diff --git a/testsuite/tests/overloadedrecflds/should_fail/NFSMixed.hs b/testsuite/tests/overloadedrecflds/should_fail/NFSMixed.hs index d2b3d8dd1b..05ddc0cd39 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/NFSMixed.hs +++ b/testsuite/tests/overloadedrecflds/should_fail/NFSMixed.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE DisambiguateRecordFields #-} + module NFSMixed where import NFSMixedA diff --git a/testsuite/tests/overloadedrecflds/should_fail/NFSMixed.stderr b/testsuite/tests/overloadedrecflds/should_fail/NFSMixed.stderr index 0419feb764..3f50bfe597 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/NFSMixed.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/NFSMixed.stderr @@ -1,13 +1,7 @@ -NFSMixed.hs:5:18: error: - Ambiguous occurrence ‘foo’ - It could refer to - either the field ‘foo’ of record ‘Foo’, - imported from ‘NFSMixedA’ at NFSMixed.hs:3:1-16 - (and originally defined at NFSMixedA.hs:4:18-20) - or the field ‘foo’ of record ‘Bar’, - imported from ‘NFSMixedA’ at NFSMixed.hs:3:1-16 - (and originally defined at NFSMixedA.hs:5:18-20) - or ‘NFSMixedA.foo’, - imported from ‘NFSMixedA’ at NFSMixed.hs:3:1-16 - (and originally defined at NFSMixedA.hs:8:1-3) +NFSMixed.hs:7:14: error: [GHC-99339] + • Ambiguous record update with field ‘foo’ + This field appears in both datatypes ‘Foo’ and ‘Bar’ + • In the expression: x {foo = 0} + In the expression: \ x -> x {foo = 0} + In an equation for ‘test’: test = \ x -> x {foo = 0} diff --git a/testsuite/tests/overloadedrecflds/should_fail/NoFieldSelectorsFail.stderr b/testsuite/tests/overloadedrecflds/should_fail/NoFieldSelectorsFail.stderr index 6810d549ff..301b6bc4b8 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/NoFieldSelectorsFail.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/NoFieldSelectorsFail.stderr @@ -9,32 +9,35 @@ NoFieldSelectorsFail.hs:9:14: error: imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 (and originally defined at NoFieldSelectorsFailA.hs:6:18-20) -NoFieldSelectorsFail.hs:12:15: error: - Ambiguous occurrence ‘foo’ - It could refer to - either the field ‘foo’ of record ‘Foo’, - imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 - (and originally defined at NoFieldSelectorsFailA.hs:5:18-20) - or the field ‘foo’ of record ‘Bar’, - imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 - (and originally defined at NoFieldSelectorsFailA.hs:6:18-20) +NoFieldSelectorsFail.hs:12:15: error: [GHC-56428] + Ambiguous record field ‘foo’. + It could refer to any of the following: + • record field ‘foo’ of ‘Foo’, + imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 + (and originally defined at NoFieldSelectorsFailA.hs:5:18-20) + • record field ‘foo’ of ‘Bar’, + imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 + (and originally defined at NoFieldSelectorsFailA.hs:6:18-20) + Suggested fix: Perhaps you intended to use DisambiguateRecordFields -NoFieldSelectorsFail.hs:14:15: error: - Ambiguous occurrence ‘foo’ - It could refer to - either the field ‘foo’ of record ‘Foo’, - imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 - (and originally defined at NoFieldSelectorsFailA.hs:5:18-20) - or the field ‘foo’ of record ‘Bar’, - imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 - (and originally defined at NoFieldSelectorsFailA.hs:6:18-20) +NoFieldSelectorsFail.hs:14:15: error: [GHC-56428] + Ambiguous record field ‘foo’. + It could refer to any of the following: + • record field ‘foo’ of ‘Foo’, + imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 + (and originally defined at NoFieldSelectorsFailA.hs:5:18-20) + • record field ‘foo’ of ‘Bar’, + imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 + (and originally defined at NoFieldSelectorsFailA.hs:6:18-20) + Suggested fix: Perhaps you intended to use DisambiguateRecordFields -NoFieldSelectorsFail.hs:16:15: error: - Ambiguous occurrence ‘bar’ - It could refer to - either the field ‘bar’ of record ‘Foo’, - imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 - (and originally defined at NoFieldSelectorsFailA.hs:5:30-32) - or ‘NoFieldSelectorsFailA.bar’, - imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 - (and originally defined at NoFieldSelectorsFailA.hs:8:1-3) +NoFieldSelectorsFail.hs:16:15: error: [GHC-56428] + Ambiguous record field ‘bar’. + It could refer to any of the following: + • record field ‘bar’ of ‘Foo’, + imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 + (and originally defined at NoFieldSelectorsFailA.hs:5:30-32) + • variable ‘bar’, + imported from ‘NoFieldSelectorsFailA’ at NoFieldSelectorsFail.hs:4:1-28 + (and originally defined at NoFieldSelectorsFailA.hs:8:1-3) + Suggested fix: Perhaps you intended to use DisambiguateRecordFields diff --git a/testsuite/tests/overloadedrecflds/should_fail/NoParent.stderr b/testsuite/tests/overloadedrecflds/should_fail/NoParent.stderr index b75b8c1df5..a18161d2e9 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/NoParent.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/NoParent.stderr @@ -2,5 +2,5 @@ NoParent.hs:2:18: error: [GHC-88993] • The type constructor ‘A’ is not the parent of the record selector ‘x’. Record selectors can only be exported with their parent type constructor. - Parents: C, B + Parents: B, C • In the export: A(x) diff --git a/testsuite/tests/overloadedrecflds/should_fail/T11103.stderr b/testsuite/tests/overloadedrecflds/should_fail/T11103.stderr deleted file mode 100644 index 076d067d36..0000000000 --- a/testsuite/tests/overloadedrecflds/should_fail/T11103.stderr +++ /dev/null @@ -1,6 +0,0 @@ - -T11103.hs:13:2: error: - Ambiguous occurrence ‘Main.foo’ - It could refer to - either the field ‘foo’ of record ‘S’, defined at T11103.hs:11:16 - or the field ‘foo’ of record ‘R’, defined at T11103.hs:10:16 diff --git a/testsuite/tests/overloadedrecflds/should_fail/T11167_ambiguous_fixity.stderr b/testsuite/tests/overloadedrecflds/should_fail/T11167_ambiguous_fixity.stderr index 709ee2312d..277a5bd0ac 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/T11167_ambiguous_fixity.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/T11167_ambiguous_fixity.stderr @@ -5,12 +5,12 @@ T11167_ambiguous_fixity.hs:6:16: error: Ambiguous occurrence ‘foo’ It could refer to - either the field ‘foo’ of record ‘C’, - imported from ‘T11167_ambiguous_fixity_A’ at T11167_ambiguous_fixity.hs:3:1-32 - (and originally defined at T11167_ambiguous_fixity_A.hs:4:16-18) - or the field ‘foo’ of record ‘A’, + either the field ‘foo’ of record ‘A’, imported from ‘T11167_ambiguous_fixity_A’ at T11167_ambiguous_fixity.hs:3:1-32 (and originally defined at T11167_ambiguous_fixity_A.hs:3:16-18) + or the field ‘foo’ of record ‘C’, + imported from ‘T11167_ambiguous_fixity_A’ at T11167_ambiguous_fixity.hs:3:1-32 + (and originally defined at T11167_ambiguous_fixity_A.hs:4:16-18) or the field ‘foo’ of record ‘B’, imported from ‘T11167_ambiguous_fixity_B’ at T11167_ambiguous_fixity.hs:4:1-32 (and originally defined at T11167_ambiguous_fixity_B.hs:2:16-18) diff --git a/testsuite/tests/overloadedrecflds/should_fail/T13132_duplicaterecflds.stderr b/testsuite/tests/overloadedrecflds/should_fail/T13132_duplicaterecflds.stderr index a2a4428b0b..462b00416c 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/T13132_duplicaterecflds.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/T13132_duplicaterecflds.stderr @@ -2,10 +2,10 @@ T13132_duplicaterecflds.hs:7:16: error: Ambiguous occurrence ‘runContT’ It could refer to - either the field ‘runContT’ of record ‘ContT2’, - defined at T13132_duplicaterecflds.hs:5:33 - or the field ‘runContT’ of record ‘ContT’, + either the field ‘runContT’ of record ‘ContT’, defined at T13132_duplicaterecflds.hs:4:31 + or the field ‘runContT’ of record ‘ContT2’, + defined at T13132_duplicaterecflds.hs:5:33 T13132_duplicaterecflds.hs:9:11: error: The operator ‘runContT’ [infixl 9] of a section @@ -16,7 +16,7 @@ T13132_duplicaterecflds.hs:9:11: error: T13132_duplicaterecflds.hs:9:12: error: Ambiguous occurrence ‘runContT’ It could refer to - either the field ‘runContT’ of record ‘ContT2’, - defined at T13132_duplicaterecflds.hs:5:33 - or the field ‘runContT’ of record ‘ContT’, + either the field ‘runContT’ of record ‘ContT’, defined at T13132_duplicaterecflds.hs:4:31 + or the field ‘runContT’ of record ‘ContT2’, + defined at T13132_duplicaterecflds.hs:5:33 diff --git a/testsuite/tests/overloadedrecflds/should_fail/T14953.stderr b/testsuite/tests/overloadedrecflds/should_fail/T14953.stderr index 144e306483..19003fc78c 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/T14953.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/T14953.stderr @@ -4,10 +4,10 @@ T14953.hs:2:33: error: [GHC-69158] Conflicting exports for ‘unR’: - ‘module T14953_A’ exports ‘unR’ + ‘module T14953_A’ exports ‘T14953_A.unR’ imported from ‘T14953_A’ at T14953.hs:3:1-15 (and originally defined at T14953_A.hs:3:13-15) - ‘module T14953_B’ exports ‘unR’ + ‘module T14953_B’ exports ‘T14953_B.unR’ imported from ‘T14953_B’ at T14953.hs:4:1-15 (and originally defined at T14953_B.hs:3:13-15) diff --git a/testsuite/tests/overloadedrecflds/should_fail/T16745.stderr b/testsuite/tests/overloadedrecflds/should_fail/T16745.stderr index 61a9567788..5969a540e0 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/T16745.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/T16745.stderr @@ -6,9 +6,9 @@ T16745A.hs:8:9: error: Ambiguous occurrence ‘field’ It could refer to - either the field ‘field’ of record ‘T16745B.R’, - imported from ‘T16745B’ at T16745A.hs:3:24-28 - (and originally defined at T16745B.hs:11:14-18) - or ‘T16745B.field’, + either ‘T16745B.field’, imported from ‘T16745B’ at T16745A.hs:3:24-28 (and originally defined in ‘T16745C’ at T16745C.hs:2:1-5) + or the field ‘field’ of record ‘T16745B.R’, + imported from ‘T16745B’ at T16745A.hs:3:24-28 + (and originally defined at T16745B.hs:11:14-18) diff --git a/testsuite/tests/overloadedrecflds/should_fail/T17420.stderr b/testsuite/tests/overloadedrecflds/should_fail/T17420.stderr index 5089f19ce2..e1db5fa195 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/T17420.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/T17420.stderr @@ -4,9 +4,9 @@ T17420.hs:6:17: error: Ambiguous occurrence ‘name’ It could refer to - either the field ‘name’ of record ‘Human’, - imported from ‘T17420A’ at T17420.hs:4:1-14 - (and originally defined at T17420A.hs:5:22-25) - or the field ‘name’ of record ‘Dog’, + either the field ‘name’ of record ‘Dog’, imported from ‘T17420A’ at T17420.hs:4:1-14 (and originally defined at T17420A.hs:4:18-21) + or the field ‘name’ of record ‘Human’, + imported from ‘T17420A’ at T17420.hs:4:1-14 + (and originally defined at T17420A.hs:5:22-25) diff --git a/testsuite/tests/overloadedrecflds/should_fail/T18999_NoDisambiguateRecordFields.stderr b/testsuite/tests/overloadedrecflds/should_fail/T18999_NoDisambiguateRecordFields.stderr index d271efc7f8..f462dcb187 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/T18999_NoDisambiguateRecordFields.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/T18999_NoDisambiguateRecordFields.stderr @@ -8,11 +8,12 @@ T18999_NoDisambiguateRecordFields.hs:6:13: error: or the field ‘not’ of record ‘Foo’, defined at T18999_NoDisambiguateRecordFields.hs:4:18 -T18999_NoDisambiguateRecordFields.hs:8:11: error: - Ambiguous occurrence ‘not’ - It could refer to - either ‘Prelude.not’, - imported from ‘Prelude’ at T18999_NoDisambiguateRecordFields.hs:2:8-40 - (and originally defined in ‘GHC.Classes’) - or the field ‘not’ of record ‘Foo’, - defined at T18999_NoDisambiguateRecordFields.hs:4:18 +T18999_NoDisambiguateRecordFields.hs:8:11: error: [GHC-56428] + Ambiguous record field ‘not’. + It could refer to any of the following: + • record field ‘not’ of ‘Foo’, + defined at T18999_NoDisambiguateRecordFields.hs:4:18 + • variable ‘not’, + imported from ‘Prelude’ at T18999_NoDisambiguateRecordFields.hs:2:8-40 + (and originally defined in ‘GHC.Classes’) + Suggested fix: Perhaps you intended to use DisambiguateRecordFields diff --git a/testsuite/tests/overloadedrecflds/should_fail/T19287.hs b/testsuite/tests/overloadedrecflds/should_fail/T19287.hs index f3dedbe4bc..793d0e61e7 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/T19287.hs +++ b/testsuite/tests/overloadedrecflds/should_fail/T19287.hs @@ -1,7 +1,7 @@ {-# LANGUAGE DuplicateRecordFields #-} module Main where -data R a b = R { x :: a , x :: b} +data R a b = R { x :: a , x :: b } unsafeCoerce :: a -> b unsafeCoerce i = case (R i i){x = i} of diff --git a/testsuite/tests/overloadedrecflds/should_fail/T19287.stderr b/testsuite/tests/overloadedrecflds/should_fail/T19287.stderr index c0c5a0caa9..03a88e1f78 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/T19287.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/T19287.stderr @@ -1,5 +1,3 @@ -T19287.hs:4:27: error: - Multiple declarations of ‘x’ - Declared at: T19287.hs:4:18 - T19287.hs:4:27 +T19287.hs:4:27: error: [GHC-85524] + Duplicate field name ‘x’ in record declaration diff --git a/testsuite/tests/overloadedrecflds/should_fail/T21946.hs b/testsuite/tests/overloadedrecflds/should_fail/T21946.hs new file mode 100644 index 0000000000..fdd0f09749 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T21946.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE DuplicateRecordFields, PatternSynonyms #-} + +module T21946 where + +pattern R1 :: Int -> Int +pattern R1 { fld } = fld + +pattern R2 :: Bool -> Bool +pattern R2 { fld } = fld + +f r = (r :: Int) { fld = undefined } diff --git a/testsuite/tests/overloadedrecflds/should_fail/T21946.stderr b/testsuite/tests/overloadedrecflds/should_fail/T21946.stderr new file mode 100644 index 0000000000..61254e3e3d --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T21946.stderr @@ -0,0 +1,8 @@ + +T21946.hs:11:7: error: [GHC-33238] + • No data constructor of type constructor ‘Int’ + has all of the fields: + ‘fld’ + NB: type-directed disambiguation is not supported for pattern synonym record fields. + • In the expression: (r :: Int) {fld = undefined} + In an equation for ‘f’: f r = (r :: Int) {fld = undefined} diff --git a/testsuite/tests/overloadedrecflds/should_fail/T21959.hs b/testsuite/tests/overloadedrecflds/should_fail/T21959.hs new file mode 100644 index 0000000000..b10c2a1355 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T21959.hs @@ -0,0 +1,6 @@ +module T21959 where + +data R = R { fld :: Int } + +f :: R -> R +f r = r { T21959.fld = 1, fld = 2 } diff --git a/testsuite/tests/overloadedrecflds/should_fail/T21959.stderr b/testsuite/tests/overloadedrecflds/should_fail/T21959.stderr new file mode 100644 index 0000000000..49d00962a0 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T21959.stderr @@ -0,0 +1,3 @@ + +T21959.hs:6:7: error: [GHC-85524] + Duplicate field name ‘fld’ in record update diff --git a/testsuite/tests/overloadedrecflds/should_fail/T23010_fail.hs b/testsuite/tests/overloadedrecflds/should_fail/T23010_fail.hs new file mode 100644 index 0000000000..83421fd2de --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T23010_fail.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE DuplicateRecordFields #-} + +module T23010_fail where + +import T23010_fail_aux ( X ) +data A = MkA { fld :: A, other :: X } +data B = MkB { fld :: B } diff --git a/testsuite/tests/overloadedrecflds/should_fail/T23010_fail.hs-boot b/testsuite/tests/overloadedrecflds/should_fail/T23010_fail.hs-boot new file mode 100644 index 0000000000..699c994b1f --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T23010_fail.hs-boot @@ -0,0 +1,7 @@ +{-# LANGUAGE DuplicateRecordFields #-} + +module T23010_fail where + +data A + +fld :: A -> A diff --git a/testsuite/tests/overloadedrecflds/should_fail/T23010_fail.stderr b/testsuite/tests/overloadedrecflds/should_fail/T23010_fail.stderr new file mode 100644 index 0000000000..61e93b95bb --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T23010_fail.stderr @@ -0,0 +1,8 @@ + +T23010_fail.hs-boot:7:1: error: + Ambiguous occurrence ‘T23010_fail.fld’ + It could refer to + either the field ‘fld’ of record ‘A’, + defined at T23010_fail.hs:6:16 + or the field ‘fld’ of record ‘B’, + defined at T23010_fail.hs:7:16 diff --git a/testsuite/tests/overloadedrecflds/should_fail/T23010_fail_aux.hs b/testsuite/tests/overloadedrecflds/should_fail/T23010_fail_aux.hs new file mode 100644 index 0000000000..d1e5cfefb7 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T23010_fail_aux.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE DuplicateRecordFields #-} + +module T23010_fail_aux where + +import {-# SOURCE #-} T23010_fail ( fld ) + +data X +bar = fld diff --git a/testsuite/tests/overloadedrecflds/should_fail/T23063.hs b/testsuite/tests/overloadedrecflds/should_fail/T23063.hs new file mode 100644 index 0000000000..c2b57bdafd --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T23063.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE DuplicateRecordFields #-} +module T23063 where +import qualified T23063_aux as A + +baz = _ :: A.S -> Int diff --git a/testsuite/tests/overloadedrecflds/should_fail/T23063.stderr b/testsuite/tests/overloadedrecflds/should_fail/T23063.stderr new file mode 100644 index 0000000000..89cfdc7a2d --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T23063.stderr @@ -0,0 +1,12 @@ + +T23063.hs:5:7: error: [GHC-88464] + • Found hole: _ :: A.S -> Int + • In the expression: _ :: A.S -> Int + In an equation for ‘baz’: baz = _ :: A.S -> Int + • Relevant bindings include + baz :: A.S -> Int (bound at T23063.hs:5:1) + Valid hole fits include + baz :: A.S -> Int (defined at T23063.hs:5:1) + A.foo :: A.S -> Int + (imported qualified from ‘T23063_aux’ at T23063.hs:3:1-32 + (and originally defined at T23063_aux.hs:4:16-18)) diff --git a/testsuite/tests/overloadedrecflds/should_fail/T23063_aux.hs b/testsuite/tests/overloadedrecflds/should_fail/T23063_aux.hs new file mode 100644 index 0000000000..d5552ebd6d --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T23063_aux.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE DuplicateRecordFields #-} +module T23063_aux where + +data S = MkS { foo :: Int } diff --git a/testsuite/tests/overloadedrecflds/should_fail/all.T b/testsuite/tests/overloadedrecflds/should_fail/all.T index 28ec4f7b7e..2da5c8da2f 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/all.T +++ b/testsuite/tests/overloadedrecflds/should_fail/all.T @@ -1,4 +1,6 @@ -test('overloadedrecfldsfail01', normal, compile_fail, ['']) +test('overloadedrecfldsfail01a', normal, compile_fail, ['']) +test('overloadedrecfldsfail01b', normal, compile_fail, ['']) +test('overloadedrecfldsfail01c', normal, compile_fail, ['']) test('overloadedrecfldsfail02', normal, compile_fail, ['']) test('overloadedrecfldsfail03', normal, compile_fail, ['']) test('overloadedrecfldsfail04', [extra_files(['OverloadedRecFldsFail04_A.hs'])], multimod_compile_fail, @@ -20,7 +22,6 @@ test('overloadedrecfldsfail14', normal, compile_fail, ['']) test('overloadedlabelsfail01', normal, compile_fail, ['']) test('overloadedlabelsfail02', normal, compile_fail, ['']) test('overloadedlabelsfail03', normal, compile_fail, ['']) -test('T11103', req_th, compile_fail, ['']) test('T11167_ambiguous_fixity', [], multimod_compile_fail, ['T11167_ambiguous_fixity', '']) test('T13132_duplicaterecflds', normal, compile_fail, ['']) @@ -37,7 +38,7 @@ test('T17420', [extra_files(['T17420A.hs'])], multimod_compile_fail, test('T17469', [extra_files(['T17469A.hs'])], multimod_compile_fail, ['T17469', '']) test('T17965', normal, compile_fail, ['']) -test('DRFHoleFits', extra_files(['DRFHoleFits_A.hs']), multimod_compile_fail, ['DRFHoleFits', '']) +test('DRFHoleFits', extra_files(['DRFHoleFits_A.hs']), multimod_compile_fail, ['DRFHoleFits', '-v0']) test('DRFPartialFields', normal, compile_fail, ['']) test('T16745', extra_files(['T16745C.hs', 'T16745B.hs']), multimod_compile_fail, ['T16745A', '']) test('FieldSelectors', normal, compile_fail, ['']) @@ -52,3 +53,9 @@ test('T18999_NoDisambiguateRecordFields', normal, compile_fail, ['']) test('DRFUnused', normal, compile_fail, ['']) test('T19287', normal, compile_fail, ['']) test('overloadedrecfldswasrunnowfail06', normal, compile_fail, ['']) +test('T21946', normal, compile_fail, ['']) +test('T21959', normal, compile_fail, ['']) +test('T23010_fail', [extra_files(['T23010_fail.hs-boot', 'T23010_fail_aux.hs'])] + , multimod_compile_fail + , ['T23010_fail T23010_fail_aux', '-v0']) +test('T23063', extra_files(['T23063_aux.hs']), multimod_compile_fail, ['T23063', '-v0'])
\ No newline at end of file diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01.stderr index 66089a586e..a2cdc2bfd5 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01.stderr @@ -1,22 +1,4 @@ -overloadedrecfldsfail01.hs:11:10: error: [GHC-99339] - • Record update is ambiguous, and requires a type signature - • In the expression: r {x = 3} - In an equation for ‘upd1’: upd1 r = r {x = 3} - -overloadedrecfldsfail01.hs:14:10: error: [GHC-33238] - • No type has all these fields: ‘x’, ‘y’, ‘z’ - • In the expression: r {x = 3, y = True, z = False} - In an equation for ‘upd2’: upd2 r = r {x = 3, y = True, z = False} - -overloadedrecfldsfail01.hs:17:10: error: [GHC-54721] - • ‘x’ is not a (visible) field of type ‘U’ - • In the expression: r {w = True, x = 3, y = True} :: U - In an equation for ‘upd3’: - upd3 r = r {w = True, x = 3, y = True} :: U - -overloadedrecfldsfail01.hs:17:10: error: [GHC-54721] - • ‘w’ is not a (visible) field of type ‘U’ - • In the expression: r {w = True, x = 3, y = True} :: U - In an equation for ‘upd3’: - upd3 r = r {w = True, x = 3, y = True} :: U +overloadedrecfldsfail01.hs:14:10: error: + Invalid record update. + No constructor in scope has all of the following fields: ‘z’, ‘y’ diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01a.hs b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01a.hs new file mode 100644 index 0000000000..be7284267e --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01a.hs @@ -0,0 +1,13 @@ +-- Test ambiguous updates are rejected with appropriate error messages + +{-# LANGUAGE DuplicateRecordFields #-} + +module OverloadedRecFieldsFail1a where + +data R = MkR { w :: Bool, x :: Int, y :: Bool } +data S = MkS { w :: Bool, x :: Int, y :: Bool } +data T = MkT { x :: Int, z :: Bool } +data U = MkU { y :: Bool } + +-- Straightforward ambiguous update +upd1 r = r { x = 3 } diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01a.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01a.stderr new file mode 100644 index 0000000000..7ac58b0e43 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01a.stderr @@ -0,0 +1,6 @@ + +overloadedrecfldsfail01a.hs:13:10: error: [GHC-99339] + • Ambiguous record update with field ‘x’ + This field appears in all of the datatypes ‘R’, ‘S’ and ‘T’ + • In the expression: r {x = 3} + In an equation for ‘upd1’: upd1 r = r {x = 3} diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01b.hs b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01b.hs new file mode 100644 index 0000000000..d3e14f4056 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01b.hs @@ -0,0 +1,13 @@ +-- Test ambiguous updates are rejected with appropriate error messages + +{-# LANGUAGE DuplicateRecordFields #-} + +module OverloadedRecFieldsFail1b where + +data R = MkR { w :: Bool, x :: Int, y :: Bool } +data S = MkS { w :: Bool, x :: Int, y :: Bool } +data T = MkT { x :: Int, z :: Bool } +data U = MkU { y :: Bool } + +-- No type has all these fields +upd2 r = r { x = 3, y = True, z = False } diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01b.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01b.stderr new file mode 100644 index 0000000000..2a55c5d92b --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01b.stderr @@ -0,0 +1,4 @@ + +overloadedrecfldsfail01b.hs:13:10: error: [GHC-14392] + Invalid record update. + No constructor in scope has all of the following fields: ‘z’, ‘y’ diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01.hs b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01c.hs index 8ce9be7d47..cfa079e7b9 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01.hs +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01c.hs @@ -2,18 +2,12 @@ {-# LANGUAGE DuplicateRecordFields #-} +module OverloadedRecFieldsFail1c where + data R = MkR { w :: Bool, x :: Int, y :: Bool } data S = MkS { w :: Bool, x :: Int, y :: Bool } data T = MkT { x :: Int, z :: Bool } data U = MkU { y :: Bool } --- Straightforward ambiguous update -upd1 r = r { x = 3 } - --- No type has all these fields -upd2 r = r { x = 3, y = True, z = False } - -- User-specified type does not have these fields upd3 r = r { w = True, x = 3, y = True } :: U - -main = return () diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01c.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01c.stderr new file mode 100644 index 0000000000..146e364e99 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01c.stderr @@ -0,0 +1,8 @@ + +overloadedrecfldsfail01c.hs:13:10: error: [GHC-33238] + • No data constructor of type constructor ‘U’ + has all of the fields: + ‘w’, ‘x’, ‘y’ + • In the expression: r {w = True, x = 3, y = True} :: U + In an equation for ‘upd3’: + upd3 r = r {w = True, x = 3, y = True} :: U diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail02.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail02.stderr index f6d03433fb..6a27569776 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail02.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail02.stderr @@ -2,7 +2,7 @@ overloadedrecfldsfail02.hs:8:18: error: Ambiguous occurrence ‘x’ It could refer to - either the field ‘x’ of record ‘S’, - defined at overloadedrecfldsfail02.hs:6:16 - or the field ‘x’ of record ‘R’, + either the field ‘x’ of record ‘R’, defined at overloadedrecfldsfail02.hs:5:16 + or the field ‘x’ of record ‘S’, + defined at overloadedrecfldsfail02.hs:6:16 diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail05.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail05.stderr index 3e2e0572f1..bff9bd544f 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail05.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail05.stderr @@ -1,3 +1,3 @@ overloadedrecfldsfail05.hs:7:16: error: [-Wunused-top-binds (in -Wextra, -Wunused-binds), Werror=unused-top-binds] - Defined but not used: ‘foo’ + Defined but not used: record field of MkT ‘foo’ diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail06.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail06.stderr index 7567a038b4..3f0b17106a 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail06.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail06.stderr @@ -4,14 +4,14 @@ OverloadedRecFldsFail06_A.hs:9:15: warning: [-Wunused-top-binds (in -Wextra, -Wu Defined but not used: data constructor ‘MkUnused’ OverloadedRecFldsFail06_A.hs:9:42: warning: [-Wunused-top-binds (in -Wextra, -Wunused-binds)] - Defined but not used: ‘unused2’ + Defined but not used: record field of MkUnused ‘unused2’ OverloadedRecFldsFail06_A.hs:9:59: warning: [-Wunused-top-binds (in -Wextra, -Wunused-binds)] - Defined but not used: ‘used_locally’ + Defined but not used: record field of MkUnused ‘used_locally’ [2 of 3] Compiling Main ( overloadedrecfldsfail06.hs, overloadedrecfldsfail06.o ) overloadedrecfldsfail06.hs:7:1: error: [-Wunused-imports (in -Wextra), Werror=unused-imports] - The import of ‘Unused(unused), V(x), U(y), MkV, Unused’ + The import of ‘MkV, Unused, Unused(unused), V(x), U(y)’ from module ‘OverloadedRecFldsFail06_A’ is redundant overloadedrecfldsfail06.hs:8:1: error: [-Wunused-imports (in -Wextra), Werror=unused-imports] @@ -24,13 +24,15 @@ overloadedrecfldsfail06.hs:9:1: error: [-Wunused-imports (in -Wextra), Werror=un from module ‘OverloadedRecFldsFail06_A’ is redundant overloadedrecfldsfail06.hs:10:1: error: [-Wunused-imports (in -Wextra), Werror=unused-imports] - The qualified import of ‘U(x), U’ + The qualified import of ‘U, U(x)’ from module ‘OverloadedRecFldsFail06_A’ is redundant overloadedrecfldsfail06.hs:15:22: error: [GHC-02256] [-Wambiguous-fields (in -Wdefault), Werror=ambiguous-fields] - The record update u {x = True} with type U is ambiguous. - This will not be supported by -XDuplicateRecordFields in future releases of GHC. + Ambiguous record update with parent type constructor ‘U’. + This type-directed disambiguation mechanism will not be supported by -XDuplicateRecordFields in future releases of GHC. + Consider disambiguating using module qualification instead. overloadedrecfldsfail06.hs:18:28: error: [GHC-02256] [-Wambiguous-fields (in -Wdefault), Werror=ambiguous-fields] - The record update v {P.x = 3} with type V is ambiguous. - This will not be supported by -XDuplicateRecordFields in future releases of GHC. + Ambiguous record update with parent type constructor ‘V’. + This type-directed disambiguation mechanism will not be supported by -XDuplicateRecordFields in future releases of GHC. + Consider disambiguating using module qualification instead. diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail08.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail08.stderr index d364f079d8..24085ea57c 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail08.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail08.stderr @@ -1,5 +1,4 @@ overloadedrecfldsfail08.hs:9:9: error: [GHC-14392] - • No constructor has all these fields: ‘x’, ‘y’ - • In the expression: e {x = 3, y = True} - In an equation for ‘foo’: foo e = e {x = 3, y = True} + Invalid record update. + No constructor in scope has all of the following fields: ‘x’, ‘y’ diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.hs b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.hs index ccb25d3387..508d5a69c1 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.hs +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.hs @@ -1,8 +1,8 @@ --- Modules A and B both declare F(foo) --- Module C declares F($sel:foo:MkFChar) but exports A.F(foo) as well --- Thus we can't export F(..) even with DuplicateRecordFields enabled +-- Module A exports $fld:MkFInt:foo +-- Module B exports $fld:MkFBool:foo +-- Module C exports $fld:MkFChar:foo and re-exports $fld:MkFInt:foo +-- Thus we can't export F(..) without -XDuplicateRecordFields -{-# LANGUAGE DuplicateRecordFields #-} module Main (main, F(..)) where import OverloadedRecFldsFail10_B diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.stderr index 8b113e19ee..ad62403ddc 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.stderr @@ -3,12 +3,28 @@ [3 of 5] Compiling OverloadedRecFldsFail10_C ( OverloadedRecFldsFail10_C.hs, OverloadedRecFldsFail10_C.o ) [4 of 5] Compiling Main ( overloadedrecfldsfail10.hs, overloadedrecfldsfail10.o ) -overloadedrecfldsfail10.hs:6:20: error: [GHC-69158] - Conflicting exports for ‘foo’: - ‘F(..)’ exports ‘OverloadedRecFldsFail10_B.foo’ +overloadedrecfldsfail10.hs:6:20: error: [GHC-97219] + Duplicate record field ‘foo’ in export list: + ‘F(..)’ exports the field ‘foo’ + belonging to the constructor ‘MkFChar’ + imported from ‘OverloadedRecFldsFail10_C’ at overloadedrecfldsfail10.hs:9:1-32 + (and originally defined at OverloadedRecFldsFail10_C.hs:6:34-36) + ‘F(..)’ exports the field ‘foo’ + belonging to the constructor ‘MkFInt’ + imported from ‘OverloadedRecFldsFail10_C’ at overloadedrecfldsfail10.hs:9:1-32 + (and originally defined in ‘OverloadedRecFldsFail10_A’ + at OverloadedRecFldsFail10_A.hs:5:32-34) + Suggested fix: Perhaps you intended to use DuplicateRecordFields + +overloadedrecfldsfail10.hs:6:20: error: [GHC-97219] + Duplicate record field ‘foo’ in export list: + ‘F(..)’ exports the field ‘foo’ + belonging to the constructor ‘MkFBool’ imported from ‘OverloadedRecFldsFail10_B’ at overloadedrecfldsfail10.hs:8:1-32 (and originally defined at OverloadedRecFldsFail10_B.hs:6:34-36) - ‘F(..)’ exports ‘OverloadedRecFldsFail10_C.foo’ + ‘F(..)’ exports the field ‘foo’ + belonging to the constructor ‘MkFInt’ imported from ‘OverloadedRecFldsFail10_C’ at overloadedrecfldsfail10.hs:9:1-32 (and originally defined in ‘OverloadedRecFldsFail10_A’ at OverloadedRecFldsFail10_A.hs:5:32-34) + Suggested fix: Perhaps you intended to use DuplicateRecordFields diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail11.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail11.stderr index a146a0e9c6..54472f4293 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail11.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail11.stderr @@ -4,9 +4,9 @@ overloadedrecfldsfail11.hs:5:15: error: Ambiguous occurrence ‘foo’ It could refer to - either the field ‘foo’ of record ‘T’, - imported from ‘OverloadedRecFldsFail11_A’ at overloadedrecfldsfail11.hs:3:1-32 - (and originally defined at OverloadedRecFldsFail11_A.hs:6:16-18) - or the field ‘foo’ of record ‘S’, + either the field ‘foo’ of record ‘S’, imported from ‘OverloadedRecFldsFail11_A’ at overloadedrecfldsfail11.hs:3:1-32 (and originally defined at OverloadedRecFldsFail11_A.hs:5:16-18) + or the field ‘foo’ of record ‘T’, + imported from ‘OverloadedRecFldsFail11_A’ at overloadedrecfldsfail11.hs:3:1-32 + (and originally defined at OverloadedRecFldsFail11_A.hs:6:16-18) diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail13.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail13.stderr index 20c9e2dd97..4fb285b327 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail13.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail13.stderr @@ -2,31 +2,31 @@ overloadedrecfldsfail13.hs:10:5: error: Ambiguous occurrence ‘x’ It could refer to - either the field ‘x’ of record ‘T’, - defined at overloadedrecfldsfail13.hs:7:16 - or the field ‘x’ of record ‘S’, + either the field ‘x’ of record ‘S’, defined at overloadedrecfldsfail13.hs:6:16 + or the field ‘x’ of record ‘T’, + defined at overloadedrecfldsfail13.hs:7:16 overloadedrecfldsfail13.hs:12:5: error: Ambiguous occurrence ‘x’ It could refer to - either the field ‘x’ of record ‘T’, - defined at overloadedrecfldsfail13.hs:7:16 - or the field ‘x’ of record ‘S’, + either the field ‘x’ of record ‘S’, defined at overloadedrecfldsfail13.hs:6:16 + or the field ‘x’ of record ‘T’, + defined at overloadedrecfldsfail13.hs:7:16 overloadedrecfldsfail13.hs:15:5: error: Ambiguous occurrence ‘x’ It could refer to - either the field ‘x’ of record ‘T’, - defined at overloadedrecfldsfail13.hs:7:16 - or the field ‘x’ of record ‘S’, + either the field ‘x’ of record ‘S’, defined at overloadedrecfldsfail13.hs:6:16 + or the field ‘x’ of record ‘T’, + defined at overloadedrecfldsfail13.hs:7:16 overloadedrecfldsfail13.hs:18:5: error: Ambiguous occurrence ‘x’ It could refer to - either the field ‘x’ of record ‘T’, - defined at overloadedrecfldsfail13.hs:7:16 - or the field ‘x’ of record ‘S’, + either the field ‘x’ of record ‘S’, defined at overloadedrecfldsfail13.hs:6:16 + or the field ‘x’ of record ‘T’, + defined at overloadedrecfldsfail13.hs:7:16 diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail14.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail14.stderr index 7b0d276a96..400a633946 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail14.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail14.stderr @@ -1,5 +1,3 @@ -overloadedrecfldsfail14.hs:12:7: error: [GHC-33238] - • No type has all these fields: ‘x’, ‘y’ - • In the expression: r {x = 3, y = False} - In an equation for ‘f’: f r = r {x = 3, y = False} +overloadedrecfldsfail14.hs:12:18: error: [GHC-22385] + Not in scope: record field ‘y’ diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldswasrunnowfail06.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldswasrunnowfail06.stderr index 789d87a6a3..c5f1e431c9 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldswasrunnowfail06.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldswasrunnowfail06.stderr @@ -2,39 +2,39 @@ overloadedrecfldswasrunnowfail06.hs:11:11: error: Ambiguous occurrence ‘x’ It could refer to - either the field ‘x’ of record ‘U’, - defined at overloadedrecfldswasrunnowfail06.hs:8:18 + either the field ‘x’ of record ‘S’, + defined at overloadedrecfldswasrunnowfail06.hs:6:16 or the field ‘x’ of record ‘T’, defined at overloadedrecfldswasrunnowfail06.hs:7:16 - or the field ‘x’ of record ‘S’, - defined at overloadedrecfldswasrunnowfail06.hs:6:16 + or the field ‘x’ of record ‘U’, + defined at overloadedrecfldswasrunnowfail06.hs:8:18 overloadedrecfldswasrunnowfail06.hs:13:11: error: Ambiguous occurrence ‘x’ It could refer to - either the field ‘x’ of record ‘U’, - defined at overloadedrecfldswasrunnowfail06.hs:8:18 + either the field ‘x’ of record ‘S’, + defined at overloadedrecfldswasrunnowfail06.hs:6:16 or the field ‘x’ of record ‘T’, defined at overloadedrecfldswasrunnowfail06.hs:7:16 - or the field ‘x’ of record ‘S’, - defined at overloadedrecfldswasrunnowfail06.hs:6:16 + or the field ‘x’ of record ‘U’, + defined at overloadedrecfldswasrunnowfail06.hs:8:18 overloadedrecfldswasrunnowfail06.hs:15:13: error: Ambiguous occurrence ‘x’ It could refer to - either the field ‘x’ of record ‘U’, - defined at overloadedrecfldswasrunnowfail06.hs:8:18 + either the field ‘x’ of record ‘S’, + defined at overloadedrecfldswasrunnowfail06.hs:6:16 or the field ‘x’ of record ‘T’, defined at overloadedrecfldswasrunnowfail06.hs:7:16 - or the field ‘x’ of record ‘S’, - defined at overloadedrecfldswasrunnowfail06.hs:6:16 + or the field ‘x’ of record ‘U’, + defined at overloadedrecfldswasrunnowfail06.hs:8:18 overloadedrecfldswasrunnowfail06.hs:21:20: error: Ambiguous occurrence ‘x’ It could refer to - either the field ‘x’ of record ‘U’, - defined at overloadedrecfldswasrunnowfail06.hs:8:18 + either the field ‘x’ of record ‘S’, + defined at overloadedrecfldswasrunnowfail06.hs:6:16 or the field ‘x’ of record ‘T’, defined at overloadedrecfldswasrunnowfail06.hs:7:16 - or the field ‘x’ of record ‘S’, - defined at overloadedrecfldswasrunnowfail06.hs:6:16 + or the field ‘x’ of record ‘U’, + defined at overloadedrecfldswasrunnowfail06.hs:8:18 diff --git a/testsuite/tests/overloadedrecflds/should_run/T17551b.hs b/testsuite/tests/overloadedrecflds/should_run/T17551b.hs new file mode 100644 index 0000000000..c78da2b23c --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_run/T17551b.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE TemplateHaskell #-} + +module Main where + +data Foo = Foo { foo :: Int, biz :: Bool } +data Bar = Bar { foo :: Int } + +main :: IO () +main = print $ + $$( [|| \ ( Bar { foo } ) -> foo ||] ) ( Bar 3 ) + + case $$( [|| \ r -> r { foo = 2, biz = False } ||] ) ( Foo 1 False ) of + Foo { foo } -> foo + diff --git a/testsuite/tests/overloadedrecflds/should_run/T17551b.stdout b/testsuite/tests/overloadedrecflds/should_run/T17551b.stdout new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_run/T17551b.stdout @@ -0,0 +1 @@ +5 diff --git a/testsuite/tests/overloadedrecflds/should_run/all.T b/testsuite/tests/overloadedrecflds/should_run/all.T index ce4bbfd728..b3a08e7138 100644 --- a/testsuite/tests/overloadedrecflds/should_run/all.T +++ b/testsuite/tests/overloadedrecflds/should_run/all.T @@ -18,3 +18,4 @@ test('hasfieldrun02', normal, compile_and_run, ['']) test('T12243', normal, compile_and_run, ['']) test('T11228', normal, compile_and_run, ['']) test('T11671_run', normal, compile_and_run, ['']) +test('T17551b', [req_th], compile_and_run, ['']) diff --git a/testsuite/tests/parser/should_compile/T14189.stderr b/testsuite/tests/parser/should_compile/T14189.stderr index caede8b720..1bd38be52a 100644 --- a/testsuite/tests/parser/should_compile/T14189.stderr +++ b/testsuite/tests/parser/should_compile/T14189.stderr @@ -186,14 +186,14 @@ (L (SrcSpanAnn (EpAnnNotUsed) { T14189.hs:3:3-15 }) (IEThingWith - [(L - { T14189.hs:3:11 } - (FieldLabel - (FieldLabelString - {FastString: "f"}) - (NoDuplicateRecordFields) - (FieldSelectors) - {Name: T14189.f}))] + (EpAnn + (Anchor + { T14189.hs:3:3-8 } + (UnchangedAnchor)) + [(AddEpAnn AnnOpenP (EpaSpan { T14189.hs:3:10 })) + ,(AddEpAnn AnnCloseP (EpaSpan { T14189.hs:3:15 }))] + (EpaComments + [])) (L (SrcSpanAnn (EpAnnNotUsed) { T14189.hs:3:3-8 }) (IEName @@ -203,6 +203,21 @@ {Name: T14189.MyType}))) (NoIEWildcard) [(L + (SrcSpanAnn (EpAnn + (Anchor + { T14189.hs:3:11 } + (UnchangedAnchor)) + (AnnListItem + [(AddCommaAnn + (EpaSpan { T14189.hs:3:12 }))]) + (EpaComments + [])) { T14189.hs:3:11 }) + (IEName + (NoExtField) + (L + (SrcSpanAnn (EpAnnNotUsed) { T14189.hs:3:11 }) + {Name: T14189.f}))) + ,(L (SrcSpanAnn (EpAnnNotUsed) { T14189.hs:3:13-14 }) (IEName (NoExtField) @@ -211,17 +226,9 @@ {Name: T14189.NT})))])) [(AvailTC {Name: T14189.MyType} - [(NormalGreName - {Name: T14189.MyType}) - ,(NormalGreName - {Name: T14189.NT}) - ,(FieldGreName - (FieldLabel - (FieldLabelString - {FastString: "f"}) - (NoDuplicateRecordFields) - (FieldSelectors) - {Name: T14189.f}))])])]) + [{Name: T14189.MyType} + ,{Name: T14189.f} + ,{Name: T14189.NT}])])]) (Nothing))) diff --git a/testsuite/tests/patsyn/should_fail/mixed-pat-syn-record-sels.stderr b/testsuite/tests/patsyn/should_fail/mixed-pat-syn-record-sels.stderr index 934a55a87e..3c20c90285 100644 --- a/testsuite/tests/patsyn/should_fail/mixed-pat-syn-record-sels.stderr +++ b/testsuite/tests/patsyn/should_fail/mixed-pat-syn-record-sels.stderr @@ -1,5 +1,4 @@ mixed-pat-syn-record-sels.hs:9:9: error: [GHC-14392] - • No constructor has all these fields: ‘a’, ‘b’ - • In the expression: x {a = True, b = False} - In an equation for ‘foo’: foo x = x {a = True, b = False} + Invalid record update. + No constructor in scope has all of the following fields: ‘a’, ‘b’ diff --git a/testsuite/tests/patsyn/should_fail/records-mixing-fields.stderr b/testsuite/tests/patsyn/should_fail/records-mixing-fields.stderr index 77901b9eee..9829eef3c3 100644 --- a/testsuite/tests/patsyn/should_fail/records-mixing-fields.stderr +++ b/testsuite/tests/patsyn/should_fail/records-mixing-fields.stderr @@ -1,14 +1,5 @@ -records-mixing-fields.hs:10:14: error: [GHC-40887] - • Cannot use a mixture of pattern synonym and record selectors - Record selectors defined by ‘MyRec’: qux - Pattern synonym selectors defined by ‘HisRec’: f1 - • In the expression: a {f1 = 1, qux = "two"} - In an equation for ‘updater1’: updater1 a = a {f1 = 1, qux = "two"} - -records-mixing-fields.hs:12:14: error: [GHC-40887] - • Cannot use a mixture of pattern synonym and record selectors - Record selectors defined by ‘MyRec’: foo - Pattern synonym selectors defined by ‘HisRec’: f1 - • In the expression: a {f1 = 1, foo = 2} - In an equation for ‘updater2’: updater2 a = a {f1 = 1, foo = 2} +records-mixing-fields.hs:10:14: error: [GHC-14392] + Invalid record update. + No constructor in scope has all of the following fields: + ‘f1’, ‘qux’ diff --git a/testsuite/tests/perf/compiler/Makefile b/testsuite/tests/perf/compiler/Makefile index 33d2878db7..762883b0b4 100644 --- a/testsuite/tests/perf/compiler/Makefile +++ b/testsuite/tests/perf/compiler/Makefile @@ -32,4 +32,3 @@ MultiLayerModulesTH_OneShot_Prep: MultiLayerModulesTH_Make_Prep InstanceMatching: ./genMatchingTest 0 '$(TEST_HC)' $(TEST_HC_OPTS) -fno-code -fwrite-interface Defs.hs - diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 96d30e8017..37a6fdb2f9 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -660,3 +660,12 @@ test ('InfiniteListFusion', [collect_stats('bytes allocated',2), when(arch('i386'), skip), js_broken(22576)], compile_and_run, ['-O2 -package ghc']) + +# Track performance of record update renaming/typechecking +test('RecordUpdPerf', + [ collect_compiler_stats('bytes allocated',2), + pre_cmd('./genRecordUpdPerf'), + extra_files(['genRecordUpdPerf']), + ], + multimod_compile, + ['RecordUpdPerf', '-fno-code -v0']) diff --git a/testsuite/tests/perf/compiler/genRecordUpdPerf b/testsuite/tests/perf/compiler/genRecordUpdPerf new file mode 100755 index 0000000000..2ccbb67407 --- /dev/null +++ b/testsuite/tests/perf/compiler/genRecordUpdPerf @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +RECORDS=15 +FIELDS=20 +UPDATES_PER_RECORD=5 +echo "{-# LANGUAGE DuplicateRecordFields #-}" > RecordUpdPerf.hs +echo "module RecordUpdPerf where" >> RecordUpdPerf.hs +for r in $(seq -w 1 $RECORDS); do + echo "data R$r = MkR$r {" >> RecordUpdPerf.hs + for f in $(seq -w 1 $FIELDS); do + echo " r$f :: Int," >> RecordUpdPerf.hs + echo " s${r}_$f :: Int," >> RecordUpdPerf.hs + done + echo " t :: Bool }" >> RecordUpdPerf.hs +done + +for u in $(seq -w 1 $UPDATES_PER_RECORD); do + for r in $(seq -w 1 $RECORDS); do + echo "f${r}_$u r = r {" >> RecordUpdPerf.hs + for f in $(seq -w 1 $FIELDS); do + echo " r$f = $u * $r * $f," >> RecordUpdPerf.hs + done + echo " s${r}_$FIELDS = $u + $r }" >> RecordUpdPerf.hs + done +done diff --git a/testsuite/tests/perf/compiler/hard_hole_fits.stderr b/testsuite/tests/perf/compiler/hard_hole_fits.stderr index bfabc44219..694741f71d 100644 --- a/testsuite/tests/perf/compiler/hard_hole_fits.stderr +++ b/testsuite/tests/perf/compiler/hard_hole_fits.stderr @@ -492,10 +492,7 @@ hard_hole_fits.hs:38:33: warning: [GHC-88464] [-Wtyped-holes (in -Wdefault)] • Found hole: _ :: Int • In an equation for ‘testMe’: testMe (RecordUpd xru gl gls) = _ • Relevant bindings include - gls :: Either - [Language.Haskell.Syntax.Pat.LHsRecUpdField GhcPs] - [LHsRecUpdProj GhcPs] - (bound at hard_hole_fits.hs:38:26) + gls :: LHsRecUpdFields GhcPs (bound at hard_hole_fits.hs:38:26) gl :: LHsExpr GhcPs (bound at hard_hole_fits.hs:38:23) xru :: Language.Haskell.Syntax.Extension.XRecordUpd GhcPs (bound at hard_hole_fits.hs:38:19) diff --git a/testsuite/tests/plugins/static-plugins.stdout b/testsuite/tests/plugins/static-plugins.stdout index 5da8e9bee8..98d70197cd 100644 --- a/testsuite/tests/plugins/static-plugins.stdout +++ b/testsuite/tests/plugins/static-plugins.stdout @@ -5,9 +5,9 @@ interfacePlugin: GHC.Base interfacePlugin: GHC.Float interfacePlugin: GHC.Prim.Ext interfacePlugin: System.IO -typeCheckPlugin (rn) interfacePlugin: GHC.Types interfacePlugin: GHC.Show +typeCheckPlugin (rn) interfacePlugin: GHC.TopHandler typeCheckPlugin (tc) interfacePlugin: GHC.CString diff --git a/testsuite/tests/rename/should_compile/T22122.hs b/testsuite/tests/rename/should_compile/T22122.hs new file mode 100644 index 0000000000..25f8377e96 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T22122.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE NoFieldSelectors #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TemplateHaskell #-} + +module T22122 where + +import T22122_aux ( data_decls, record_upds ) + +-- This test checks that we can handle record declarations and updates +-- when the field 'Name's share the same underlying string. + +-- data D1 = MkD1 { fld1 :: Char, fld2 :: String } +-- data D2 = MkD2A { fld1 :: Char } | MkD2B { fld2 :: String } +$(return data_decls) + +-- rec_upd r = r { fld1 = 'c', fld2 = "foo" } +$(return record_upds) diff --git a/testsuite/tests/rename/should_compile/T22122_aux.hs b/testsuite/tests/rename/should_compile/T22122_aux.hs new file mode 100644 index 0000000000..b62aaa5840 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T22122_aux.hs @@ -0,0 +1,68 @@ +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TemplateHaskell #-} + +module T22122_aux where + +import Language.Haskell.TH.Syntax + ( Name, Type(ConT), Lit(CharL, StringL) + , Dec(DataD, FunD), Con(RecC), Exp(LitE, VarE, RecUpdE), Pat(VarP) + , Clause(Clause), Body(NormalB) + , Bang(..), SourceUnpackedness(..), SourceStrictness(..) + , newNameIO ) +import System.IO.Unsafe + ( unsafePerformIO ) + + +data Names a + = Names { d1_name, d2_name + , mkd1_name, mkd2a_name, mkd2b_name + , d1_fld1_name, d1_fld2_name, d2_fld1_name, d2_fld2_name + , upd_name, upd_var_name :: a } + deriving stock ( Functor, Foldable, Traversable ) + +string_names :: Names String +string_names = + Names + { d1_name = "D1" + , d2_name = "D2" + , mkd1_name = "MkD1" + , mkd2a_name = "MkD2A" + , mkd2b_name = "MkD2B" + , d1_fld1_name = "fld" -- these are deliberately the same, + , d1_fld2_name = "fld" -- to check that we correctly use the exact Names + , d2_fld1_name = "fld" -- in a record update, and not simply the + , d2_fld2_name = "fld" -- field label strings + , upd_name = "upd" + , upd_var_name = "r" + } + +names :: Names Name +names = unsafePerformIO $ traverse newNameIO string_names + +noBang :: Bang +noBang = Bang NoSourceUnpackedness NoSourceStrictness + +-- data D1 = MkD1 { fld1 :: Char, fld2 :: String } +-- data D2 = MkD2A { fld1 :: Char } | MkD2B { fld2 :: String } +data_decls :: [ Dec ] +data_decls = [ d1, d2 ] + where + Names { .. } = names + d1 = DataD [] d1_name [] Nothing [mkd1] [] + d2 = DataD [] d2_name [] Nothing [mkd2_a, mkd2_b] [] + mkd1 = RecC mkd1_name [(d1_fld1_name, noBang, ConT ''Char), (d1_fld2_name, noBang, ConT ''String)] + mkd2_a = RecC mkd2a_name [(d2_fld1_name, noBang, ConT ''Char)] + mkd2_b = RecC mkd2b_name [(d2_fld2_name, noBang, ConT ''String)] + +-- upd r = r { fld1 = 'c', fld2 = "foo" } +record_upds :: [ Dec ] +record_upds = [ rec_upd ] + where + Names { .. } = names + rec_upd = FunD upd_name [upd_clause] + upd_clause = Clause [VarP upd_var_name] (NormalB rec_upd_body) [] + rec_upd_body = RecUpdE (VarE upd_var_name) + [ (d1_fld1_name, LitE (CharL 'c')) + , (d1_fld2_name, LitE (StringL "foo")) ] diff --git a/testsuite/tests/rename/should_compile/all.T b/testsuite/tests/rename/should_compile/all.T index ba05c88357..55f58fcebc 100644 --- a/testsuite/tests/rename/should_compile/all.T +++ b/testsuite/tests/rename/should_compile/all.T @@ -208,3 +208,4 @@ test('GADTSymbolicRecordRecordWildcard', normal, compile, ['']) test('ImportNullaryRecordWildcard', [extra_files(['NullaryRecordWildcard.hs', 'NullaryRecordRecordWildcard.hs'])], multimod_compile, ['ImportNullaryRecordWildcard', '-v0']) test('GHCINullaryRecordWildcard', combined_output, ghci_script, ['GHCINullaryRecordWildcard.script']) test('GHCIImplicitImportNullaryRecordWildcard', combined_output, ghci_script, ['GHCIImplicitImportNullaryRecordWildcard.script']) +test('T22122', [expect_broken(22122), extra_files(['T22122_aux.hs'])], multimod_compile, ['T22122', '-v0']) diff --git a/testsuite/tests/rename/should_fail/T11167_ambig.stderr b/testsuite/tests/rename/should_fail/T11167_ambig.stderr index 8c9c6a7848..74c7064414 100644 --- a/testsuite/tests/rename/should_fail/T11167_ambig.stderr +++ b/testsuite/tests/rename/should_fail/T11167_ambig.stderr @@ -2,15 +2,15 @@ T11167_ambig.hs:10:13: error: Ambiguous occurrence ‘runContT’ It could refer to - either the field ‘runContT’ of record ‘ContT'’, - defined at T11167_ambig.hs:7:32 - or the field ‘runContT’ of record ‘ContT’, + either the field ‘runContT’ of record ‘ContT’, defined at T11167_ambig.hs:6:30 + or the field ‘runContT’ of record ‘ContT'’, + defined at T11167_ambig.hs:7:32 T11167_ambig.hs:17:9: error: Ambiguous occurrence ‘runContT’ It could refer to - either the field ‘runContT’ of record ‘ContT'’, - defined at T11167_ambig.hs:7:32 - or the field ‘runContT’ of record ‘ContT’, + either the field ‘runContT’ of record ‘ContT’, defined at T11167_ambig.hs:6:30 + or the field ‘runContT’ of record ‘ContT'’, + defined at T11167_ambig.hs:7:32 diff --git a/testsuite/tests/rename/should_fail/T12681.stderr b/testsuite/tests/rename/should_fail/T12681.stderr index 3a48d80c17..6b57b8517b 100644 --- a/testsuite/tests/rename/should_fail/T12681.stderr +++ b/testsuite/tests/rename/should_fail/T12681.stderr @@ -1,4 +1,5 @@ T12681.hs:4:17: error: [GHC-76037] Not in scope: ‘a’ - Suggested fix: Perhaps use ‘T12681a.a’ (imported from T12681a) + Suggested fix: + Perhaps use record field of A ‘T12681a.a’ (imported from T12681a) diff --git a/testsuite/tests/rename/should_fail/T19843f.stderr b/testsuite/tests/rename/should_fail/T19843f.stderr index c7c4d5dc58..4cf8e47089 100644 --- a/testsuite/tests/rename/should_fail/T19843f.stderr +++ b/testsuite/tests/rename/should_fail/T19843f.stderr @@ -1,8 +1,4 @@ -T19843f.hs:8:12: error: [GHC-76037] - Not in scope: ‘mup’ - Suggested fix: Perhaps use ‘mop’ (line 5) - -T19843f.hs:10:10: error: [GHC-76037] - Not in scope: ‘mup’ - Suggested fix: Perhaps use ‘mop’ (line 5) +T19843f.hs:8:12: error: [GHC-22385] + Not in scope: record field ‘mup’ + Suggested fix: Perhaps use record field of A ‘mop’ (line 5) diff --git a/testsuite/tests/rename/should_fail/T19843g.stderr b/testsuite/tests/rename/should_fail/T19843g.stderr index 78ee13eadf..e6441413be 100644 --- a/testsuite/tests/rename/should_fail/T19843g.stderr +++ b/testsuite/tests/rename/should_fail/T19843g.stderr @@ -1,4 +1,4 @@ -T19843g.hs:10:12: error: [GHC-76037] - Not in scope: ‘mup’ - Suggested fix: Perhaps use ‘mop’ (line 7) +T19843g.hs:10:12: error: [GHC-22385] + Not in scope: record field ‘mup’ + Suggested fix: Perhaps use record field of A ‘mop’ (line 7) diff --git a/testsuite/tests/rename/should_fail/T19843h.stderr b/testsuite/tests/rename/should_fail/T19843h.stderr index 43cf59befd..55d3fcdd96 100644 --- a/testsuite/tests/rename/should_fail/T19843h.stderr +++ b/testsuite/tests/rename/should_fail/T19843h.stderr @@ -2,7 +2,7 @@ T19843h.hs:14:7: error: [GHC-39999] • No instance for ‘GHC.Records.HasField "mup" r4 a4’ arising from selecting the field ‘mup’ - Perhaps use ‘mop’ (line 11) + Perhaps use record field of A ‘mop’ (line 11) • In the expression: undefined.mup In an equation for ‘foo’: foo = undefined.mup @@ -27,7 +27,7 @@ T19843h.hs:20:8: error: [GHC-39999] T19843h.hs:24:8: error: [GHC-39999] • No instance for ‘GHC.Records.HasField "getAll" r0 a0’ arising from selecting the field ‘getAll’ - Perhaps use ‘getAlt’ (imported from Data.Monoid) + Perhaps use record field of Alt ‘getAlt’ (imported from Data.Monoid) Perhaps you want to add ‘getAll’ to the import list in the import of ‘Data.Monoid’ (T19843h.hs:9:1-28). • In the expression: undefined.getAll diff --git a/testsuite/tests/rename/should_fail/T21605a.stderr b/testsuite/tests/rename/should_fail/T21605a.stderr index 7be47098df..ce199cfb8f 100644 --- a/testsuite/tests/rename/should_fail/T21605a.stderr +++ b/testsuite/tests/rename/should_fail/T21605a.stderr @@ -4,7 +4,6 @@ T21605a.hs:5:13: error: [GHC-76037] NB: the module ‘Prelude’ does not export ‘true’. Suggested fix: Perhaps use one of these: + data constructor ‘Prelude.True’ (imported from Prelude), type constructor or class ‘Prelude.Num’ (imported from Prelude), - type constructor or class ‘Prelude.Ord’ (imported from Prelude), - type constructor or class ‘Prelude.Enum’ (imported from Prelude) - + type constructor or class ‘Prelude.Ord’ (imported from Prelude) diff --git a/testsuite/tests/rename/should_fail/T21605d.stderr b/testsuite/tests/rename/should_fail/T21605d.stderr index 3db644aa93..0c0c3975af 100644 --- a/testsuite/tests/rename/should_fail/T21605d.stderr +++ b/testsuite/tests/rename/should_fail/T21605d.stderr @@ -1,8 +1,9 @@ -T21605d.hs:3:9: [GHC-37479] + +T21605d.hs:3:9: error: [GHC-37479] ‘Prelude.id’ is a term-level binding and can not be used at the type level. Suggested fix: Perhaps use one of these: + data constructor ‘Prelude.EQ’ (imported from Prelude), type constructor or class ‘Prelude.Eq’ (imported from Prelude), - type constructor or class ‘Prelude.IO’ (imported from Prelude), - type constructor or class ‘Prelude.Ord’ (imported from Prelude)
\ No newline at end of file + data constructor ‘Prelude.GT’ (imported from Prelude) diff --git a/testsuite/tests/rename/should_fail/T7943.hs b/testsuite/tests/rename/should_fail/T7943.hs index a1a99d508a..335cb350c7 100644 --- a/testsuite/tests/rename/should_fail/T7943.hs +++ b/testsuite/tests/rename/should_fail/T7943.hs @@ -1,4 +1,4 @@ module T7943 where data Foo = A { bar :: String } - | B String { bar :: String } + | B String { bar :: String } diff --git a/testsuite/tests/rename/should_fail/T7943.stderr b/testsuite/tests/rename/should_fail/T7943.stderr index 3100928e51..352d4c1f40 100644 --- a/testsuite/tests/rename/should_fail/T7943.stderr +++ b/testsuite/tests/rename/should_fail/T7943.stderr @@ -1,6 +1,3 @@ -T7943.hs:4:22: error: [GHC-89246] - • Record syntax is illegal here: {bar :: String} - • In the type ‘{bar :: String}’ - In the definition of data constructor ‘B’ - In the data declaration for ‘Foo’ +T7943.hs:4:21: error: [GHC-89246] + Record syntax is illegal here: {bar :: String} diff --git a/testsuite/tests/rename/should_fail/T9077.stderr b/testsuite/tests/rename/should_fail/T9077.stderr index a3a9d49ece..c20800b12f 100644 --- a/testsuite/tests/rename/should_fail/T9077.stderr +++ b/testsuite/tests/rename/should_fail/T9077.stderr @@ -1,2 +1,2 @@ -T9077.hs:3:12: Record syntax is illegal here: {} +T9077.hs:3:12: error: [GHC-89246] Record syntax is illegal here: {} diff --git a/testsuite/tests/rename/should_fail/T9156.stderr b/testsuite/tests/rename/should_fail/T9156.stderr index 361ed379df..1dbfb9b02e 100644 --- a/testsuite/tests/rename/should_fail/T9156.stderr +++ b/testsuite/tests/rename/should_fail/T9156.stderr @@ -1,5 +1,3 @@ -T9156.hs:4:19: - Multiple declarations of ‘f1’ - Declared at: T9156.hs:3:15 - T9156.hs:4:19 +T9156.hs:4:19: error: [GHC-85524] + Duplicate field name ‘f1’ in record declaration diff --git a/testsuite/tests/rename/should_fail/T9156_DF.hs b/testsuite/tests/rename/should_fail/T9156_DF.hs new file mode 100644 index 0000000000..aa55756c71 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T9156_DF.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE TypeFamilies #-} + +module T9156_DF where + +data X = MkX + +data family D a +data instance D Int + = D1 { f1 :: X } + | D2 { f1 :: X, f2 :: X, f1 :: X } diff --git a/testsuite/tests/rename/should_fail/T9156_DF.stderr b/testsuite/tests/rename/should_fail/T9156_DF.stderr new file mode 100644 index 0000000000..61e2af19a4 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T9156_DF.stderr @@ -0,0 +1,3 @@ + +T9156_DF.hs:10:29: error: [GHC-85524] + Duplicate field name ‘f1’ in record declaration diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index 2255117886..8d3029bd06 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -104,6 +104,7 @@ test('RnStaticPointersFail02', [], compile_fail, ['']) test('RnStaticPointersFail03', [], compile_fail, ['-dsuppress-uniques']) test('T9006', [], multimod_compile_fail, ['T9006', '-v0']) test('T9156', normal, compile_fail, ['']) +test('T9156_DF', normal, compile_fail, ['']) test('T9177', normal, compile_fail, ['']) test('T9177a', normal, compile_fail, ['']) test('T9436', normal, compile_fail, ['']) diff --git a/testsuite/tests/rename/should_fail/rn_dup.hs b/testsuite/tests/rename/should_fail/rn_dup.hs index 927e15ff32..7c2fc3380e 100644 --- a/testsuite/tests/rename/should_fail/rn_dup.hs +++ b/testsuite/tests/rename/should_fail/rn_dup.hs @@ -12,7 +12,7 @@ data P = MkP { rf :: Int, rf :: Int } data Q = MkQ { rf :: Int } class C a where - data CT a + data CT a f :: CT a -> a data CT a f :: CT a -> a diff --git a/testsuite/tests/rename/should_fail/rn_dup.stderr b/testsuite/tests/rename/should_fail/rn_dup.stderr index 5c4246d8b6..907fc38fe8 100644 --- a/testsuite/tests/rename/should_fail/rn_dup.stderr +++ b/testsuite/tests/rename/should_fail/rn_dup.stderr @@ -9,14 +9,12 @@ rn_dup.hs:9:10: error: Declared at: rn_dup.hs:7:10 rn_dup.hs:9:10 -rn_dup.hs:12:16: error: - Multiple declarations of ‘rf’ - Declared at: rn_dup.hs:11:27 - rn_dup.hs:12:16 +rn_dup.hs:11:27: error: [GHC-85524] + Duplicate field name ‘rf’ in record declaration rn_dup.hs:12:16: error: Multiple declarations of ‘rf’ - Declared at: rn_dup.hs:11:16 + Declared at: rn_dup.hs:11:27 rn_dup.hs:12:16 rn_dup.hs:17:3: error: diff --git a/testsuite/tests/rename/should_fail/rnfail054.stderr b/testsuite/tests/rename/should_fail/rnfail054.stderr index 04fff51118..3cb01c63da 100644 --- a/testsuite/tests/rename/should_fail/rnfail054.stderr +++ b/testsuite/tests/rename/should_fail/rnfail054.stderr @@ -1,5 +1,3 @@ -rnfail054.hs:6:13: error: [GHC-47535] - • ‘foo’ is not a record selector - • In the expression: x {foo = 1} - In an equation for ‘foo’: foo x = x {foo = 1} +rnfail054.hs:6:13: error: [GHC-22385] + Not in scope: record field ‘foo’ diff --git a/testsuite/tests/rep-poly/T20113.stderr b/testsuite/tests/rep-poly/T20113.stderr index 3d52dbe734..1358d188ea 100644 --- a/testsuite/tests/rep-poly/T20113.stderr +++ b/testsuite/tests/rep-poly/T20113.stderr @@ -4,12 +4,11 @@ T20113.hs:7:35: error: [GHC-55287] does not have a fixed runtime representation. Its type is: a :: TYPE rep - • In the pattern: MkY {y_fld = $sel:y_fld:MkY} - In an equation for ‘T20113.$sel:y_fld:MkY’: - T20113.$sel:y_fld:MkY MkY {y_fld = $sel:y_fld:MkY} = $sel:y_fld:MkY + • In the pattern: MkY {y_fld = y_fld} + In an equation for ‘y_fld’: y_fld MkY {y_fld = y_fld} = y_fld T20113.hs:7:35: error: [GHC-55287] - The first pattern in the equation for ‘$sel:y_fld:MkY’ + The first pattern in the equation for ‘y_fld’ does not have a fixed runtime representation. Its type is: Y a :: TYPE rep diff --git a/testsuite/tests/th/T10279.stderr b/testsuite/tests/th/T10279.stderr index 5993cdbf82..4a06b1d775 100644 --- a/testsuite/tests/th/T10279.stderr +++ b/testsuite/tests/th/T10279.stderr @@ -4,5 +4,8 @@ T10279.hs:10:9: error: [GHC-52243] no unit id matching ‘rts-1.0.2’ was found (This unit ID looks like the source package ID; the real unit ID is ‘rts’) - • In the expression: rts-1.0.2:A.Foo - In an equation for ‘blah’: blah = (rts-1.0.2:A.Foo) + • In the untyped splice: + $(conE + (Name + (mkOccName "Foo") + (NameG VarName (mkPkgName "rts-1.0.2") (mkModName "A")))) diff --git a/testsuite/tests/th/T10828.hs b/testsuite/tests/th/T10828.hs index ffb4525f6a..d73b5015ae 100644 --- a/testsuite/tests/th/T10828.hs +++ b/testsuite/tests/th/T10828.hs @@ -6,6 +6,7 @@ module T10828 where import Language.Haskell.TH hiding (Type) import System.IO import Data.Kind (Type) +import qualified Data.List.NonEmpty as NE ( singleton ) $( do { decl <- [d| data family D a :: Type -> Type data instance D Int Bool :: Type where @@ -33,7 +34,7 @@ $( return [ DataD [] (mkName "T") [ PlainTV (mkName "a") () ] (Just StarT) - [ GadtC [(mkName "MkT")] + [ GadtC (NE.singleton (mkName "MkT")) [ ( Bang NoSourceUnpackedness NoSourceStrictness , VarT (mkName "a") ) @@ -46,7 +47,7 @@ $( return , ForallC [PlainTV (mkName "a") SpecifiedSpec, PlainTV (mkName "b") SpecifiedSpec] [AppT (AppT EqualityT (VarT $ mkName "a" ) ) (ConT $ mkName "Int") ] $ - RecGadtC [(mkName "MkC")] + RecGadtC (NE.singleton (mkName "MkC")) [ ( mkName "foo" , Bang NoSourceUnpackedness NoSourceStrictness , VarT (mkName "a") diff --git a/testsuite/tests/th/T10828b.hs b/testsuite/tests/th/T10828b.hs index 03706d6b7c..36e91eb11a 100644 --- a/testsuite/tests/th/T10828b.hs +++ b/testsuite/tests/th/T10828b.hs @@ -4,6 +4,7 @@ module T10828b where import Language.Haskell.TH import System.IO +import qualified Data.List.NonEmpty as NE ( singleton ) -- attempting to mix GADT and normal constructors $( return @@ -23,7 +24,7 @@ $( return [AppT (AppT EqualityT (VarT $ mkName "a" ) ) (ConT $ mkName "Int") ] $ RecGadtC - [ (mkName "MkC")] + (NE.singleton (mkName "MkC")) [ ( mkName "foo" , Bang NoSourceUnpackedness NoSourceStrictness , VarT (mkName "a") diff --git a/testsuite/tests/th/T10828b.stderr b/testsuite/tests/th/T10828b.stderr index 357c86c458..6e78ca9087 100644 --- a/testsuite/tests/th/T10828b.stderr +++ b/testsuite/tests/th/T10828b.stderr @@ -1,5 +1,5 @@ -T10828b.hs:9:2: error: [GHC-24104] +T10828b.hs:10:2: error: [GHC-24104] Cannot mix GADT constructors with Haskell 98 constructors When splicing a TH declaration: data T a :: * diff --git a/testsuite/tests/th/T11345.hs b/testsuite/tests/th/T11345.hs index 2288cdad15..11de6d8bd5 100644 --- a/testsuite/tests/th/T11345.hs +++ b/testsuite/tests/th/T11345.hs @@ -5,6 +5,7 @@ module Main (main) where import Language.Haskell.TH +import qualified Data.List.NonEmpty as NE ( singleton ) infixr 7 :***: data GADT a where @@ -16,11 +17,11 @@ $(do gadtName <- newName "GADT2" infixName <- newName ":****:" a <- newName "a" return [ DataD [] gadtName [KindedTV a () StarT] Nothing - [ GadtC [prefixName] + [ GadtC (NE.singleton prefixName) [ (Bang NoSourceUnpackedness NoSourceStrictness,ConT ''Int) , (Bang NoSourceUnpackedness NoSourceStrictness,ConT ''Int) ] (AppT (ConT gadtName) (ConT ''Int)) - , GadtC [infixName] + , GadtC (NE.singleton infixName) [ (Bang NoSourceUnpackedness NoSourceStrictness,ConT ''Int) , (Bang NoSourceUnpackedness NoSourceStrictness,ConT ''Int) ] (AppT (ConT gadtName) (ConT ''Int)) diff --git a/testsuite/tests/th/T11941.stderr b/testsuite/tests/th/T11941.stderr index 39a25c7425..7a66251092 100644 --- a/testsuite/tests/th/T11941.stderr +++ b/testsuite/tests/th/T11941.stderr @@ -1,7 +1,7 @@ -T11941.hs:7:30: error: [GHC-76037] - Not in scope: ‘getFrst’ +T11941.hs:7:30: error: [GHC-22385] + Not in scope: record field ‘getFrst’ Suggested fix: Perhaps use one of these: - ‘getFirst’ (imported from Data.Monoid), - ‘getLast’ (imported from Data.Monoid) + record field of First ‘getFirst’ (imported from Data.Monoid), + record field of Last ‘getLast’ (imported from Data.Monoid) diff --git a/testsuite/tests/th/T17379a.hs b/testsuite/tests/th/T17379a.hs deleted file mode 100644 index 66702bb9b8..0000000000 --- a/testsuite/tests/th/T17379a.hs +++ /dev/null @@ -1,8 +0,0 @@ -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE GADTSyntax #-} - -module T17379a where - -import Language.Haskell.TH - -$(let typ = mkName "T" in pure [ DataD [] typ [] Nothing [GadtC [] [] (ConT typ)] [] ]) diff --git a/testsuite/tests/th/T17379a.stderr b/testsuite/tests/th/T17379a.stderr deleted file mode 100644 index ebb899e750..0000000000 --- a/testsuite/tests/th/T17379a.stderr +++ /dev/null @@ -1,4 +0,0 @@ - -T17379a.hs:8:2: error: [GHC-38140] - GadtC must have at least one constructor name - When splicing a TH declaration: data T where :: T diff --git a/testsuite/tests/th/T17379b.hs b/testsuite/tests/th/T17379b.hs deleted file mode 100644 index c83d180d18..0000000000 --- a/testsuite/tests/th/T17379b.hs +++ /dev/null @@ -1,8 +0,0 @@ -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE GADTSyntax #-} - -module T17379b where - -import Language.Haskell.TH - -$(let typ = mkName "T" in pure [ DataD [] typ [] Nothing [RecGadtC [] [] (ConT typ)] [] ]) diff --git a/testsuite/tests/th/T17379b.stderr b/testsuite/tests/th/T17379b.stderr deleted file mode 100644 index 9a4aabc250..0000000000 --- a/testsuite/tests/th/T17379b.stderr +++ /dev/null @@ -1,4 +0,0 @@ - -T17379b.hs:8:2: error: [GHC-18816] - RecGadtC must have at least one constructor name - When splicing a TH declaration: data T where :: {} -> T diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index a4f948bc76..2b792da6e2 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -504,8 +504,6 @@ test('T17296', normal, compile, ['-v0']) test('T17305', normal, compile, ['-v0']) test('T17380', normal, compile_fail, ['']) test('T17394', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques']) -test('T17379a', normal, compile_fail, ['']) -test('T17379b', normal, compile_fail, ['']) test('T17461', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques']) test('T17511', normal, compile, ['']) test('T17608', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques']) diff --git a/testsuite/tests/typecheck/should_compile/QualifiedRecordUpdate.hs b/testsuite/tests/typecheck/should_compile/QualifiedRecordUpdate.hs new file mode 100644 index 0000000000..3657ab4463 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/QualifiedRecordUpdate.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE DuplicateRecordFields #-} + +module QualifiedRecordUpdate where + +import QualifiedRecordUpdate_aux ( R(fld1, fld2), S(fld1, fld2) ) +import qualified QualifiedRecordUpdate_aux as B ( R(fld1, fld2), S(fld1) ) + +-- Unambiguous record update: the only record datatype in the B namespace +-- which contains field fld2 is R. +f r = r { B.fld1 = 3, B.fld2 = False } diff --git a/testsuite/tests/typecheck/should_compile/QualifiedRecordUpdate_aux.hs b/testsuite/tests/typecheck/should_compile/QualifiedRecordUpdate_aux.hs new file mode 100644 index 0000000000..c03abe277c --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/QualifiedRecordUpdate_aux.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE DuplicateRecordFields #-} + +module QualifiedRecordUpdate_aux where + +data R = R { fld1 :: Int, fld2 :: Bool } +data S = S { fld1 :: Int, fld2 :: Bool, fld3 :: Char } diff --git a/testsuite/tests/typecheck/should_compile/T21443.hs b/testsuite/tests/typecheck/should_compile/T21443.hs new file mode 100644 index 0000000000..7dbd451c09 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T21443.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE DuplicateRecordFields #-} + +module T21443 where + +data R = MkR1 { foo :: Int } + | MkR2 { bar :: Int } + +data S = MkS { foo :: Int, bar :: Int } + +blah x = x { foo = 5, bar = 6 } diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 327dd93675..4c200961f4 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -865,4 +865,8 @@ test('T22985a', normal, compile, ['-O']) test('T22985b', normal, compile, ['']) test('T23018', normal, compile, ['']) test('T21909', normal, compile, ['']) -test('T21909b', normal, compile, [''])
\ No newline at end of file +test('T21909b', normal, compile, ['']) +test('T21443', normal, compile, ['']) +test('QualifiedRecordUpdate', + [ extra_files(['QualifiedRecordUpdate_aux.hs']) ] + , multimod_compile, ['QualifiedRecordUpdate', '-v0']) diff --git a/testsuite/tests/typecheck/should_fail/T12035.hs b/testsuite/tests/typecheck/should_fail/T12035.hs index 87e20ff07c..cd12eee917 100644 --- a/testsuite/tests/typecheck/should_fail/T12035.hs +++ b/testsuite/tests/typecheck/should_fail/T12035.hs @@ -1,7 +1,7 @@ module T12035 where import T12035a type T = Bool -y = f True +--y = f True -- This should error that 'type T = Int' doesn't match 'data T', -- NOT that f expects argument of type T but got Bool. diff --git a/testsuite/tests/typecheck/should_fail/T21444.hs b/testsuite/tests/typecheck/should_fail/T21444.hs new file mode 100644 index 0000000000..28f2010dbd --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T21444.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE DuplicateRecordFields #-} + +module T21444 where + +data S = MkS { foo, bar, baz :: Int } +data T = MkT { foo, bar, baz :: Int } + +blah x = x { foo = 1, bar = 2, baz = 3 } diff --git a/testsuite/tests/typecheck/should_fail/T21444.stderr b/testsuite/tests/typecheck/should_fail/T21444.stderr new file mode 100644 index 0000000000..cd4795c969 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T21444.stderr @@ -0,0 +1,6 @@ + +T21444.hs:8:10: error: [GHC-99339] + • Ambiguous record update with fields ‘foo’, ‘bar’ and ‘baz’ + These fields appear in both datatypes ‘S’ and ‘T’ + • In the expression: x {foo = 1, bar = 2, baz = 3} + In an equation for ‘blah’: blah x = x {foo = 1, bar = 2, baz = 3} diff --git a/testsuite/tests/typecheck/should_fail/T7989.stderr b/testsuite/tests/typecheck/should_fail/T7989.stderr index 7413b06648..f5271b2167 100644 --- a/testsuite/tests/typecheck/should_fail/T7989.stderr +++ b/testsuite/tests/typecheck/should_fail/T7989.stderr @@ -1,15 +1,4 @@ T7989.hs:6:7: error: [GHC-14392] - • No constructor has all these fields: ‘a0’, ‘b0’ - • In the expression: x {a0 = 3, a1 = 2, b0 = 4, b1 = 5} - In an equation for ‘f’: f x = x {a0 = 3, a1 = 2, b0 = 4, b1 = 5} - -T7989.hs:9:7: error: [GHC-14392] - • No constructor has all these fields: ‘x’, ‘y’, ‘z’ - • In the expression: a {x = 0, y = 0, z = 0, v = 0} - In an equation for ‘g’: g a = a {x = 0, y = 0, z = 0, v = 0} - -T7989.hs:11:7: error: [GHC-14392] - • No constructor has all these fields: ‘x’, ‘a0’ - • In the expression: a {x = 0, a0 = 0} - In an equation for ‘h’: h a = a {x = 0, a0 = 0} + Invalid record update. + No constructor in scope has all of the following fields: ‘a0’, ‘b0’ diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 209f292737..2afc480451 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -675,3 +675,4 @@ test('T19627', normal, compile_fail, ['']) test('PatSynExistential', normal, compile_fail, ['']) test('PatSynArity', normal, compile_fail, ['']) test('PatSynUnboundVar', normal, compile_fail, ['']) +test('T21444', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_fail/tcfail114.stderr b/testsuite/tests/typecheck/should_fail/tcfail114.stderr index 7516ebb712..b751b31cd0 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail114.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail114.stderr @@ -1,5 +1,3 @@ -tcfail114.hs:11:20: error: [GHC-47535] - • ‘foo’ is not a record selector - • In the expression: undefined {foo = ()} - In an equation for ‘test’: test = undefined {foo = ()} +tcfail114.hs:11:20: error: [GHC-22385] + Not in scope: record field ‘foo’ diff --git a/testsuite/tests/warnings/should_compile/DodgyExports01.stderr b/testsuite/tests/warnings/should_compile/DodgyExports01.stderr index d3cae826ab..f916bcfaa4 100644 --- a/testsuite/tests/warnings/should_compile/DodgyExports01.stderr +++ b/testsuite/tests/warnings/should_compile/DodgyExports01.stderr @@ -1,5 +1,4 @@ DodgyExports01.hs:2:13: warning: [GHC-75356] [-Wdodgy-exports (in -Wextra)] The export item ‘T(..)’ suggests that - ‘T’ has (in-scope) constructors or class methods, - but it has none + ‘T’ has (in-scope) constructors or record fields, but it has none |