diff --git a/testsuite/tests/ghci/scripts/T16575.hs b/testsuite/tests/ghci/scripts/T16575.hs new file mode 100644 index 0000000000000000000000000000000000000000..08cd440d5c449eda438e86e77eac3a3de13bc13e --- /dev/null +++ b/testsuite/tests/ghci/scripts/T16575.hs @@ -0,0 +1,9 @@ +module Ghost where + +data X = A | B + deriving (Show) + +instance Eq X where + A == A = True + B == B = True + _ == _ = False diff --git a/testsuite/tests/ghci/scripts/T16575.script b/testsuite/tests/ghci/scripts/T16575.script new file mode 100644 index 0000000000000000000000000000000000000000..0a251bddc04bc0e8bb8126b2e0481895f482de4c --- /dev/null +++ b/testsuite/tests/ghci/scripts/T16575.script @@ -0,0 +1,18 @@ +:set +c +:l T16575.hs +:all-types + +-- data X = A | B +-- deriving (Show) +-- ^^^^ +:type-at T16575.hs 4 15 4 19 +-- wrongly outputs: +-- :: [X] -> ShowS + +-- instance Eq X where +-- ^^^^ +:type-at T16575.hs 6 10 6 14 +-- wrongly outputs: +-- :: X -> X -> Bool + +-- also note how :all-types is inconsistent with :type-at diff --git a/testsuite/tests/ghci/scripts/T16575.stdout b/testsuite/tests/ghci/scripts/T16575.stdout new file mode 100644 index 0000000000000000000000000000000000000000..833fb02d80dce68740f742710bdfaf37af8b1199 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T16575.stdout @@ -0,0 +1,26 @@ +Collecting type info for 1 module(s) ... +T16575.hs:(4,15)-(4,18): GHC.Types.Int -> Ghost.X -> GHC.Show.ShowS +T16575.hs:(7,7)-(7,8): Ghost.X -> Ghost.X -> GHC.Types.Bool +T16575.hs:(4,15)-(4,18): GHC.Show.Show Ghost.X +T16575.hs:(4,15)-(4,18): ([Ghost.X] -> GHC.Show.ShowS) -> GHC.Show.Show Ghost.X +T16575.hs:(4,15)-(4,18): (Ghost.X -> GHC.Base.String) -> ([Ghost.X] -> GHC.Show.ShowS) -> GHC.Show.Show Ghost.X +T16575.hs:(4,15)-(4,18): (GHC.Types.Int -> Ghost.X -> GHC.Show.ShowS) -> (Ghost.X -> GHC.Base.String) -> ([Ghost.X] -> GHC.Show.ShowS) -> GHC.Show.Show Ghost.X +T16575.hs:(4,15)-(4,18): GHC.Types.Int -> Ghost.X -> GHC.Show.ShowS +T16575.hs:(4,15)-(4,18): Ghost.X -> GHC.Base.String +T16575.hs:(4,15)-(4,18): [Ghost.X] -> GHC.Show.ShowS +T16575.hs:(6,10)-(6,13): GHC.Classes.Eq Ghost.X +T16575.hs:(6,10)-(6,13): (Ghost.X -> Ghost.X -> GHC.Types.Bool) -> GHC.Classes.Eq Ghost.X +T16575.hs:(6,10)-(6,13): (Ghost.X -> Ghost.X -> GHC.Types.Bool) -> (Ghost.X -> Ghost.X -> GHC.Types.Bool) -> GHC.Classes.Eq Ghost.X +T16575.hs:(6,10)-(6,13): Ghost.X -> Ghost.X -> GHC.Types.Bool +T16575.hs:(6,10)-(6,13): Ghost.X -> Ghost.X -> GHC.Types.Bool +T16575.hs:(7,14)-(7,17): GHC.Types.Bool +T16575.hs:(8,14)-(8,17): GHC.Types.Bool +T16575.hs:(9,14)-(9,18): GHC.Types.Bool +T16575.hs:(7,5)-(7,5): Ghost.X +T16575.hs:(7,10)-(7,10): Ghost.X +T16575.hs:(8,5)-(8,5): Ghost.X +T16575.hs:(8,10)-(8,10): Ghost.X +T16575.hs:(9,5)-(9,5): Ghost.X +T16575.hs:(9,10)-(9,10): Ghost.X + :: [X] -> ShowS + :: X -> X -> Bool diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 6a16842ac77de107ae19eba1551b832ba27c3370..e334b7e9628ba13de9d08c3736158a238ee44448 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -300,3 +300,4 @@ test('T16527', normal, ghci_script, ['T16527.script']) test('T16563', extra_hc_opts("-clear-package-db -global-package-db"), ghci_script, ['T16563.script']) test('T16569', normal, ghci_script, ['T16569.script']) test('T16767', normal, ghci_script, ['T16767.script']) +test('T16575', normal, ghci_script, ['T16575.script'])