Skip to content

Commit ba230e0

Browse files
committed
[ClangImporter] Add tests for generic compatibility typealiases.
The implementation here is pretty slapdash, and I'm about to do something safer, but it seems to be working now and I don't want to break it.
1 parent 730b80a commit ba230e0

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

test/APINotes/Inputs/custom-frameworks/APINotesFrameworkTest.framework/Headers/APINotesFrameworkTest.apinotes

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ SwiftVersions:
8686
SwiftImportAsAccessors: true
8787
- Name: NewlyGenericSub
8888
SwiftImportAsNonGeneric: true
89+
- Name: RenamedGeneric
90+
SwiftName: OldRenamedGeneric
8991
Protocols:
9092
- Name: ProtoWithVersionedUnavailableMember
9193
Methods:

test/APINotes/Inputs/custom-frameworks/APINotesFrameworkTest.framework/Headers/Classes.h

+3
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
+ (Element)defaultElement;
66
@end
77

8+
@interface RenamedGeneric<Element: Base *> : Base
9+
@end
10+
811
#pragma clang assume_nonnull end
912
#endif // __OBJC__

test/APINotes/versioned-objc.swift

+20
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,24 @@ func testNonGeneric() {
2323
// CHECK-DIAGS-4:[[@LINE-1]]:{{[0-9]+}}: error: cannot convert value of type 'Base' to specified type 'Int'
2424
}
2525

26+
func testRenamedGeneric() {
27+
// CHECK-DIAGS-3:[[@LINE+1]]:{{[0-9]+}}: error: 'RenamedGeneric' has been renamed to 'OldRenamedGeneric'
28+
let _: OldRenamedGeneric<Base> = RenamedGeneric<Base>()
29+
// FIXME-DIAGS-4:[[@LINE-1]]:{{[0-9]+}}: error: 'OldRenamedGeneric' has been renamed to 'RenamedGeneric'
30+
31+
// FIXME-DIAGS-3:[[@LINE+1]]:{{[0-9]+}}: error: 'RenamedGeneric' has been renamed to 'OldRenamedGeneric'
32+
let _: RenamedGeneric<Base> = OldRenamedGeneric<Base>()
33+
// CHECK-DIAGS-4:[[@LINE-1]]:{{[0-9]+}}: error: 'OldRenamedGeneric' has been renamed to 'RenamedGeneric'
34+
35+
class SwiftClass {}
36+
37+
// CHECK-DIAGS-3:[[@LINE+1]]:{{[0-9]+}}: error: 'OldRenamedGeneric' requires that 'SwiftClass' inherit from 'Base'
38+
let _: OldRenamedGeneric<SwiftClass> = RenamedGeneric<SwiftClass>()
39+
// CHECK-DIAGS-4:[[@LINE-1]]:{{[0-9]+}}: error: 'OldRenamedGeneric' requires that 'SwiftClass' inherit from 'Base'
40+
41+
// CHECK-DIAGS-3:[[@LINE+1]]:{{[0-9]+}}: error: 'RenamedGeneric' requires that 'SwiftClass' inherit from 'Base'
42+
let _: RenamedGeneric<SwiftClass> = OldRenamedGeneric<SwiftClass>()
43+
// CHECK-DIAGS-4:[[@LINE-1]]:{{[0-9]+}}: error: 'RenamedGeneric' requires that 'SwiftClass' inherit from 'Base'
44+
}
45+
2646
let unrelatedDiagnostic: Int = nil

0 commit comments

Comments
 (0)