diff options
-rw-r--r-- | libraries/base/Data/Typeable/Internal.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_run/T14341.hs | 9 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_run/T14341.stdout | 3 | ||||
-rwxr-xr-x | testsuite/tests/typecheck/should_run/all.T | 1 |
4 files changed, 18 insertions, 1 deletions
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 0d4fc825cf..06d225adb7 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -773,7 +773,11 @@ showTypeable _ TrType = showChar '*' showTypeable _ rep | isListTyCon tc, [ty] <- tys = showChar '[' . shows ty . showChar ']' - | isTupleTyCon tc = + + -- Take care only to render saturated tuple tycon applications + -- with tuple notation (#14341). + | isTupleTyCon tc, + Just _ <- TrType `eqTypeRep` typeRepKind rep = showChar '(' . showArgs (showChar ',') tys . showChar ')' where (tc, tys) = splitApps rep showTypeable _ (TrTyCon {trTyCon = tycon, trKindVars = []}) diff --git a/testsuite/tests/typecheck/should_run/T14341.hs b/testsuite/tests/typecheck/should_run/T14341.hs new file mode 100644 index 0000000000..72d2f63b1e --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T14341.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE TypeApplications #-} + +import Type.Reflection + +main :: IO () +main = do + print $ typeRep @((,,)) + print $ typeRep @((,,) Int) + print $ typeRep @((,,) Int Int Int) diff --git a/testsuite/tests/typecheck/should_run/T14341.stdout b/testsuite/tests/typecheck/should_run/T14341.stdout new file mode 100644 index 0000000000..ea3d3441a2 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T14341.stdout @@ -0,0 +1,3 @@ +(,,) +(,,) Int +(Int,Int,Int)
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index a96c2b71c5..4f75c70119 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -136,3 +136,4 @@ test('T13838', [exit_code(1), omit_ways(['ghci'])], compile_and_run, ['-fdefer-t test('T14218', normal, compile_and_run, ['']) test('T14236', normal, compile_and_run, ['']) test('T14925', normal, compile_and_run, ['']) +test('T14341', normal, compile_and_run, ['']) |