mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When opening a file for the first time, we don’t store a snapshot for it. This could cause a crash when trying to consult its snapshot to see whether an AST can be reused for cursor info.
23 lines
836 B
Swift
23 lines
836 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %{python} %utils/split_file.py -o %t %s
|
|
|
|
// This used to crash with a nullptr dereference because we didn't store a
|
|
// snapshot in the FileContents of primary.swift when it is opened for the first
|
|
// time but we are trying to access the snapshot when trying determining if we
|
|
// can reuse the AST for the cursor info request
|
|
|
|
// RUN: %sourcekitd-test \
|
|
// RUN: -req=open %t/primary.swift -- %t/primary.swift %t/secondary.swift \
|
|
// RUN: == -req=close %t/primary.swift \
|
|
// RUN: == -req=open %t/primary.swift -- %t/primary.swift \
|
|
// RUN: == -req=cursor -pos 2:8 %t/primary.swift -- %t/primary.swift %t/secondary.swift \
|
|
// RUN: | %FileCheck %s
|
|
|
|
// BEGIN primary.swift
|
|
|
|
struct Foo {}
|
|
// CHECK: source.lang.swift.decl.struct
|
|
// CHECK-NEXT: Foo
|
|
// CHECK-NEXT: s:4main3FooV
|
|
|
|
// BEGIN secondary.swift |