mirror of
https://github.com/apple/swift.git
synced 2026-10-28 21:15:56 +01:00
Setting a SourceLoc for a brace of a nominal type is used to indicate that we should attempt to parse members for it. Avoid doing this in synthesized cases since we supply the members directly. Instead, make the SourceRange computation resilient to missing brace locations. This avoids a crash when attempting to do cached code completion in cases where there are nested local types that synthesize nominals such as CodingKeys.
25 lines
618 B
Swift
25 lines
618 B
Swift
struct A {
|
|
var x: Int? {
|
|
|
|
struct B: Codable {
|
|
static func f() -> X
|
|
}
|
|
|
|
// Make sure the synthesized CodingKeys does not crash by triggering parsing in
|
|
// the replaced function body buffer when re-using AST.
|
|
|
|
// RUN: %sourcekitd-test \
|
|
// RUN: -req=complete -pos=5:22 %s -- %s == \
|
|
// RUN: -req=complete -pos=5:22 %s -- %s | %FileCheck %s
|
|
|
|
// CHECK-LABEL: key.results: [
|
|
// CHECK-DAG: key.name: "A"
|
|
// CHECK-DAG: key.name: "B"
|
|
// CHECK-DAG: key.name: "Self"
|
|
|
|
// CHECK-LABEL: key.results: [
|
|
// CHECK-DAG: key.name: "A"
|
|
// CHECK-DAG: key.name: "B"
|
|
// CHECK-DAG: key.name: "Self"
|
|
// CHECK: key.reusingastcontext: 1
|