-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy pathmove_to_extension.swift
61 lines (44 loc) · 2.06 KB
/
move_to_extension.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
58
59
60
61
// REQUIRES: OS=macosx
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -typecheck %s -emit-tbd -tbd-install_name Foo -emit-tbd-path %t/before_move.tbd -D BEFORE_MOVE -module-name Foo -enable-library-evolution -emit-sil -o %t/before_move.sil
// RUN: %llvm-nm %t/before_move.tbd | %FileCheck %s
// RUN: %FileCheck %s --check-prefix=CHECK-SIL < %t/before_move.sil
// RUN: %target-swift-frontend %s -emit-module -emit-module-path %t/FooCore.swiftmodule -D AFTER_MOVE_FOO_CORE -module-name FooCore -enable-library-evolution
// RUN: %target-swift-frontend -typecheck %s -tbd-install_name Foo -emit-tbd -emit-tbd-path %t/after_move.tbd -D AFTER_MOVE_FOO -module-name Foo -I %t -enable-library-evolution -emit-sil -o %t/after_move.sil
// RUN: %llvm-nm %t/after_move.tbd | %FileCheck %s
// RUN: %FileCheck %s --check-prefix=CHECK-SIL < %t/after_move.sil
// CHECK: _$s3Foo4DateC14getCurrentYearSiyFZ
// CHECK: _$s3Foo9DateValueV4yearACSi_tcfC
// CHECK: _$s3Foo9DateValueV4yearSivg
// CHECK-SIL: sil [available 10.7] @$s3Foo4DateC14getCurrentYearSiyFZ : $@convention(method) (@thick Date.Type) -> Int
// CHECK-SIL: sil [available 10.7] @$s3Foo9DateValueV4yearACSi_tcfC : $@convention(method) (Int, @thin DateValue.Type) -> @out DateValue
// CHECK-SIL: sil [available 10.7] @$s3Foo9DateValueV4yearSivg : $@convention(method) (@in_guaranteed DateValue) -> Int
#if BEFORE_MOVE
@available(OSX 10.7, *)
public class Date {
public static func getCurrentYear() -> Int { return 2020 }
}
@available(OSX 10.7, *)
public struct DateValue {
public init(year: Int) {}
public var year: Int { return 2020 }
}
#endif
#if AFTER_MOVE_FOO_CORE
@available(OSX 10.7, *)
@_originallyDefinedIn(module: "Foo", OSX 10.9)
public class Date {}
@available(OSX 10.7, *)
@_originallyDefinedIn(module: "Foo", OSX 10.9)
public struct DateValue {}
#endif
#if AFTER_MOVE_FOO
@_exported import FooCore
public extension Date {
public static func getCurrentYear() -> Int { return 2020 }
}
public extension DateValue {
public init(year: Int) { self.init(year: 2020) }
public var year: Int { return 2020 }
}
#endif