-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathmixed-target-using-header.swift
57 lines (44 loc) · 1.32 KB
/
mixed-target-using-header.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
54
55
56
57
// RUN: %swift %clang-importer-sdk -target x86_64-apple-macosx10.9 -I %S/../Inputs/custom-modules -import-objc-header %S/Inputs/mixed-target/header.h -parse %s -verify
func test(foo : FooProto) {
let _: CInt = foo.bar
let _: CInt = ExternIntX.x
}
@objc class ForwardClass : NSObject {
}
@objc protocol ForwardProto : NSObjectProtocol {
}
@objc class ForwardProtoAdopter : NSObject, ForwardProto {
}
@objc class PartialBaseClass {
}
@objc class PartialSubClass : NSObject {
}
func testCFunction() {
doSomething(ForwardClass())
doSomethingProto(ForwardProtoAdopter())
doSomethingPartialBase(PartialBaseClass())
doSomethingPartialSub(PartialSubClass())
}
class ProtoConformer : ForwardClassUser {
func consumeForwardClass(arg: ForwardClass) {}
var forward = ForwardClass()
}
func testProtocolWrapper(conformer: ForwardClassUser) {
conformer.consumeForwardClass(conformer.forward)
}
testProtocolWrapper(ProtoConformer())
func testStruct(p: Point) -> Point {
var result = p
result.y += 5
return result
}
func testSuppressed() {
let _: __int128_t? = nil // expected-error{{use of undeclared type '__int128_t'}}
}
func testMacro() {
let _: CInt = CONSTANT
}
func testFoundationOverlay() {
let utf8 = NSUTF8StringEncoding // no ambiguity
let _: UInt = NSUTF8StringEncoding // and we should get the overlay version
}