- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathnewtype.swift
54 lines (42 loc) · 3.08 KB
/
newtype.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Please keep this file in alphabetical order!
// REQUIRES: objc_interop
// RUN: %empty-directory(%t)
// FIXME: BEGIN -enable-source-import hackaround
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/ObjectiveC.swift -disable-objc-attr-requires-foundation-module
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/CoreGraphics.swift
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/Foundation.swift
// FIXME: END -enable-source-import hackaround
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/newtype.h -emit-module -o %t %s
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/newtype.h -parse-as-library %t/newtype.swiftmodule -typecheck -verify -emit-objc-header-path %t/newtype.h
// RUN: %FileCheck %s < %t/newtype.h
// RUN: %check-in-clang %t/newtype.h
// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/newtype.h
import Foundation
// CHECK-LABEL: @interface TestEnumLike : NSObject
classTestEnumLike:NSObject{
// CHECK: - (void)takesNewtype:(EnumLikeStringWrapper _Nonnull)a;
@objcfunc takesNewtype(_ a:EnumLikeStringWrapper){}
// CHECK: - (void)takesNewtypeArray:(NSArray<EnumLikeStringWrapper> * _Nonnull)a;
@objcfunc takesNewtypeArray(_ a:[EnumLikeStringWrapper]){}
// CHECK: - (void)takesNewtypeDictionary:(NSDictionary<EnumLikeStringWrapper, EnumLikeStringWrapper> * _Nonnull)a;
@objcfunc takesNewtypeDictionary(_ a:[EnumLikeStringWrapper:EnumLikeStringWrapper]){}
// CHECK: - (void)takesNewtypeOptional:(EnumLikeStringWrapper _Nullable)a;
@objcfunc takesNewtypeOptional(_ a:EnumLikeStringWrapper?){}
}
// CHECK: @end
// CHECK-LABEL: @interface TestStructLike : NSObject
classTestStructLike:NSObject{
// CHECK: - (void)takesNewtype:(StructLikeStringWrapper _Nonnull)a;
@objcfunc takesNewtype(_ a:StructLikeStringWrapper){}
// CHECK: - (void)takesNewtypeArray:(NSArray<StructLikeStringWrapper> * _Nonnull)a;
@objcfunc takesNewtypeArray(_ a:[StructLikeStringWrapper]){}
// CHECK: - (void)takesNewtypeDictionary:(NSDictionary<StructLikeStringWrapper, StructLikeStringWrapper> * _Nonnull)a;
@objcfunc takesNewtypeDictionary(_ a:[StructLikeStringWrapper:StructLikeStringWrapper]){}
// CHECK: - (void)takesNewtypeOptional:(StructLikeStringWrapper _Nullable)a;
@objcfunc takesNewtypeOptional(_ a:StructLikeStringWrapper?){}
// CHECK: - (void)takesNewtypeObjectDictionary:(NSDictionary<StructLikeObjectWrapper, StructLikeObjectWrapper> * _Nonnull)a;
@objcfunc takesNewtypeObjectDictionary(_ a:[StructLikeObjectWrapper:StructLikeObjectWrapper]){}
// CHECK: - (void)takesNewtypeErrorArray:(NSArray<StructLikeErrorWrapper> * _Nonnull)a;
@objcfunc takesNewtypeErrorArray(_ a:[StructLikeErrorWrapper]){}
}
// CHECK: @end