diff --git a/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/AllocBoxToStack.swift b/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/AllocBoxToStack.swift index 733c0c3348376..2c64e178cd691 100644 --- a/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/AllocBoxToStack.swift +++ b/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/AllocBoxToStack.swift @@ -261,7 +261,7 @@ private struct FunctionSpecializations { switch apply { case let applyInst as ApplyInst: - let newApply = builder.createApply(function: specializedCallee, applyInst.substitutionMap, arguments: newArgs) + let newApply = builder.createApply(function: specializedCallee, applyInst.substitutionMap, arguments: newArgs, isNonThrowing: applyInst.isNonThrowing) applyInst.replace(with: newApply, context) case let partialAp as PartialApplyInst: let newApply = builder.createPartialApply(function: specializedCallee, substitutionMap: diff --git a/validation-test/SILOptimizer/gh84337.swift b/validation-test/SILOptimizer/gh84337.swift new file mode 100644 index 0000000000000..ea29e12d41258 --- /dev/null +++ b/validation-test/SILOptimizer/gh84337.swift @@ -0,0 +1,38 @@ +// RUN: %target-build-swift -O %s + +@propertyWrapper +public struct Dependency2 { + public init( + _ keyPath: KeyPath + ) { + + } + public var wrappedValue: Value { + let any: Any = "somestring" + return any as! Value + } +} + +struct Client { + var get: (_ id: String) -> Bool +} + +public struct DependencyValues { + var client3: Client +} + +public protocol WindowData2 { + var id :String {get set} +} + +extension WindowData2 { + func didSetProfileForSpaceIDs( + spaceIDs: [String] + ) -> Void { + @Dependency2(\.client3) var client: Client + spaceIDs.forEach { _ in + spaceIDs + .map { _ in return client.get(id) } + } + } +}