Skip to content

Sema: Ban shadowing generic parameters from outer scopes #65400

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

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

slavapestov
Copy link
Contributor

Code like that is usually indicative of programmer error, and does not round-trip through module interface files since there is no source syntax to refer to an outer generic parameter.

For source compatibility this is a warning, but becomes an error with -swift-version 6.

Fixes rdar://problem/108385980 and #62767.

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a test for this changes?

@slavapestov
Copy link
Contributor Author

@xedin Yep, I forgot to git add the file :)

@slavapestov slavapestov force-pushed the generic-param-shadowing branch from a0b2fc6 to a005cf1 Compare April 25, 2023 20:30
@xedin
Copy link
Contributor

xedin commented Apr 25, 2023

I figured as much :)

@slavapestov slavapestov force-pushed the generic-param-shadowing branch from a005cf1 to d633ec9 Compare April 25, 2023 20:36
@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

Code like that is usually indicative of programmer error, and does not
round-trip through module interface files since there is no source
syntax to refer to an outer generic parameter.

For source compatibility this is a warning, but becomes an error with
-swift-version 6.

Fixes rdar://problem/108385980 and swiftlang#62767.
@slavapestov slavapestov force-pushed the generic-param-shadowing branch from d633ec9 to 290701c Compare April 26, 2023 02:21
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit dd0531e into swiftlang:main Apr 26, 2023
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.

2 participants