Files
swift-mirror/test/SILOptimizer/optimize_keypath_bug.swift
Meghana Gupta 367b5fe03e Invalidate stack nesting in keypath silcombine
KeyPathProjector creates alloc_stack and dealloc_stack for temporaries.
Insertion of new dealloc_stack can modify stack discipline.

Invalidate stack nesting so that it can be fixed up in the pass.
2023-12-13 15:22:35 -08:00

31 lines
817 B
Swift

// RUN: %target-swift-frontend -emit-sil -O -enable-ossa-modules -sil-verify-all %s
// REQUIRES: OS=macosx
import Foundation
// Check the following test does not crash with incorrect stack order
open class DateFormatter {
typealias CFType = CFDateFormatter
open func copy(with zone: NSZone? = nil) -> Any {
let copied = DateFormatter()
func __copy<T>(_ keyPath: ReferenceWritableKeyPath<DateFormatter, T>) {
copied[keyPath: keyPath] = self[keyPath: keyPath]
}
__copy(\.formattingContext)
return copied
}
public enum Context : Int {
case unknown
case dynamic
case standalone
case listItem
case beginningOfSentence
case middleOfSentence
}
open var formattingContext: Context = .unknown
}