Files
swift-mirror/test/SILOptimizer/opaque_values_O_resilient.swift
Nate Chandler 80e0bfce30 [AddressLowering] ParamDecl's context falls back.
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.
2022-11-16 17:14:23 -08:00

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
}
}