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

-let breaks edebug #256

Closed
Wilfred opened this issue Dec 13, 2017 · 5 comments
Closed

-let breaks edebug #256

Wilfred opened this issue Dec 13, 2017 · 5 comments
Labels
bug Existing behavior is incorrect

Comments

@Wilfred
Copy link
Contributor

Wilfred commented Dec 13, 2017

(defun foo ()
  (-let (((a . b) (cons 1 2))
         (c))
    a))

C-u M-x edebug-eval-defun breaks edebug:

Debugger entered--Lisp error: (invalid-read-syntax "Expected one of" (&rest (sexp form)) (vector [&rest [sexp form]]))
  signal(invalid-read-syntax ("Expected one of" (&rest (sexp form)) (vector [&rest [sexp form]])))
  edebug-syntax-error("Expected one of" (&rest (sexp form)) (vector [&rest [sexp form]]))
  apply(edebug-syntax-error ("Expected one of" (&rest (sexp form)) (vector [&rest [sexp form]])))
  edebug-no-match((((((a . b) (cons 1 2)) (c)) a) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) "Expected one of" (&rest (sexp form)) (vector [&rest [sexp form]]))
  apply(edebug-no-match (((((a . b) (cons 1 2)) (c)) a) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) "Expected one of" ((&rest (sexp form)) (vector [&rest [sexp form]])))
  edebug-match-&or((((((a . b) (cons 1 2)) (c)) a) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) ((&rest (sexp form)) (vector [&rest [sexp form]])))
  edebug-match-specs((((((a . b) (cons 1 2)) (c)) a) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) (&or (&rest (sexp form)) (vector [&rest [sexp form]])) edebug-match-specs)
  edebug-match((((((a . b) (cons 1 2)) (c)) a) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) (&or (&rest (sexp form)) (vector [&rest [sexp form]])))
  edebug-match-one-spec((((((a . b) (cons 1 2)) (c)) a) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) [&or (&rest (sexp form)) (vector [&rest [sexp form]])])
  edebug-match-specs((((((a . b) (cons 1 2)) (c)) a) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) ([&or (&rest (sexp form)) (vector [&rest [sexp form]])] body) edebug-match-specs)
  edebug-match-sublist((((((a . b) (cons 1 2)) (c)) a) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) ([&or (&rest (sexp form)) (vector [&rest [sexp form]])] body))
  edebug-list-form((((((a . b) (cons 1 2)) (c)) a) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65))
  edebug-form((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66))
  edebug-match-form((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66))
  edebug-match-symbol((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) form)
  edebug-match-one-spec((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) form)
  edebug-match-specs((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) (form) edebug-&rest-wrapper)
  edebug-&optional-wrapper((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) (form) edebug-&rest-wrapper)
  edebug-&rest-wrapper((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) (form) edebug-&rest-wrapper)
  edebug-match-&rest((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) (form))
  edebug-match-specs((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) (&rest form) edebug-match-specs)
  edebug-match((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) (&rest form))
  edebug-match-def-body((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66))
  edebug-match-symbol((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) def-body)
  edebug-match-one-spec((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) def-body)
  edebug-match-specs((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) (def-body) edebug-match-specs)
  edebug-match-specs((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) ([&optional ("interactive" interactive)] def-body) edebug-match-specs)
  edebug-match-specs((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) ([&optional stringp] [&optional ("interactive" interactive)] def-body) edebug-match-specs)
  edebug-match-specs((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) (lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body) edebug-match-specs)
  edebug-match-specs((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) (name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body) edebug-match-specs)
  edebug-match-specs((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) ("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body) edebug-match-specs)
  edebug-match-sublist((((-let (((a . b) (cons 1 2)) (c)) a)) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66) ("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body))
  edebug-match-list((((defun foo nil (-let (((a . b) (cons 1 2)) (c)) a))) (1 (2 . 7) (8 . 11) (12 . 14) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66)) ("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body))
  edebug-match-one-spec((((defun foo nil (-let (((a . b) (cons 1 2)) (c)) a))) (1 (2 . 7) (8 . 11) (12 . 14) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66)) ("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body))
  edebug-match-specs((((defun foo nil (-let (((a . b) (cons 1 2)) (c)) a))) (1 (2 . 7) (8 . 11) (12 . 14) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66)) (("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body)) edebug-match-specs)
  edebug-match((((defun foo nil (-let (((a . b) (cons 1 2)) (c)) a))) (1 (2 . 7) (8 . 11) (12 . 14) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66)) (("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body)))
  edebug-make-form-wrapper((((defun foo nil (-let (((a . b) (cons 1 2)) (c)) a))) (1 (2 . 7) (8 . 11) (12 . 14) (17 (18 . 22) (23 (24 (25 (26 . 27) (29 . 31) . 32) (33 (34 . 38) (39 . 40) (41 . 42) . 43) . 44) (54 (55 . 56) . 57) . 58) (63 . 64) . 65) . 66)) 1 65 (("defun" name lambda-list [&optional stringp] [&optional ("interactive" interactive)] def-body)))
  edebug-read-and-maybe-wrap-form1()
  edebug-read-and-maybe-wrap-form()
  edebug-read-top-level-form()
  #[257 "\211?�?=?\305�\211��?=��\306 *\211@\307=\203(

I'm not sure why this is, or if it's an edebug issue.

@Wilfred
Copy link
Contributor Author

Wilfred commented Dec 13, 2017

Minimal example:

(defun foo ()
  (-let ((y))
    y))

Wilfred added a commit to Wilfred/helpful that referenced this issue Dec 13, 2017
This fixes the failing tests. It also ensures that we show the correct
source code for primitive functions/special forms.

We also use (-let ((foo nil)) ...) rather than (-let ((foo)) ...)
or (-let (foo) ...) to work around an edebug issue:
magnars/dash.el#256
@Fuco1
Copy link
Collaborator

Fuco1 commented Dec 14, 2017

I don't think this is a valid form. What do you expect (y) to be bound to? I think nil would make sense as it is the car of a nil. I'm not really sure if we should support this syntax though, it does not make much sense to me.

So then we can argue it does not break edebug rather than it is a "type check" :D What is your use-case for having such a binding?

@Wilfred
Copy link
Contributor Author

Wilfred commented Dec 14, 2017

I'd expect y to be bound to nil. This is consistent normal let:

(defun foo ()
  (let ((y))
    y))

I ended up using this syntax as a workaround for #255, but I would expect it to work since it works with let.

It's probably an edebug issue, as the macro expansion looks fine.

@Fuco1
Copy link
Collaborator

Fuco1 commented Dec 14, 2017

Oh, I was not aware that it was allowed syntax. I assumed you either had to have a tuple or just a variable, but not (variable). If this is supported by let then we should also support it, which we seem to do. So probably the debug declaration needs some love.

Thanks for making this clear for me :) ❤️

@Fuco1 Fuco1 added the bug Existing behavior is incorrect label Dec 14, 2017
@Fuco1 Fuco1 closed this as completed in 148404c Jul 26, 2018
@Wilfred
Copy link
Contributor Author

Wilfred commented Jul 26, 2018

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing behavior is incorrect
Projects
None yet
Development

No branches or pull requests

2 participants