mirror of
https://github.com/apple/swift.git
synced 2026-11-30 09:15:01 +01:00
Add a regression test for a recently fixed compiler crash. Resolves https://github.com/swiftlang/swift/issues/89962 rdar://179727895
32 lines
769 B
Swift
32 lines
769 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: split-file %s %t
|
|
|
|
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library -O
|
|
// RUN: %target-swift-frontend -c -I %t %t/Main.swift -enable-experimental-feature Embedded -O -o /dev/null
|
|
|
|
// REQUIRES: OS=macosx || OS=linux-gnu || OS=wasip1
|
|
// REQUIRES: swift_feature_Embedded
|
|
|
|
//--- MyModule.swift
|
|
|
|
public struct ParseContainerStack {
|
|
var stack: [Int] = [0]
|
|
public init() {}
|
|
public mutating func run() {
|
|
let i = stack.first
|
|
if let i {
|
|
_ = i
|
|
for _ in 0..<stack.count { }
|
|
}
|
|
}
|
|
}
|
|
|
|
//--- Main.swift
|
|
|
|
import MyModule
|
|
|
|
public func test() {
|
|
var s = ParseContainerStack()
|
|
s.run()
|
|
}
|