Skip to content

redefines-builtin-id: check all specs in grouped type declarations - #1946

Open
HawkForge wants to merge 1 commit into
revive-lint:masterfrom
HawkForge:fix/redefines-builtin-id-grouped-types
Open

HawkForge wants to merge 1 commit into
revive-lint:masterfrom
HawkForge:fix/redefines-builtin-id-grouped-types

Conversation

@HawkForge

Copy link
Copy Markdown

Fixes #1866. Thanks to @dajiaohuang for the report.

The token.TYPE branch of the rule only looked at n.Specs[0], so in type (Local int; len int) the second spec was never checked. The var/const branch already iterates over all specs.

The type branch now loops over all specs and reports each TypeSpec whose name is a built-in, with the same failure node and message as before. Single-spec declarations behave as they did.

The test data gets a grouped type declaration whose second spec redefines len. The test fails without the change and passes with it.


Replaces #1922, which got closed when my fork was accidentally detached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant