You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Omit needless words] Ensure Swift name consistency for overriding/overridden decalrations.
When we transform an Objective-C method or property name, we take into
account the parameter types, result type, and type of the enclosing
context. Doing so means that one can get different Swift names for a
particular method (or property) and one that overrides it, which leads
to dangerous inconsistencies in the Swift names. Address this
limitation by using the original declaration's name (i.e., one that
does not override any other).
It is possible that there is more than one "original declaration",
when the same method/property name comes from different
protocols. When this is the case, check for consistency and complain
if there are inconsistencies.
Amusingly, this changes exactly one method in Cocoa
(UINavigationController's showViewController:sender:), with no conflicts
detected. Fixes rdar://problem/24558337.
// Verify that we get the Swift name from the original declaration.
313
+
// CHECK-OMIT-NEEDLESS-WORDS: protocol OMWWiggle
314
+
// CHECK-OMIT-NEEDLESS-WORDS-NEXT: func joinSub()
315
+
// CHECK-OMIT-NEEDLESS-WORDS-NEXT: func wiggle1()
316
+
// CHECK-OMIT-NEEDLESS-WORDS-NEXT: var wiggleProp1: Int { get }
317
+
318
+
// CHECK-OMIT-NEEDLESS-WORDS: protocol OMWWaggle
319
+
// CHECK-OMIT-NEEDLESS-WORDS-NEXT: func waggle1()
320
+
// CHECK-OMIT-NEEDLESS-WORDS-NEXT: var waggleProp1: Int { get }
321
+
322
+
// CHECK-OMIT-NEEDLESS-WORDS: class OMWSuper
323
+
// CHECK-OMIT-NEEDLESS-WORDS-NEXT: func jump()
324
+
// CHECK-OMIT-NEEDLESS-WORDS-NEXT: var wiggleProp1: Int { get }
325
+
326
+
// CHECK-OMIT-NEEDLESS-WORDS: class OMWSub
327
+
// CHECK-OMIT-NEEDLESS-WORDS-NEXT: func jump()
328
+
// CHECK-OMIT-NEEDLESS-WORDS-NEXT: func joinSub()
329
+
330
+
// CHECK-OMIT-NEEDLESS-WORDS-DIAGS: inconsistent Swift name for Objective-C method 'conflicting1' in 'OMWSub' ('waggle1()' in 'OMWWaggle' vs. 'wiggle1()' in 'OMWWiggle')
331
+
// CHECK-OMIT-NEEDLESS-WORDS-DIAGS: inconsistent Swift name for Objective-C property 'conflictingProp1' in 'OMWSub' ('waggleProp1' in 'OMWWaggle' vs. 'wiggleProp1' in 'OMWSuper')
0 commit comments