forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextensions.swift
41 lines (32 loc) · 994 Bytes
/
extensions.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
// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
class Foo {
// CHECK-LABEL: sil hidden @_TFC10extensions3Foo3zim
func zim() {}
}
extension Foo {
// CHECK-LABEL: sil hidden @_TFC10extensions3Foo4zang
func zang() {}
// CHECK-LABEL: sil hidden @_TFC10extensions3Foog7zippitySi
var zippity: Int { return 0 }
}
struct Bar {
// CHECK-LABEL: sil hidden @_TFV10extensions3Bar4zung
func zung() {}
}
extension Bar {
// CHECK-LABEL: sil hidden @_TFV10extensions3Bar4zoom
func zoom() {}
}
// CHECK-LABEL: sil hidden @_TF10extensions19extensionReferencesFCS_3FooT_
func extensionReferences(x: Foo) {
// Non-objc extension methods are statically dispatched.
// CHECK: function_ref @_TFC10extensions3Foo4zang
x.zang()
// CHECK: function_ref @_TFC10extensions3Foog7zippitySi
_ = x.zippity
}
func extensionMethodCurrying(x: Foo) {
_ = x.zang
}
// CHECK-LABEL: sil shared @_TFC10extensions3Foo4zang
// CHECK: function_ref @_TFC10extensions3Foo4zang