emacs -Q
In *scratch*, evaluate:
(funcall
(let ((lexical-binding t))
(byte-compile
(lambda (&optional a b)
(list a b))))
'a 'b)
Result is (a b), as expected. Now evaluate
(funcall
(let ((lexical-binding t))
(byte-compile
(lambda (&optional a &optional b)
(list a b))))
'a 'b)
Result is (b nil).
Emacs should either generate correct code in both cases, or signal an
error in the latter case.