test: silence unused lexical argument byte-compile warnings - #220
Open
dannywillems wants to merge 2 commits into
Open
dannywillems wants to merge 2 commits into
dannywillems wants to merge 2 commits into
Conversation
The four buffer-local text objects defined with evil-define-text-object declare a type argument, but evil-define-text-object expands its body inside a let that binds its own type variable, shadowing the argument. The argument is therefore never read and the byte-compiler reports it as an unused lexical argument. Prefix the argument with an underscore to mark it intentionally unused. The body keeps referring to type, which resolves to the macro-introduced binding, so behaviour is unchanged.
Add a CI workflow that byte-compiles evil-surround.el with warnings treated as errors and loads the package, across Emacs 27.2, 30.1 and snapshot. Evil is installed from NonGNU ELPA / MELPA as a dependency. Add a dependabot configuration to keep the GitHub Actions up to date on a weekly schedule.
Author
|
This is an automated effort to help maintaining packages in the Emacs community. See https://x.com/dwillems42/status/2060720730338185699 |
Author
Member
|
Any reason we can't use Eask like evil does? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Byte-compiling
test/evil-surround-test.elproduces fourUnused lexical argument 'type'warnings, one for each buffer-localtext object defined in the "create buffer local text object and surround
binding" test.
evil-define-text-objectexpands its body inside aletthat binds itsown
typevariable (see theFIXME: These let-bindings shadow variables in argscomment inevil-macros.el). That binding shadows thetypeargument declared in the text-object signature, so the argument is never
read and the byte-compiler flags it.
This change prefixes the argument with an underscore (
_type) to mark itintentionally unused. The bodies keep referring to
type, which resolvesto the macro-introduced binding, so behaviour is unchanged.
CI
This repository had no CI. I added a GitHub Actions workflow that
byte-compiles
evil-surround.elwith warnings treated as errors andloads the package, across Emacs 27.2, 30.1 and snapshot, plus a
dependabot config for the actions. The workflow is green on my fork.
I scoped warnings-as-errors to the library only: the test file still
emits four "function ... is not known to be defined" warnings for text
objects created at run time inside the test body, which are inherent to
the test structure and not addressed here.
Verification
_typeremoves the four unused-argument warnings; no new warnings appear.check-parenspasses on the test file.evil-surround.elbyte-compiles cleanly with warnings-as-errors.