Files
swift-mirror/test/SILGen/closure_self_recursion.swift
Slava Pestov 94ce4c2ac3 SIL: Only give closures shared linkage if they're going to be serialized
Otherwise, we don't want them to be linkonce_odr at the LLVM level
to avoid unnecessary link-time overhead.
2017-03-31 20:26:27 -07:00

17 lines
701 B
Swift

// RUN: %target-swift-frontend -module-name foo -emit-silgen %s | %FileCheck %s
// RUN: %target-swift-frontend -module-name foo -emit-sil -verify %s
// CHECK-LABEL: sil @main
// CHECK-LABEL: sil private @_T03foo5recuryycfgyycfU_
var recur : () -> () {
// CHECK-LABEL: function_ref @_T03foo5recuryycfg
return { recur() } // expected-warning {{attempting to access 'recur' within its own getter}}
}
// CHECK-LABEL: sil private @_T03foo12recur_harderyycyyccfgyycyyccfU_
var recur_harder : (() -> ()) -> (() -> ()) {
// CHECK-LABEL: function_ref @_T03foo12recur_harderyycyyccfg
return { f in recur_harder(f) } // expected-warning {{attempting to access 'recur_harder' within its own getter}}
}