-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
fix: creating duplicate params via renaming vars #6885
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix lint warning, then lgtm
Fixed lint, and set it to error since we want to enforce it! Please tell me if you want me to revert that change. |
@@ -166,6 +166,9 @@ Blockly.Msg.VARIABLE_ALREADY_EXISTS = 'A variable named "%1" already exists.'; | |||
/** @type {string} */ | |||
/// alert - Tells the user that the name they entered is already in use for another type. | |||
Blockly.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE = 'A variable named "%1" already exists for another type: "%2".'; | |||
/** @type {string} */ | |||
/// alert - Tells the user that the name they entered is already in use as a parameter to a procedure, that the variable they are renaming also exists on. Renaming would create two parameters with the same name, which is not allowed. | |||
Blockly.Msg.VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER = 'A variable named "%1" already exists as a parameter in the procedure "%2".'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you did not npm run messages
(formerly …generate:langfiles
), so this message is not included in any translation (including English).
The basics
npm run format
andnpm run lint
The details
Resolves
Fixes #3767
Proposed Changes
Adds a step to
renameVariable
that detects if a variable rename will create a parameter conflict.Detects conflicts in legacy procedure blocks by walking the workspace, and conflicts in procedure models by checking if the parameter wraps a variable model.
Alternative implementations discussed here: #3767 (comment)
Reason for Changes
Squash de buggies
Test Coverage
Added tests for
nameUsedWithConflictingParam
for both legacy procedure blocks and procedure models.Documentation
N/A
Additional Information
Best reviewed commit-wise, especially because I reorganize some code to return-early instead of deeply nesting.