From 4798f3b91c23709d7c464004bf07e28c75060c11 Mon Sep 17 00:00:00 2001 From: Takenobu Tani Date: Sat, 12 Oct 2019 14:30:04 +0900 Subject: Allow command name resolution for GHCi commands with option `!` #17345 This commit allows command name resolution for GHCi commands with option `!` as follows: ghci> :k! Int Int :: * = Int This commit changes implementation as follows: Before: * Prefix match with full string including the option `!` (e.g. `k!`) After (this patch): * Prefix match without option suffix `!` (e.g. `k`) * in addition, suffix match with option `!` See also #8305 and #8113 --- testsuite/tests/ghci/scripts/T17345.script | 8 ++++++++ testsuite/tests/ghci/scripts/T17345.stdout | 3 +++ testsuite/tests/ghci/scripts/all.T | 1 + 3 files changed, 12 insertions(+) create mode 100644 testsuite/tests/ghci/scripts/T17345.script create mode 100644 testsuite/tests/ghci/scripts/T17345.stdout (limited to 'testsuite/tests/ghci/scripts') diff --git a/testsuite/tests/ghci/scripts/T17345.script b/testsuite/tests/ghci/scripts/T17345.script new file mode 100644 index 0000000000..076e8153fd --- /dev/null +++ b/testsuite/tests/ghci/scripts/T17345.script @@ -0,0 +1,8 @@ +-- Testing command name resolution with option (`!`) + +-- builtin command +:k! () + +-- macro command +:def! kind! (\e -> putStrLn "called :kind! macro" >> return "") +:k! () diff --git a/testsuite/tests/ghci/scripts/T17345.stdout b/testsuite/tests/ghci/scripts/T17345.stdout new file mode 100644 index 0000000000..49d6aca306 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T17345.stdout @@ -0,0 +1,3 @@ +() :: * += () +called :kind! macro diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index aaefca532e..96c63149fb 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -311,3 +311,4 @@ test('T16509', normal, ghci_script, ['T16509.script']) test('T16804', extra_files(['T16804a.hs', 'T16804b.hs', 'T16804c.hs']), ghci_script, ['T16804.script']) test('T15546', normal, ghci_script, ['T15546.script']) test('T16876', normal, ghci_script, ['T16876.script']) +test('T17345', normal, ghci_script, ['T17345.script']) -- cgit v1.2.1