mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This is a revert of the workaround for creating debug info for error variables
in b2109ab4db, while leaving the test added back then in place. The compiler
is now emitting debug info for the error pattern binding as it's supposed to and
after the recent migration to stricter debug scope generation, there are now
situations where the variable added for the workaround and the correct one are
in conflict.
rdar://108576484
21 lines
705 B
Swift
21 lines
705 B
Swift
// REQUIRES: objc_interop
|
|
// RUN: %target-swift-frontend -emit-sil -Xllvm -sil-print-debuginfo %s \
|
|
// RUN: -parse-as-library | %FileCheck %s
|
|
import Foundation
|
|
|
|
open class Cache<T> {
|
|
let _negativeCache: NSMutableDictionary = NSMutableDictionary()
|
|
func cachedValue(creationBlock: () throws -> T) throws -> T {
|
|
do {
|
|
let value = try creationBlock()
|
|
return value
|
|
} catch {
|
|
// CHECK: debug_value {{.*}} : $any Error, let, name "error", implicit, loc "{{.*}}":[[@LINE-1]]:13, scope [[SCOPE:[0-9]+]]
|
|
// CHECK: alloc_stack $@opened({{.*}}, any Error) Self, loc{{.*}}, scope [[SCOPE]]
|
|
|
|
_negativeCache.setObject(error, forKey: NSNumber(1))
|
|
throw error
|
|
}
|
|
}
|
|
}
|