Files
swift-mirror/test/DebugInfo/generic-specializer.swift
Arnold Schwaighofer 2bc8ad27e3 GenericCloner: Generate a valid debug location if no decl is available for a SILArgument
Without this we used to crash in a test case in IRGen trying to generate code
for an invalid debug location.

rdar://87565600
2022-01-18 14:04:56 -08:00

33 lines
712 B
Swift

// RUN: %target-swift-frontend %s -O -enable-library-evolution -emit-ir -g
// REQUIRES: objc_interop
import Foundation
public struct MyThing {}
public struct ThingSequence: Sequence, IteratorProtocol {
private var enumerator: NSEnumerator?
public init() { }
public mutating func next() -> MyThing? {
guard let enumerator = enumerator else { return nil }
guard let nextObject = enumerator.nextObject(),
let nextThing = nextObject as? MyThing else {
self.enumerator = nil
return nil
}
return nextThing
}
}
public struct Manager {
public func sequence() -> ThingSequence {
ThingSequence()
}
}
public func test(m: Manager) {
for _ in m.sequence() { }
}