From b17fb3d96bd2e9f3bf96392f3b3b3e0aed7fe276 Mon Sep 17 00:00:00 2001 From: sheaf Date: Mon, 6 Feb 2023 11:37:57 +0100 Subject: Don't allow . in overloaded labels This patch removes . from the list of allowed characters in a non-quoted overloaded label, as it was realised this steals syntax, e.g. (#.). Users who want this functionality will have to add quotes around the label, e.g. `#"17.28"`. Fixes #22821 --- testsuite/tests/overloadedrecflds/should_run/T11671_run.hs | 7 ++++--- testsuite/tests/printer/Test22771.hs | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'testsuite/tests') diff --git a/testsuite/tests/overloadedrecflds/should_run/T11671_run.hs b/testsuite/tests/overloadedrecflds/should_run/T11671_run.hs index 78ebcdca8e..19a051d0cb 100644 --- a/testsuite/tests/overloadedrecflds/should_run/T11671_run.hs +++ b/testsuite/tests/overloadedrecflds/should_run/T11671_run.hs @@ -12,8 +12,9 @@ import GHC.Prim (Addr#) instance KnownSymbol symbol => IsLabel symbol String where fromLabel = symbolVal (Proxy :: Proxy symbol) -(#) :: String -> Int -> String +(#), (#.) :: String -> Int -> String (#) _ i = show i +_ #. i = show i f :: Addr# -> Int -> String f _ i = show i @@ -26,13 +27,13 @@ main = traverse_ putStrLn , #type , #Foo , #3 - , #199.4 + , #"199.4" , #17a23b , #f'a' , #'a' , #' , #''notTHSplice - , #... + , #"..." , #привет , #こんにちは , #"3" diff --git a/testsuite/tests/printer/Test22771.hs b/testsuite/tests/printer/Test22771.hs index b935a511d0..c711471fb6 100644 --- a/testsuite/tests/printer/Test22771.hs +++ b/testsuite/tests/printer/Test22771.hs @@ -14,8 +14,9 @@ import GHC.Prim (Addr#) instance KnownSymbol symbol => IsLabel symbol String where fromLabel = symbolVal (Proxy :: Proxy symbol) -(#) :: String -> Int -> String +(#), (#.) :: String -> Int -> String (#) _ i = show i +_ #. i = show i f :: Addr# -> Int -> String f _ i = show i @@ -28,13 +29,13 @@ main = traverse_ putStrLn , #type , #Foo , #3 - , #199.4 + , #"199.4" , #17a23b , #f'a' , #'a' , #' , #''notTHSplice - , #... + , #"..." , #привет , #こんにちは , #"3" -- cgit v1.2.1