Complete operators properly
authorArthur Fayzrakhmanov (Артур Файзрахманов) <heraldhoi@gmail.com>
Sun, 17 Jan 2016 18:27:12 +0000 (19:27 +0100)
committerBen Gamari <ben@smart-cactus.org>
Sun, 17 Jan 2016 22:40:42 +0000 (23:40 +0100)
Fix operator completions: list of suitable completions only rather than
everything from imported modules.

Signed-off-by: Arthur Fayzrakhmanov (Артур Файзрахманов) <heraldhoi@gmail.com>
ghc: fix operator completions

Reviewers: austin, hvr, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1058

GHC Trac Issues: #10576

30 files changed:
ghc/GHCi/UI.hs
libraries/base/Text/Read/Lex.hs
testsuite/tests/ghci/prog015/Level1.hs [new file with mode: 0644]
testsuite/tests/ghci/prog015/Level2/Level2.hs [new file with mode: 0644]
testsuite/tests/ghci/prog015/Makefile [new file with mode: 0644]
testsuite/tests/ghci/prog015/TopLevel.hs [new file with mode: 0644]
testsuite/tests/ghci/prog015/prog015.T [new file with mode: 0644]
testsuite/tests/ghci/prog015/prog015.script [new file with mode: 0644]
testsuite/tests/ghci/prog015/prog015.stdout [new file with mode: 0644]
testsuite/tests/ghci/prog016/Level1.hs [new file with mode: 0644]
testsuite/tests/ghci/prog016/Level2/Level2.hs [new file with mode: 0644]
testsuite/tests/ghci/prog016/Makefile [new file with mode: 0644]
testsuite/tests/ghci/prog016/TopLevel.hs [new file with mode: 0644]
testsuite/tests/ghci/prog016/prog016.T [new file with mode: 0644]
testsuite/tests/ghci/prog016/prog016.script [new file with mode: 0644]
testsuite/tests/ghci/prog016/prog016.stdout [new file with mode: 0644]
testsuite/tests/ghci/prog017/Level1.hs [new file with mode: 0644]
testsuite/tests/ghci/prog017/Level2/Level2.hs [new file with mode: 0644]
testsuite/tests/ghci/prog017/Makefile [new file with mode: 0644]
testsuite/tests/ghci/prog017/TopLevel.hs [new file with mode: 0644]
testsuite/tests/ghci/prog017/prog017.T [new file with mode: 0644]
testsuite/tests/ghci/prog017/prog017.script [new file with mode: 0644]
testsuite/tests/ghci/prog017/prog017.stdout [new file with mode: 0644]
testsuite/tests/ghci/scripts/T10576.hs [new file with mode: 0644]
testsuite/tests/ghci/scripts/T10576a.script [new file with mode: 0644]
testsuite/tests/ghci/scripts/T10576a.stdout [new file with mode: 0644]
testsuite/tests/ghci/scripts/T10576b.script [new file with mode: 0644]
testsuite/tests/ghci/scripts/T10576b.stdout [new file with mode: 0644]
testsuite/tests/ghci/scripts/all.T
testsuite/tests/ghci/should_fail/all.T

index 29d3688..5c4c00e 100644 (file)
@@ -111,6 +111,7 @@ import System.IO.Unsafe ( unsafePerformIO )
 import System.Process
 import Text.Printf
 import Text.Read ( readMaybe )
+import Text.Read.Lex (isSymbolChar)
 
 #ifndef mingw32_HOST_OS
 import System.Posix hiding ( getEnv )
@@ -231,10 +232,12 @@ ghciCommands = map mkCmd [
 -- NOTE: in order for us to override the default correctly, any custom entry
 -- must be a SUBSET of word_break_chars.
 word_break_chars :: String
-word_break_chars = let symbols = "!#$%&*+/<=>?@\\^|-~"
-                       specials = "(),;[]`{}"
-                       spaces = " \t\n"
-                   in spaces ++ specials ++ symbols
+word_break_chars = spaces ++ specials ++ symbols
+
+symbols, specials, spaces :: String
+symbols = "!#$%&*+/<=>?@\\^|-~"
+specials = "(),;[]`{}"
+spaces = " \t\n"
 
 flagWordBreakChars :: String
 flagWordBreakChars = " \t\n"
@@ -2770,13 +2773,24 @@ completeGhciCommand, completeMacro, completeIdentifier, completeModule,
     completeHomeModuleOrFile, completeExpression
     :: CompletionFunc GHCi
 
+-- | Provide completions for last word in a given string.
+--
+-- Takes a tuple of two strings.  First string is a reversed line to be
+-- completed.  Second string is likely unused, 'completeCmd' always passes an
+-- empty string as second item in tuple.
 ghciCompleteWord :: CompletionFunc GHCi
 ghciCompleteWord line@(left,_) = case firstWord of
+    -- If given string starts with `:` colon, and there is only one following
+    -- word then provide REPL command completions.  If there is more than one
+    -- word complete either filename or builtin ghci commands or macros.
     ':':cmd     | null rest     -> completeGhciCommand line
                 | otherwise     -> do
                         completion <- lookupCompletion cmd
                         completion line
+    -- If given string starts with `import` keyword provide module name
+    -- completions
     "import"    -> completeModule line
+    -- otherwise provide identifier completions
     _           -> completeExpression line
   where
     (firstWord,rest) = break isSpace $ dropWhile isSpace $ reverse left
@@ -2801,10 +2815,16 @@ completeMacro = wrapIdentCompleter $ \w -> do
   cmds <- liftIO $ readIORef macros_ref
   return (filter (w `isPrefixOf`) (map cmdName cmds))
 
-completeIdentifier = wrapIdentCompleter $ \w -> do
-  rdrs <- GHC.getRdrNamesInScope
-  dflags <- GHC.getSessionDynFlags
-  return (filter (w `isPrefixOf`) (map (showPpr dflags) rdrs))
+completeIdentifier line@(left, _) =
+  -- Note: `left` is a reversed input
+  case left of
+    (x:_) | isSymbolChar x -> wrapCompleter (specials ++ spaces) complete line
+    _                      -> wrapIdentCompleter complete line
+  where
+    complete w = do
+      rdrs <- GHC.getRdrNamesInScope
+      dflags <- GHC.getSessionDynFlags
+      return (filter (w `isPrefixOf`) (map (showPpr dflags) rdrs))
 
 completeModule = wrapIdentCompleter $ \w -> do
   dflags <- GHC.getSessionDynFlags
index ed4d204..7054be9 100644 (file)
@@ -30,6 +30,8 @@ module Text.Read.Lex
   , readOctP
   , readDecP
   , readHexP
+
+  , isSymbolChar
   )
  where
 
@@ -214,18 +216,19 @@ lexSymbol =
         return (Punc s)         -- Reserved-ops count as punctuation
       else
         return (Symbol s)
- where
-  isSymbolChar c = not (isPuncChar c) && case generalCategory c of
-      MathSymbol              -> True
-      CurrencySymbol          -> True
-      ModifierSymbol          -> True
-      OtherSymbol             -> True
-      DashPunctuation         -> True
-      OtherPunctuation        -> not (c `elem` "'\"")
-      ConnectorPunctuation    -> c /= '_'
-      _                       -> False
-  reserved_ops   = ["..", "::", "=", "\\", "|", "<-", "->", "@", "~", "=>"]
-
+  where
+    reserved_ops   = ["..", "::", "=", "\\", "|", "<-", "->", "@", "~", "=>"]
+
+isSymbolChar :: Char -> Bool
+isSymbolChar c = not (isPuncChar c) && case generalCategory c of
+    MathSymbol              -> True
+    CurrencySymbol          -> True
+    ModifierSymbol          -> True
+    OtherSymbol             -> True
+    DashPunctuation         -> True
+    OtherPunctuation        -> not (c `elem` "'\"")
+    ConnectorPunctuation    -> c /= '_'
+    _                       -> False
 -- ----------------------------------------------------------------------
 -- identifiers
 
diff --git a/testsuite/tests/ghci/prog015/Level1.hs b/testsuite/tests/ghci/prog015/Level1.hs
new file mode 100644 (file)
index 0000000..2c45a20
--- /dev/null
@@ -0,0 +1,3 @@
+module Level1 where
+
+l1 = undefined :: ()
diff --git a/testsuite/tests/ghci/prog015/Level2/Level2.hs b/testsuite/tests/ghci/prog015/Level2/Level2.hs
new file mode 100644 (file)
index 0000000..6bcc6a2
--- /dev/null
@@ -0,0 +1,3 @@
+module Level2.Level2 where
+
+l2 = undefined :: ()
diff --git a/testsuite/tests/ghci/prog015/Makefile b/testsuite/tests/ghci/prog015/Makefile
new file mode 100644 (file)
index 0000000..9101fbd
--- /dev/null
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/ghci/prog015/TopLevel.hs b/testsuite/tests/ghci/prog015/TopLevel.hs
new file mode 100644 (file)
index 0000000..e1fcb23
--- /dev/null
@@ -0,0 +1,4 @@
+module TopLevel (module Level1, module Level2.Level2) where
+
+import Level1
+import Level2.Level2
diff --git a/testsuite/tests/ghci/prog015/prog015.T b/testsuite/tests/ghci/prog015/prog015.T
new file mode 100644 (file)
index 0000000..b6a17b2
--- /dev/null
@@ -0,0 +1,2 @@
+# testcase for module import completions, e.g. `:complete repl "import Mod"`
+test('prog015', normal, ghci_script, ['prog015.script'])
diff --git a/testsuite/tests/ghci/prog015/prog015.script b/testsuite/tests/ghci/prog015/prog015.script
new file mode 100644 (file)
index 0000000..b098c67
--- /dev/null
@@ -0,0 +1,25 @@
+:load TopLevel
+
+:complete repl "import Le"
+-- should list Level1 and Level2.Levele2
+
+:complete repl 1 "import Le"
+-- should list Level1
+
+:complete repl 2-3 "import Le"
+-- should list Level2.Level2
+
+:complete repl "import Level."
+-- should list nothing
+
+:complete repl "import Level2"
+-- should list Level2.Levele2
+
+:complete repl "import Level2."
+-- same output
+
+:complete repl "import Level2.W"
+-- should list nothing
+
+:complete repl "import Level2.L"
+-- should list Level2.Level2
\ No newline at end of file
diff --git a/testsuite/tests/ghci/prog015/prog015.stdout b/testsuite/tests/ghci/prog015/prog015.stdout
new file mode 100644 (file)
index 0000000..91c15e1
--- /dev/null
@@ -0,0 +1,15 @@
+2 2 "import "
+"Level1"
+"Level2.Level2"
+1 2 "import "
+"Level1"
+1 2 "import "
+"Level2.Level2"
+0 0 "import "
+1 1 "import "
+"Level2.Level2"
+1 1 "import "
+"Level2.Level2"
+0 0 "import "
+1 1 "import "
+"Level2.Level2"
\ No newline at end of file
diff --git a/testsuite/tests/ghci/prog016/Level1.hs b/testsuite/tests/ghci/prog016/Level1.hs
new file mode 100644 (file)
index 0000000..1144d42
--- /dev/null
@@ -0,0 +1,7 @@
+module Level1 where
+
+level1Fun1 :: ()
+level1Fun1 = ()
+
+level1Fun2 :: ()
+level1Fun2 = ()
diff --git a/testsuite/tests/ghci/prog016/Level2/Level2.hs b/testsuite/tests/ghci/prog016/Level2/Level2.hs
new file mode 100644 (file)
index 0000000..96bacff
--- /dev/null
@@ -0,0 +1,10 @@
+module Level2.Level2 where
+
+level2Fun1 :: ()
+level2Fun1 = ()
+
+level2Fun2 :: ()
+level2Fun2 = ()
+
+level2Fun3 :: ()
+level2Fun3 = ()
diff --git a/testsuite/tests/ghci/prog016/Makefile b/testsuite/tests/ghci/prog016/Makefile
new file mode 100644 (file)
index 0000000..9101fbd
--- /dev/null
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/ghci/prog016/TopLevel.hs b/testsuite/tests/ghci/prog016/TopLevel.hs
new file mode 100644 (file)
index 0000000..2ce9012
--- /dev/null
@@ -0,0 +1,7 @@
+module TopLevel (module Level1, module Level2.Level2) where
+
+import Level1
+import Level2.Level2
+
+topLevelFun :: ()
+topLevelFun = ()
diff --git a/testsuite/tests/ghci/prog016/prog016.T b/testsuite/tests/ghci/prog016/prog016.T
new file mode 100644 (file)
index 0000000..c73220c
--- /dev/null
@@ -0,0 +1,2 @@
+# testcase for regular identifier completions, e.g. `:complete repl "fun"`
+test('prog016', normal, ghci_script, ['prog016.script'])
diff --git a/testsuite/tests/ghci/prog016/prog016.script b/testsuite/tests/ghci/prog016/prog016.script
new file mode 100644 (file)
index 0000000..5c0f249
--- /dev/null
@@ -0,0 +1,34 @@
+:load TopLevel
+
+:complete repl "lev"
+-- should list all 5 functions
+
+:complete repl "levWRONG"
+-- should list nothing
+
+:complete repl 1 "lev"
+-- should list one function
+
+:complete repl 2-4 "lev"
+-- should list three results
+
+:complete repl 4-10 "lev"
+-- should list last two results
+
+:complete repl "level1"
+-- should list two results
+
+:complete repl "level2"
+-- should list three results
+
+:complete repl "Level"
+-- should list five results
+
+:complete repl "Level.l"
+-- should list no results
+
+:complete repl "Level1.l"
+-- should list two results
+
+:complete repl "Level2.Level2"
+-- should list three results
\ No newline at end of file
diff --git a/testsuite/tests/ghci/prog016/prog016.stdout b/testsuite/tests/ghci/prog016/prog016.stdout
new file mode 100644 (file)
index 0000000..9a1e8a0
--- /dev/null
@@ -0,0 +1,37 @@
+5 5 ""
+"level1Fun1"
+"level1Fun2"
+"level2Fun1"
+"level2Fun2"
+"level2Fun3"
+0 0 ""
+1 5 ""
+"level1Fun1"
+3 5 ""
+"level1Fun2"
+"level2Fun1"
+"level2Fun2"
+2 5 ""
+"level2Fun2"
+"level2Fun3"
+2 2 ""
+"level1Fun1"
+"level1Fun2"
+3 3 ""
+"level2Fun1"
+"level2Fun2"
+"level2Fun3"
+5 5 ""
+"Level1.level1Fun1"
+"Level1.level1Fun2"
+"Level2.Level2.level2Fun1"
+"Level2.Level2.level2Fun2"
+"Level2.Level2.level2Fun3"
+0 0 ""
+2 2 ""
+"Level1.level1Fun1"
+"Level1.level1Fun2"
+3 3 ""
+"Level2.Level2.level2Fun1"
+"Level2.Level2.level2Fun2"
+"Level2.Level2.level2Fun3"
\ No newline at end of file
diff --git a/testsuite/tests/ghci/prog017/Level1.hs b/testsuite/tests/ghci/prog017/Level1.hs
new file mode 100644 (file)
index 0000000..68f7683
--- /dev/null
@@ -0,0 +1,5 @@
+module Level1 where
+
+(..--) = undefined :: ()
+(..-+) = undefined :: ()
+(..++) = undefined :: ()
diff --git a/testsuite/tests/ghci/prog017/Level2/Level2.hs b/testsuite/tests/ghci/prog017/Level2/Level2.hs
new file mode 100644 (file)
index 0000000..32fcc1d
--- /dev/null
@@ -0,0 +1,3 @@
+module Level2.Level2 where
+
+(..+=..) = undefined :: ()
diff --git a/testsuite/tests/ghci/prog017/Makefile b/testsuite/tests/ghci/prog017/Makefile
new file mode 100644 (file)
index 0000000..9101fbd
--- /dev/null
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/ghci/prog017/TopLevel.hs b/testsuite/tests/ghci/prog017/TopLevel.hs
new file mode 100644 (file)
index 0000000..c2e562b
--- /dev/null
@@ -0,0 +1,182 @@
+module TopLevel (module Level1, module Level2.Level2) where
+
+import Level1
+import Level2.Level2
+
+
+-- ASCII syms
+(..-) = undefined :: ()
+(..+) = undefined :: ()
+(..=) = undefined :: ()
+(..>>) = undefined :: ()
+(..!>) = undefined :: ()
+
+-- General Punctuation
+(⁐) = undefined :: () -- U+2050
+(⁐⁑) = undefined :: () -- ... U+2051
+
+-- supAndSubScriptR
+-- likely everything is this group is rejected
+-- moved to failing T10550a test
+
+-- currencySymbolR
+(₽) = undefined :: () -- U+20BD
+(₽€) = undefined :: () -- ... U+20AC
+
+-- letterLikeSymbolR
+(⅀) = undefined :: () -- U+2140
+(⅀⅀) = undefined :: () -- ... U+2140
+
+-- numberFormsR
+-- likely everything is this group is rejected
+-- moved to failing T10550b test
+
+-- enclosedAlphanumericsR
+(⒡) = undefined :: () -- U+24A1
+(⒡Ⓞ) = undefined :: () -- ... U+24C4
+-- some from this group is rejected, e.g. ③
+-- added to failing T10550d test
+
+-- enclosedAlphanumericSupplementR
+(🄐) = undefined :: () -- U+1F110
+(🄐🄐) = undefined :: () -- ... U+1F110
+-- some from this group is rejected, e.g. 🄀
+-- added failing test case T10550d
+
+-- enclosedIdeographicSupplementR
+(🈐) = undefined :: () -- U+1F210
+(🈐🈭) = undefined :: () -- ... U+1F22D
+
+-- arrowsR
+(←) = undefined :: () -- U+2190
+(←→) = undefined :: () -- ... U+2192
+
+-- supplementalArrowsAR
+(⟹) = undefined :: () -- U+27F9
+(⟹⟿) = undefined :: () -- .. U+27FF
+
+-- supplementalArrowsBR
+(⤴) = undefined :: () -- U+2934
+(⤴⤵) = undefined :: () -- ... U+2935
+
+-- supplementalArrowsCR
+(🡘) = undefined :: () -- U+1F858
+(🡘🢕) = undefined :: () -- ... U+1F895
+
+-- miscellaneousSymbolsAndArrowsR
+(⬤) = undefined :: () -- U+2B24
+(⬤⬱) = undefined :: () -- ... U+2B31
+
+-- dingbatArrowsR
+(➾) = undefined :: () -- U+27BE
+(➾➔) = undefined :: () -- ... U+2794
+
+-- mathematicalOperators
+(∀) = undefined :: () -- U+2200
+(∀⋙) = undefined :: () -- ... U+22D9
+
+-- miscellaneousMathematicalSymbolsAR
+(⟑) = undefined :: () -- U+27D1
+(⟑⟑) = undefined :: () -- ... U+27E9
+-- some from this group is rejected, e.g. ⟨
+-- added failing test case T10550e
+
+-- miscellaneousMathematicalSymbolsBR
+(⧦) = undefined :: () -- U+29E6
+(⧦⧵) = undefined :: () -- ... U+29F5
+
+-- supplementalMathematicalOperatorsR
+(⨶) = undefined :: () -- U+2A36
+(⨶⫫) = undefined :: () -- ... U+2AEB
+
+-- mathematicalAlphanumericSymbolsR
+(𝛌) = undefined :: () -- U+1D6CC
+(𝛌𝕘) = undefined :: () -- ... U+1D558
+
+-- miscellaneousTechnicalR
+(⌘) = undefined :: () -- U+2318
+(⌘⌥) = undefined :: () -- ... U+2325
+
+-- controlPicturesR
+(␘) = undefined :: () -- U+2418
+(␘␡) = undefined :: () -- ... U+2421
+
+-- characterRecognitionR
+(⑁) = undefined :: () -- U+2441
+(⑁⑅) = undefined :: () -- ... U+2445
+
+-- byzantineMusicalSymbolsR
+(𝀐) = undefined :: () -- U+1DO1O
+(𝀐𝃆) = undefined :: () -- ... U+1D0C6
+
+-- musicalSymbolsR
+(𝄢) = undefined :: () -- U+1D122
+(𝄢𝇇) = undefined :: () -- ... U+1D1C7
+
+-- ancientGreekMusicalNotationR
+(𝉀) = undefined :: () -- U+1D240
+(𝉀𝈒) = undefined :: () -- ... U+1D212
+
+-- mahjongTilesR
+(🀐) = undefined :: () -- U+1F010
+(🀐🀢) = undefined :: () -- ... U+1F022
+
+-- dominoTilesR
+(🀱) = undefined :: () -- U+1F031
+(🀱🁧) = undefined :: () -- ... U+1F067
+
+-- playingCardsR
+(🂿) = undefined :: () -- U+1F0BF
+(🂿🃠) = undefined :: () -- ... U+1F0E0
+
+-- miscellaneousSymbolsR
+(☀) = undefined :: () -- U+2600
+(☀☭) = undefined :: () -- ... U+262D
+
+-- emoticonsR
+-- likely everything is this group is rejected
+-- added failing test case T10550f
+
+-- miscellaneousSymbolsAndPictographsR
+(🌓) = undefined :: () -- U+1F313
+(🌓🐇) = undefined :: () -- ... U+1F407
+
+-- transportAndMapSymbolsR
+(🚭) = undefined :: () -- U+1F6AD
+(🚭🚀) = undefined :: () -- ... U+1F680
+
+-- dingbatsR
+(✔) = undefined :: () -- U+2714
+(✔✩) = undefined :: () -- ... U+2729
+
+-- combiningDiacriticalMarksForSymbolsR
+-- combining unicode symbols should be handled and tested in some smart manner
+-- added failing T10550g test case
+
+-- boxDrawingR
+(━) = undefined :: () -- U+2501
+(━╃) = undefined :: () -- ... U+2543
+
+-- blockElementsR
+(▙) = undefined :: () -- U+2599
+(▙▟) = undefined :: () -- ... U+259F
+
+-- geometricShapesR
+(△) = undefined :: () -- U+25B3
+(△◉) = undefined :: () -- ... U+25C9
+
+-- geometricShapesExtendedR
+(🞋) = undefined :: () -- U+1F78B
+(🞋🞯) = undefined :: () -- ... U+1F7AF
+
+-- ornamentalDingbatsR
+(🙫) = undefined :: () -- U+1F66B
+(🙫🙢) = undefined :: () -- ... U+1F662
+
+-- arabicMathematicalAlphabeticSymbolsR
+(𞺂) = undefined :: () -- U+1EE82
+(𞺂𞹟) = undefined :: () -- ... U+1EE5F
+
+-- alchemicalSymbolsR
+(🜄) = undefined :: () -- U+1F704
+(🜄🝪) = undefined :: () -- ... U+1F76A
diff --git a/testsuite/tests/ghci/prog017/prog017.T b/testsuite/tests/ghci/prog017/prog017.T
new file mode 100644 (file)
index 0000000..64e523b
--- /dev/null
@@ -0,0 +1,2 @@
+# testcase for operator completions, e.g. `:complete repl ">>"`
+test('prog017', normal, ghci_script, ['prog017.script'])
diff --git a/testsuite/tests/ghci/prog017/prog017.script b/testsuite/tests/ghci/prog017/prog017.script
new file mode 100644 (file)
index 0000000..3022338
--- /dev/null
@@ -0,0 +1,136 @@
+:load TopLevel
+
+:complete repl ".."
+-- 9 results from all modules including submodules
+
+:complete repl "..+"
+-- should list completions from all modules including submodules
+
+:complete repl "..+="
+-- should list one result
+
+:complete repl "Lev"
+-- should list completions from submodules
+
+:complete repl "Level1"
+-- should list completions from submodule
+
+:complete repl "Level1."
+-- should give same results
+
+:complete repl "..>"
+
+:complete repl "..!"
+
+-- for all Unicode tests should be returned list of two results
+
+-- General Punctuation
+:complete repl "⁐"
+
+-- currencySymbolR
+:complete repl "₽"
+
+-- letterLikeSymbolR
+:complete repl "⅀"
+
+-- enclosedAlphanumericsR
+:complete repl "⒡"
+
+-- enclosedAlphanumericSupplementR
+:complete repl "🄐"
+
+-- enclosedIdeographicSupplementR
+:complete repl "🈐"
+
+-- arrowsR
+:complete repl "←"
+
+-- supplementalArrowsAR
+:complete repl "⟹"
+
+-- supplementalArrowsBR
+:complete repl "⤴"
+
+-- supplementalArrowsCR
+:complete repl "🡘"
+
+-- miscellaneousSymbolsAndArrowsR
+:complete repl "⬤"
+
+-- dingbatArrowsR
+:complete repl "➾"
+
+-- mathematicalOperators
+:complete repl "∀"
+
+-- miscellaneousMathematicalSymbolsAR
+:complete repl "⟑"
+
+-- miscellaneousMathematicalSymbolsBR
+:complete repl "⧦"
+
+-- supplementalMathematicalOperatorsR
+:complete repl "⨶"
+
+-- mathematicalAlphanumericSymbolsR
+:complete repl "𝛌"
+
+-- miscellaneousTechnicalR
+:complete repl "⌘"
+
+-- controlPicturesR
+:complete repl "␘"
+
+-- characterRecognitionR
+:complete repl "⑁"
+
+-- byzantineMusicalSymbolsR
+:complete repl "𝀐"
+
+-- musicalSymbolsR
+:complete repl "𝄢"
+
+-- ancientGreekMusicalNotationR
+:complete repl "𝉀"
+
+-- mahjongTilesR
+:complete repl "🀐"
+
+-- dominoTilesR
+:complete repl "🀱"
+
+-- playingCardsR
+:complete repl "🂿"
+
+-- miscellaneousSymbolsR
+:complete repl "☀"
+
+-- miscellaneousSymbolsAndPictographsR
+:complete repl "🌓"
+
+-- transportAndMapSymbolsR
+:complete repl "🚭"
+
+-- dingbatsR
+:complete repl "✔"
+
+-- boxDrawingR
+:complete repl "━"
+
+-- blockElementsR
+:complete repl "▙"
+
+-- geometricShapesR
+:complete repl "△"
+
+-- geometricShapesExtendedR
+:complete repl "🞋"
+
+-- ornamentalDingbatsR
+:complete repl "🙫"
+
+-- arabicMathematicalAlphabeticSymbolsR
+:complete repl "𞺂"
+
+-- alchemicalSymbolsR
+:complete repl "🜄"
\ No newline at end of file
diff --git a/testsuite/tests/ghci/prog017/prog017.stdout b/testsuite/tests/ghci/prog017/prog017.stdout
new file mode 100644 (file)
index 0000000..903660d
--- /dev/null
@@ -0,0 +1,144 @@
+9 9 ""
+"..!>"
+"..+"
+"..++"
+"..+=.."
+"..-"
+"..-+"
+"..--"
+"..="
+"..>>"
+3 3 ""
+"..+"
+"..++"
+"..+=.."
+1 1 ""
+"..+=.."
+4 4 ""
+"Level1...++"
+"Level1...-+"
+"Level1...--"
+"Level2.Level2...+=.."
+3 3 ""
+"Level1...++"
+"Level1...-+"
+"Level1...--"
+3 3 ""
+"Level1...++"
+"Level1...-+"
+"Level1...--"
+1 1 ""
+"..>>"
+1 1 ""
+"..!>"
+2 2 ""
+"\8272"
+"\8272\8273"
+2 2 ""
+"\8381"
+"\8381\8364"
+2 2 ""
+"\8512"
+"\8512\8512"
+2 2 ""
+"\9377"
+"\9377\9412"
+2 2 ""
+"\127248"
+"\127248\127248"
+2 2 ""
+"\127504"
+"\127504\127533"
+2 2 ""
+"\8592"
+"\8592\8594"
+2 2 ""
+"\10233"
+"\10233\10239"
+2 2 ""
+"\10548"
+"\10548\10549"
+2 2 ""
+"\129112"
+"\129112\129173"
+2 2 ""
+"\11044"
+"\11044\11057"
+2 2 ""
+"\10174"
+"\10174\10132"
+2 2 ""
+"\8704"
+"\8704\8921"
+2 2 ""
+"\10193"
+"\10193\10193"
+2 2 ""
+"\10726"
+"\10726\10741"
+2 2 ""
+"\10806"
+"\10806\10987"
+2 2 ""
+"\120524"
+"\120524\120152"
+2 2 ""
+"\8984"
+"\8984\8997"
+2 2 ""
+"\9240"
+"\9240\9249"
+2 2 ""
+"\9281"
+"\9281\9285"
+2 2 ""
+"\118800"
+"\118800\118982"
+2 2 ""
+"\119074"
+"\119074\119239"
+2 2 ""
+"\119360"
+"\119360\119314"
+2 2 ""
+"\126992"
+"\126992\127010"
+2 2 ""
+"\127025"
+"\127025\127079"
+2 2 ""
+"\127167"
+"\127167\127200"
+2 2 ""
+"\9728"
+"\9728\9773"
+2 2 ""
+"\127763"
+"\127763\128007"
+2 2 ""
+"\128685"
+"\128685\128640"
+2 2 ""
+"\10004"
+"\10004\10025"
+2 2 ""
+"\9473"
+"\9473\9539"
+2 2 ""
+"\9625"
+"\9625\9631"
+2 2 ""
+"\9651"
+"\9651\9673"
+2 2 ""
+"\128907"
+"\128907\128943"
+2 2 ""
+"\128619"
+"\128619\128610"
+2 2 ""
+"\126594"
+"\126594\126559"
+2 2 ""
+"\128772"
+"\128772\128874"
diff --git a/testsuite/tests/ghci/scripts/T10576.hs b/testsuite/tests/ghci/scripts/T10576.hs
new file mode 100644 (file)
index 0000000..03a6d42
--- /dev/null
@@ -0,0 +1,7 @@
+module T10576 where
+
+(☀☀) :: () -> () -> ()
+(☀☀) _ _ = ()
+
+x1 = undefined :: ()
+x2 = undefined :: ()
diff --git a/testsuite/tests/ghci/scripts/T10576a.script b/testsuite/tests/ghci/scripts/T10576a.script
new file mode 100644 (file)
index 0000000..bead0be
--- /dev/null
@@ -0,0 +1,4 @@
+--  When completing operators take into account spaceless cases
+:l T10576.hs
+
+:complete repl "x1☀"
\ No newline at end of file
diff --git a/testsuite/tests/ghci/scripts/T10576a.stdout b/testsuite/tests/ghci/scripts/T10576a.stdout
new file mode 100644 (file)
index 0000000..8949cff
--- /dev/null
@@ -0,0 +1,2 @@
+1 1 ""
+"\2600\2600"
\ No newline at end of file
diff --git a/testsuite/tests/ghci/scripts/T10576b.script b/testsuite/tests/ghci/scripts/T10576b.script
new file mode 100644 (file)
index 0000000..85c1a08
--- /dev/null
@@ -0,0 +1,4 @@
+--  When completing operators take into account spaceless cases
+:l T10576.hs
+
+:complete repl "x1☀☀x"
\ No newline at end of file
diff --git a/testsuite/tests/ghci/scripts/T10576b.stdout b/testsuite/tests/ghci/scripts/T10576b.stdout
new file mode 100644 (file)
index 0000000..5a00060
--- /dev/null
@@ -0,0 +1,3 @@
+2 2 ""
+"x1"
+"x2"
\ No newline at end of file
index 4618281..c1bda85 100755 (executable)
@@ -234,3 +234,6 @@ test('T10989',
 test('T11098', normal, ghci_script, ['T11098.script'])
 test('T8316', expect_broken(8316), ghci_script, ['T8316.script'])
 test('T11252', normal, ghci_script, ['T11252.script'])
+
+test('T10576a', expect_broken(10576), ghci_script, ['T10576a.script'])
+test('T10576b', expect_broken(10576), ghci_script, ['T10576b.script'])
\ No newline at end of file
index 58a396e..024322b 100644 (file)
@@ -1,2 +1,2 @@
 test('T10549', [], ghci_script, ['T10549.script'])
-test('T10549a', [], ghci_script, ['T10549a.script'])
+test('T10549a', [], ghci_script, ['T10549a.script'])
\ No newline at end of file