mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
29 lines
911 B
Swift
29 lines
911 B
Swift
// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
|
|
|
|
class C {}
|
|
|
|
struct A {}
|
|
struct B { var owner: C }
|
|
|
|
var a = A()
|
|
|
|
// CHECK: assign {{%.*}} to {{%.*}} : $*A
|
|
// CHECK: destroy_value {{%.*}} : $B
|
|
(a, _) = (A(), B(owner: C()))
|
|
|
|
class D { var child: C = C() }
|
|
|
|
// Verify that the LHS is formally evaluated before the RHS.
|
|
// CHECK: sil hidden @_T010assignment5test1yyF : $@convention(thin) () -> () {
|
|
func test1() {
|
|
// CHECK: [[CTOR:%.*]] = function_ref @_T010assignment1DC{{[_0-9a-zA-Z]*}}fC
|
|
// CHECK: [[T0:%.*]] = metatype $@thick D.Type
|
|
// CHECK: [[D:%.*]] = apply [[CTOR]]([[T0]])
|
|
// CHECK: [[CTOR:%.*]] = function_ref @_T010assignment1CC{{[_0-9a-zA-Z]*}}fC
|
|
// CHECK: [[T0:%.*]] = metatype $@thick C.Type
|
|
// CHECK: [[C:%.*]] = apply [[CTOR]]([[T0]])
|
|
// CHECK: [[SETTER:%.*]] = class_method [[D]] : $D, #D.child!setter.1
|
|
// CHECK: apply [[SETTER]]([[C]], [[D]])
|
|
D().child = C()
|
|
}
|