Files
swift-mirror/test/SILGen/objc_final.swift
Joe Groff c0a2994564 AST: Start printing function types with @convention instead of old attributes.
And update tests to match.

Swift SVN r27262
2015-04-13 22:51:34 +00:00

31 lines
1.0 KiB
Swift

// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen -emit-verbose-sil | FileCheck %s
// REQUIRES: objc_interop
import Foundation
final class Foo {
@objc func foo() {}
// CHECK-LABEL: sil hidden @_TToFC10objc_final3Foo3foofS0_FT_T_ : $@convention(objc_method) (Foo) -> ()
@objc var prop: Int = 0
// CHECK-LABEL: sil hidden [transparent] @_TToFC10objc_final3Foog4propSi
// CHECK-LABEL: sil hidden [transparent] @_TToFC10objc_final3Foos4propSi
}
// CHECK-LABEL: sil hidden @_TF10objc_final7callFooFCS_3FooT_
func callFoo(x: Foo) {
// Calls to the final @objc method statically reference the native entry
// point.
// CHECK: function_ref @_TFC10objc_final3Foo3foofS0_FT_T_
x.foo()
// Final @objc properties are still accessed directly.
// CHECK: [[PROP:%.*]] = ref_element_addr {{%.*}} : $Foo, #Foo.prop
// CHECK: load [[PROP]] : $*Int
let prop = x.prop
// CHECK: [[PROP:%.*]] = ref_element_addr {{%.*}} : $Foo, #Foo.prop
// CHECK: assign {{%.*}} to [[PROP]] : $*Int
x.prop = prop
}