Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad error message on mistakenly providing keyword arguments #135

Closed
countvajhula opened this issue Dec 15, 2023 · 0 comments
Closed

Bad error message on mistakenly providing keyword arguments #135

countvajhula opened this issue Dec 15, 2023 · 0 comments
Labels
bug Something isn't working Qi 4 Related to the Qi 4 release

Comments

@countvajhula
Copy link
Collaborator

We do not support keyword arguments as flow inputs, so while this shouldn't work, the error message should ideally indicate that keyword argument is not supported. Instead:

(~>> (2 1 3 #:key values) (sort <))
; :476:0: ~>>: expected one of these literal symbols: `sep' or `△'
;   at: (sort <)
;   in: (~>> (2 1 3 #:key values) (sort <))
;   Source locations:
;   :476:26

It looks like this is happening because it is trying to match the first (error-catching) clause in the ~>> macro definition, for some reason, and complains that it doesn't match(?):

qi-lib/threading.rkt:
(define-syntax-parser %~>>
  [(_ (arg0 arg ...+) (~or* (~datum sep) (~datum △)) clause:clause ...)
   ;; catch a common usage error
   (report-syntax-error this-syntax
     "(~>> (arg ...) flo ...)"
     "Attempted to separate multiple values."
     "Note that the inputs to ~>> must be wrapped in parentheses.")]
  [(_ args:subject clause:clause ...)
   #:with ags (attribute args.args)
   #'(on ags (~>> clause ...))])

... i.e. it is failing to match on line 2, not the correct second clause on line 8.

@countvajhula countvajhula added bug Something isn't working Qi 4 Related to the Qi 4 release labels Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Qi 4 Related to the Qi 4 release
Projects
None yet
Development

No branches or pull requests

1 participant