Skip to content
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

[ObjC] Name lookup in methods shouldn't allow shadowing types #9748

Open
wants to merge 1 commit into
base: swift/release/6.1
Choose a base branch
from

Conversation

krispymb
Copy link

Arguably as a bug, Clang has previously not mixed up Objective-C parameter names with types. This allows developers to write parameter names that should shadow type names, but don't. For instance:

@interface Foo
-(void)foo:(int)id bar:(id)name; // OK
@end

Commit 9778808 changed the way that parameters are parsed to bring it more in line with how C parameters are parsed, but it breaks the example above. Given an expectation that the change wouldn't introduce source breaks, this is not something we can go forward with.

977880... did this so that late-parsed attributes could reference Objective-C parameters. This change buffers Objective-C parameter info until after all parameters are parsed and turns them into parameter declarations before realizing late-parsed attributes instead.

Radar-ID: 139996306
(cherry picked from commit d8c7c55)

Arguably as a bug, Clang has previously not mixed up Objective-C
parameter names with types. This allows developers to write
parameter names that _should_ shadow type names, but don't. For
instance:

    @interface Foo
    -(void)foo:(int)id bar:(id)name; // OK
    @EnD

Commit 9778808 changed the way
that parameters are parsed to bring it more in line with how C
parameters are parsed, but it breaks the example above. Given an
expectation that the change wouldn't introduce source breaks, this
is not something we can go forward with.

977880... did this so that late-parsed attributes could reference
Objective-C parameters. This change buffers Objective-C parameter
info until after all parameters are parsed and turns them into
parameter declarations before realizing late-parsed attributes
instead.

Radar-ID: 139996306
(cherry picked from commit d8c7c55)
@krispymb krispymb requested a review from a team as a code owner December 15, 2024 01:18
@krispymb
Copy link
Author

@swift-ci please test llvm

@krispymb
Copy link
Author

@swift-ci test

@krispymb
Copy link
Author

Cherry-pick of #9632

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