mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When address lowering rewrites a return to use an indirect convention, it creates a ParamDecl, using the function's decl context. Some functions, such as default argument getters, don't have such contexts, though. In such cases, fall back to module as decl context.
20 lines
762 B
Swift
20 lines
762 B
Swift
// RUN: %target-swift-frontend -enable-sil-opaque-values -parse-as-library -emit-sil -O -enable-library-evolution %s | %FileCheck %s
|
|
|
|
public struct Gadget {
|
|
// Verify the default accessor's arguments. When AccessPathVerification runs,
|
|
// it will be checked that the ParamDecl that AddressLowering synthesizes has a
|
|
// non-null decl context.
|
|
// CHECK-LABEL: sil @$s25opaque_values_O_resilient6GadgetV5whichA2C5WhichO_tcfC : {{.*}} {
|
|
// CHECK: bb0(%0 : $*Gadget, %1 : $*Gadget.Which, %2 : $@thin Gadget.Type):
|
|
// CHECK-LABEL: } // end sil function '$s25opaque_values_O_resilient6GadgetV5whichA2C5WhichO_tcfC'
|
|
public init(which: Which = .that) {
|
|
fatalError()
|
|
}
|
|
|
|
public enum Which {
|
|
case that
|
|
case this(() -> Gadget)
|
|
case theOther
|
|
}
|
|
}
|