mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Unfortunately due to pre-checking multiple times the recorded application level can change. Just OR the bits together.
43 lines
892 B
Swift
43 lines
892 B
Swift
// RUN: %batch-code-completion
|
|
|
|
// https://github.com/apple/swift/issues/75845
|
|
// Make sure we don't crash.
|
|
|
|
struct Foo {
|
|
init() {
|
|
do {
|
|
} catch {
|
|
#^A^#self#^B^# = #^C^#error#^D^#
|
|
}
|
|
}
|
|
}
|
|
// A: Decl[LocalVar]/Local: error[#any Error#]; name=error
|
|
// B: Begin completions
|
|
// C: Decl[LocalVar]/Local: error[#any Error#]; name=error
|
|
// D: Begin completions
|
|
|
|
enum E {
|
|
case e(Error)
|
|
|
|
func foo() {
|
|
var x = self
|
|
do {
|
|
} catch {
|
|
x = .e(error)#^E^#
|
|
// E: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: .foo()[#Void#]; name=foo()
|
|
}
|
|
}
|
|
|
|
static func bar() {
|
|
do {
|
|
} catch {
|
|
_ = foo(.e(error))#^F^#
|
|
// F: Decl[InstanceMethod]/CurrNominal/Flair[ArgLabels]: ()[#Void#]; name=()
|
|
|
|
_ = foo(.e(error))()#^G^#
|
|
// G: Begin completions, 1 items
|
|
// G: Keyword[self]/CurrNominal: .self[#Void#]; name=self
|
|
}
|
|
}
|
|
}
|