mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-19 09:12:34 +03:00
Show unrelated namespace with matching operator name
This commit is contained in:
parent
f67b303cca
commit
0e09b8d575
@ -1047,12 +1047,14 @@ removeFixity loc _ key = do
|
||||
else -- When the fixity is not found, find close matches
|
||||
let fixityNames : List Name = map fst (toList fixityInfo)
|
||||
closeNames = !(filterM (coreLift . closeMatch key) fixityNames)
|
||||
in if null closeNames
|
||||
sameName : List Name = fst <$> lookupName (dropAllNS key) fixityInfo
|
||||
similarNamespaces = nub (closeNames ++ sameName)
|
||||
in if null similarNamespaces
|
||||
then
|
||||
throw $ GenericMsg loc "Fixity \{show key} not found"
|
||||
else
|
||||
throw $ GenericMsgSol loc "Fixity \{show key} not found" "Did you mean"
|
||||
(map printFixityHide closeNames)
|
||||
throw $ GenericMsgSol loc "Fixity \{show key} not found" "Did you mean"
|
||||
$ map printFixityHide similarNamespaces
|
||||
where
|
||||
printFixityHide : Name -> String
|
||||
printFixityHide nm = "%hide \{show nm}"
|
||||
|
@ -1,2 +1,2 @@
|
||||
|
||||
%hide DoesNotExist.infixl.(+)
|
||||
%hide DoesNotExist.infixl.(+-+)
|
||||
|
4
tests/idris2/operators/operators011/Test4.idr
Normal file
4
tests/idris2/operators/operators011/Test4.idr
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
import Module
|
||||
|
||||
%hide DoesNotExist.infixl.(&&++)
|
@ -1,10 +1,10 @@
|
||||
1/1: Building Test (Test.idr)
|
||||
Error: Fixity DoesNotExist.infixl.(+) not found
|
||||
Error: Fixity DoesNotExist.infixl.(+-+) not found
|
||||
|
||||
Test:2:1--2:30
|
||||
Test:2:1--2:32
|
||||
1 |
|
||||
2 | %hide DoesNotExist.infixl.(+)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 | %hide DoesNotExist.infixl.(+-+)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
1/2: Building Module (Module.idr)
|
||||
2/2: Building Test1 (Test1.idr)
|
||||
@ -40,3 +40,15 @@ Test3:3:1--3:27
|
||||
|
||||
Did you mean:
|
||||
- %hide Module.infixl.(&&++)
|
||||
2/2: Building Test4 (Test4.idr)
|
||||
Error: Fixity DoesNotExist.infixl.(&&++) not found
|
||||
|
||||
Test4:4:1--4:33
|
||||
1 |
|
||||
2 | import Module
|
||||
3 |
|
||||
4 | %hide DoesNotExist.infixl.(&&++)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Did you mean:
|
||||
- %hide Module.infixl.(&&++)
|
||||
|
@ -4,3 +4,4 @@ check Test.idr
|
||||
check Test1.idr
|
||||
check Test2.idr
|
||||
check Test3.idr
|
||||
check Test4.idr
|
||||
|
Loading…
Reference in New Issue
Block a user