mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Specifically, CaptureInfo previously as a pattern in CaptureInfo.cpp would attempt to ascertain if a CapturedValue was a local capture by checking the CapturedValue's decl. Unfortunately, when we have captured dynamic self metadata, we do not even have a getDecl() and should return false. I fixed this by adding a new API to CaptureValue that checks if it has a decl before checking if the decl is a local capture. This avoids this problem.
22 lines
707 B
Swift
22 lines
707 B
Swift
// RUN: %target-swift-frontend -o - -emit-silgen %s
|
|
|
|
// REQUIRES: concurrency
|
|
|
|
// READ THIS! This test is meant to test invariants around CaptureInfo usage in
|
|
// SILGen. Only add examples to this if we hit a crasher in capture info and the
|
|
// example makes sure we do not crash again.
|
|
|
|
class GetIsolatedParamTest {
|
|
public static var rootType: Any.Type? { nil }
|
|
}
|
|
|
|
extension GetIsolatedParamTest : CustomDebugStringConvertible {
|
|
public var debugDescription: String {
|
|
let description = "\\\(String(describing: Self.rootType!))"
|
|
let x: Any.Type? = nil
|
|
// The error is triggered by the ?? autoclosure.
|
|
var valueType: Any.Type? = x ?? Self.rootType
|
|
return description
|
|
}
|
|
}
|