Files
swift-mirror/test/SourceKit/CursorInfo/cursor_nested_extension.swift
Ben Barham ab55c19b44 [IDE] Propagate the Stmt visit failure while walking TopLevelCodeDecls
`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
2021-03-06 11:45:11 +10:00

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