mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
`visitTopLevelCodeDecl` ignored the `Stmt` visit returning a nullptr. This caused the `walkToDeclPost` to run for the `TopLevelCodeDecl` and thus an imbalance in the `RangeResolver` pre and posts (since none of the children would have their `walkTo*Post` called). This was originally incorrectly fixed while assuming that the `walkTo*Post` are called regardless of whether the children were visited or not. Those changes have been reverted - fixing an imbalance in `ExtDecls` in `SemaAnnotator`. Added a test case for the `ExtDecls` imbalance which can occur while an extension is being added. Resolves rdar://74820040
19 lines
486 B
Swift
19 lines
486 B
Swift
struct Foo {}
|
|
struct Bar {}
|
|
|
|
extension Foo {
|
|
|
|
extension Bar {
|
|
}
|
|
|
|
func someFunc() {}
|
|
|
|
// Closing brace for extension Foo intentionally left off, user is in the
|
|
// process of adding the extension
|
|
|
|
// This check is mostly to make sure we don't crash with an assertion -
|
|
// extensions are pushed and popped in an AST walk pre/post and they need to
|
|
// match up.
|
|
// RUN: %sourcekitd-test -req=cursor -pos=9:6 %s -- %s | %FileCheck %s
|
|
// CHECK: source.lang.swift.decl.function.method.instance
|