-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't look for near-miss witnesses for unavailable requirements. (#2604)
We use unavailable requirements as migration hints, but conformance checking would try a little too hard to actually satisfy them, even though they wouldn't actually be used. This led to errors about the /new/ name not matching the /old/ name. (We now get /two/ diagnostics for using the old name, but we can fix that later. Filed rdar://problem/26358593.) rdar://problem/26313044 (cherry picked from commit e003e5e)
- Loading branch information
1 parent
df3b4d9
commit eac62a4
Showing
3 changed files
with
37 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@import ObjectiveC; | ||
|
||
@interface Foo : NSObject | ||
@end | ||
|
||
@protocol FooDelegate | ||
- (void)foo:(Foo *)foo willConsumeObject:(id)obj __attribute__((swift_name("foo(_:willConsume:)"))); | ||
@end | ||
|
||
@protocol OptionalButUnavailable | ||
@optional | ||
- (void)doTheThing:(id)thingToDoItWith __attribute__((unavailable)); | ||
@end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RUN: %target-swift-frontend -parse -import-objc-header %S/Inputs/protocol-member-renaming.h -verify %s | ||
|
||
// REQUIRES: objc_interop | ||
|
||
class Modern : NSObject, FooDelegate { | ||
func foo(_ foo: Foo, willConsume object: AnyObject) {} | ||
} | ||
|
||
class PreMigration : NSObject, FooDelegate { | ||
func foo(_ foo: Foo, willConsumeObject object: AnyObject) {} | ||
// expected-error@-1 {{'foo(_:willConsumeObject:)' has been renamed to 'foo(_:willConsume:)'}} {{24-41=willConsume}} | ||
// expected-error@-2 {{method 'foo(_:willConsumeObject:)' has different argument names from those required by protocol 'FooDelegate' ('foo(_:willConsume:)')}} {{24-41=willConsume}} | ||
} | ||
|
||
class OptionalButUnavailableImpl : OptionalButUnavailable { | ||
// Note the argument label that causes this not to match the requirement. | ||
func doTheThing(object: AnyObject) {} // no-warning | ||
} |