// RUN: %target-swift-frontend -g -Xllvm -sil-print-types -emit-sil %s -parse-as-library -module-name a | %FileCheck %s // RUN: %target-swift-frontend -g -Xllvm -sil-print-types -emit-sil %s -parse-as-library -module-name a -enable-upcoming-feature ImmutableWeakCaptures | %FileCheck %s --check-prefixes=CHECK,CHECK-HAS-WEAK-LET // REQUIRES: swift_feature_ImmutableWeakCaptures open class C { public func run() { { [weak self] in guard let self else { fatalError("cannot happen") } // CHECK: sil_scope [[LAMBDA:[0-9]+]] { loc "{{.*}}":6:5 // CHECK: sil_scope [[LET:[0-9]+]] { loc "{{.*}}":7:7 parent [[LAMBDA]] // CHECK-HAS-WEAK-LET: sil_scope [[TMP:[0-9]+]] { loc "{{.*}}":7:17 parent [[LET]] // CHECK: sil_scope [[GUARD:[0-9]+]] { loc "{{.*}}":7:17 parent [[LET]] // CHECK: debug_value {{.*}} : $C, let, name "self", {{.*}}, scope [[GUARD]] // CHECK: function_ref {{.*}}3fun{{.*}}, scope [[GUARD]] // CHECK-NEXT: apply {{.*}}, scope [[GUARD]] self.fun() }() } public func fun() {} }