-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add shadowed formal warning to dyno scope resolver (#21614)
This PR adds a warning when a use/import statement brings in a symbol that shadows a function formal. This helps to get the following test working with `--dyno`: test/modules/diten/moduleShadowFormal.chpl While there, I noticed that `--no-warnings` was still causing an "In function" header to be printed, so I also fixed that. The implementation approach here is to add checking in a new query run at the end of `resolveVisibilityStmts` for use/import clauses within functions. Current error messages: ``` $ chpl --dyno --detailed-errors test/modules/diten/moduleShadowFormal.chpl ─── warning in test/modules/diten/moduleShadowFormal.chpl:10 [HiddenFormal] ─── Module-level symbol is hiding function argument 'a' The formal argument: | 9 | proc foo(a: real) { | ⎺⎺⎺⎺⎺⎺⎺⎺ | is shadowed by a symbol provided by the following 'use' statement: | 10 | use M1; | ⎺⎺ | ``` ``` $ chpl --dyno test/modules/diten/moduleShadowFormal.chpl test/modules/diten/moduleShadowFormal.chpl:9: In function 'foo': test/modules/diten/moduleShadowFormal.chpl:10: warning: module-level symbol is hiding function argument 'a' ``` Reviewed by @DanilaFe - thanks! - [x] full local testing - [x] no unexpected failures for `--dyno` testing
- Loading branch information
Showing
9 changed files
with
314 additions
and
49 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.