ngs icon indicating copy to clipboard operation
ngs copied to clipboard

X/Y/Z (short anonymous function syntax) precedence bug

Open ilyash-b opened this issue 3 years ago • 0 comments

1 -> X+2 is parsed as (1 -> X) + 2 instead of 1 -> (X+2)

$ ngs -pi '1 -> X+2' 
[ERROR 2021-12-13 00:04:43 IST] +----------------------------------------------------------------------+
[ERROR 2021-12-13 00:04:43 IST] | The arguments did not match any of the methods' parameters.          |
[ERROR 2021-12-13 00:04:43 IST] | Method or MultiMethod name: +                                        |
[ERROR 2021-12-13 00:04:43 IST] | Called with arguments' types: UserDefinedMethod, Int                 |
[ERROR 2021-12-13 00:04:43 IST] | Please check that you pass the right number of arguments.            |
[ERROR 2021-12-13 00:04:43 IST] | Please check that arguments' types are matching methods' parameters. |
[ERROR 2021-12-13 00:04:43 IST] +----------------------------------------------------------------------+
[ERROR 2021-12-13 00:04:43 IST] Exception of type MethodNotFound occurred
[ERROR 2021-12-13 00:04:43 IST] Info: callable:
[ERROR 2021-12-13 00:04:43 IST]   MultiMethod with 10 method(s)
...
[ERROR 2021-12-13 00:04:43 IST] Info: args:
[ERROR 2021-12-13 00:04:43 IST]   Arr of size 2
[ERROR 2021-12-13 00:04:43 IST]     [0] = <UserDefinedMethod <anonymous>(X:Any=..., Y:Any=..., Z:Any=...) at <command line -pi switch>:2>
[ERROR 2021-12-13 00:04:43 IST]     [1] = 2
[ERROR 2021-12-13 00:04:43 IST] Frame 0: <builtin-stdlib>:8011:2 - 8011:35
[ERROR 2021-12-13 00:04:43 IST] Frame 1: <builtin-stdlib>:7985:21 - 7985:30 [in bootstrap_exception_catch_wrapper]
[ERROR 2021-12-13 00:04:43 IST] Frame 2: <builtin-stdlib>:7917:12 - 7917:24 [in bootstrap]
[ERROR 2021-12-13 00:04:43 IST] Frame 3: <command line -pi switch>:2:7 - 2:8
+----------------------------------------------------------------------+
| The arguments did not match any of the methods' parameters.          |
| Method or MultiMethod name: +                                        |
| Called with arguments' types: UserDefinedMethod, Int                 |
| Please check that you pass the right number of arguments.            |
| Please check that arguments' types are matching methods' parameters. |
+----------------------------------------------------------------------+

ilyash-b avatar Dec 12 '21 22:12 ilyash-b