mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Adds a new 'key.retrieve_symbol_graph' option to the request. When set to 1 it includes the JSON for a SymbolGraph containing a single node for the symbol at the requested position. This also extends the SymbolGraph library with a new entry point to get a graph for a single symbol, and to additionally support type substitution to match the existing CursorInfo behavior (e.g. so that when invoked on `first` in `Array<Int>().first`, the type is given as `Int?` rather than `Element?`). Resolves rdar://problem/70551509
41 lines
1.3 KiB
Swift
41 lines
1.3 KiB
Swift
protocol Target1 {}
|
|
protocol Target2 {}
|
|
protocol Target3 {}
|
|
|
|
struct ConcreteTarget1 : Target1 {}
|
|
struct ConcreteTarget2 : Target2 {}
|
|
struct ConcreteTarget3 : Target3 {}
|
|
|
|
protocol P {
|
|
associatedtype Assoc
|
|
func protocolMethod(asc: Assoc) -> Self
|
|
}
|
|
extension P {
|
|
func protocolMethod(asc: Assoc) -> Self { return self }
|
|
}
|
|
|
|
class C : P {
|
|
typealias Assoc = String
|
|
static func staticMethod() -> Self {}
|
|
func instanceMethod(x: Int) -> C {}
|
|
func methodForTarget1() -> ConcreteTarget1 {}
|
|
func methodForTarget2() -> ConcreteTarget2 {}
|
|
}
|
|
|
|
func testing(obj: C) {
|
|
let _ = obj.
|
|
}
|
|
|
|
// RUN: %sourcekitd-test \
|
|
// RUN: -req=conformingmethods -pos=26:14 -repeat-request=2 %s -req-opts=expectedtypes='[$s8MyModule7Target2PD;$s8MyModule7Target1PD]' -- -module-name MyModule %s > %t.response
|
|
// RUN: %diff -u %s.response %t.response
|
|
// RUN: %sourcekitd-test \
|
|
// RUN: -req=global-config -req-opts=completion_max_astcontext_reuse_count=0 == \
|
|
// RUN: -req=conformingmethods -pos=26:14 -repeat-request=2 %s -req-opts=expectedtypes='[$s8MyModule7Target2PD;$s8MyModule7Target1PD]' -- -module-name MyModule %s | %FileCheck %s --check-prefix=DISABLED
|
|
|
|
// DISABLED-NOT: key.reuseastcontext
|
|
// DISABLED: key.members: [
|
|
// DISABLED-NOT: key.reuseastcontext
|
|
// DISABLED: key.members: [
|
|
// DISABLED-NOT: key.reuseastcontext
|