mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add InternalDiagnostic to CursorInfoData and NameTranslatingInfo
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
// RUN: not %sourcekitd-test -req=track-compiles == -req=cursor %s -offset=0 -- %s 2>&1 | %FileCheck %s -check-prefix=COMPILE_1 -dump-input-on-failure
|
// RUN: %sourcekitd-test -req=track-compiles == -req=cursor %s -offset=0 -- %s | %FileCheck %s -check-prefix=COMPILE_1
|
||||||
// COMPILE_1: error response (Request Failed): Unable to resolve cursor info.
|
|
||||||
// COMPILE_1: {
|
// COMPILE_1: {
|
||||||
// COMPILE_1: key.notification: source.notification.compile-will-start,
|
// COMPILE_1: key.notification: source.notification.compile-will-start,
|
||||||
// COMPILE_1: key.filepath: "SOURCE_DIR{{.*}}cursor-info.swift",
|
// COMPILE_1: key.filepath: "SOURCE_DIR{{.*}}cursor-info.swift",
|
||||||
@@ -9,5 +8,6 @@
|
|||||||
// COMPILE_1: key.notification: source.notification.compile-did-finish,
|
// COMPILE_1: key.notification: source.notification.compile-did-finish,
|
||||||
// COMPILE_1: key.compileid: [[CID1]]
|
// COMPILE_1: key.compileid: [[CID1]]
|
||||||
// COMPILE_1: }
|
// COMPILE_1: }
|
||||||
|
// COMPILE_1: <diagnostic "Unable to resolve cursor info.">
|
||||||
// COMPILE_1-NOT: compile-will-start
|
// COMPILE_1-NOT: compile-will-start
|
||||||
// COMPILE_1-NOT: compile-did-finish
|
// COMPILE_1-NOT: compile-did-finish
|
||||||
|
|||||||
@@ -7,18 +7,18 @@ struct S1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Checks that we don't crash.
|
// Checks that we don't crash.
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=1:15 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=1:15 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=1:17 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=1:17 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=2:15 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=2:15 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=2:17 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=2:17 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=2:21 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=2:21 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=2:23 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=2:23 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=3:15 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=3:15 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=3:17 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=3:17 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=3:21 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=3:21 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=3:23 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=3:23 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=3:37 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=3:37 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=3:41 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=3:41 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=6:29 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=6:29 %s -- %s | %FileCheck %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=6:31 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=6:31 %s -- %s | %FileCheck %s
|
||||||
// CHECK: (Request Failed): Unable to resolve cursor info
|
// CHECK: <diagnostic "Unable to resolve cursor info.">
|
||||||
|
|||||||
@@ -378,18 +378,18 @@ enum E7: String {
|
|||||||
// CHECK22: <Declaration>func availabilityIntroduced()</Declaration>
|
// CHECK22: <Declaration>func availabilityIntroduced()</Declaration>
|
||||||
// CHECK22: <decl.function.method.instance><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>availabilityIntroduced</decl.name>()</decl.function.method.instance>
|
// CHECK22: <decl.function.method.instance><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>availabilityIntroduced</decl.name>()</decl.function.method.instance>
|
||||||
|
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=56:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s 2>&1 | %FileCheck -check-prefix=CHECK23 %s
|
// RUN: %sourcekitd-test -req=cursor -pos=56:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK23 %s
|
||||||
// CHECK23: (Request Failed): Unavailable in the current compilation context
|
// CHECK23: <diagnostic "Unavailable in the current compilation context.">
|
||||||
|
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=57:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s 2>&1 | %FileCheck -check-prefix=CHECK24 %s
|
// RUN: %sourcekitd-test -req=cursor -pos=57:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK24 %s
|
||||||
// CHECK24: (Request Failed): Unavailable in the current compilation context
|
// CHECK24: <diagnostic "Unavailable in the current compilation context.">
|
||||||
|
|
||||||
// RUN: %sourcekitd-test -req=cursor -pos=58:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK25 %s
|
// RUN: %sourcekitd-test -req=cursor -pos=58:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK25 %s
|
||||||
// CHECK25: <Declaration>func availabilityIntroducedMsg()</Declaration>
|
// CHECK25: <Declaration>func availabilityIntroducedMsg()</Declaration>
|
||||||
// CHECK25: <decl.function.method.instance><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>availabilityIntroducedMsg</decl.name>()</decl.function.method.instance>
|
// CHECK25: <decl.function.method.instance><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>availabilityIntroducedMsg</decl.name>()</decl.function.method.instance>
|
||||||
|
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=59:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s 2>&1 | %FileCheck -check-prefix=CHECK26 %s
|
// RUN: %sourcekitd-test -req=cursor -pos=59:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK26 %s
|
||||||
// CHECK26: (Request Failed): Unavailable in the current compilation context
|
// CHECK26: <diagnostic "Unavailable in the current compilation context.">
|
||||||
|
|
||||||
// RUN: %sourcekitd-test -req=cursor -pos=69:14 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK27 %s
|
// RUN: %sourcekitd-test -req=cursor -pos=69:14 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK27 %s
|
||||||
// CHECK27: <Declaration>public subscript(i: <Type usr="s:Si">Int</Type>) -> <Type usr="s:Si">Int</Type> { get }</Declaration>
|
// CHECK27: <Declaration>public subscript(i: <Type usr="s:Si">Int</Type>) -> <Type usr="s:Si">Int</Type> { get }</Declaration>
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ func resyncParser2() {}
|
|||||||
// CHECK4: bad
|
// CHECK4: bad
|
||||||
// CHECK4: <Declaration>var bad: IDontExist</Declaration>
|
// CHECK4: <Declaration>var bad: IDontExist</Declaration>
|
||||||
|
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=7:12 %s -- %s 2>&1 | %FileCheck -check-prefix=FAIL %s
|
// RUN: %sourcekitd-test -req=cursor -pos=7:12 %s -- %s | %FileCheck -check-prefix=DIAG %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=9:7 %s -- %s 2>&1 | %FileCheck -check-prefix=FAIL %s
|
// RUN: %sourcekitd-test -req=cursor -pos=9:7 %s -- %s | %FileCheck -check-prefix=DIAG %s
|
||||||
// FAIL: (Request Failed): Unable to resolve cursor info
|
// DIAG: <diagnostic "Unable to resolve cursor info.">
|
||||||
|
|
||||||
// RUN: %sourcekitd-test -req=cursor -pos=18:6 %s -- %s | %FileCheck -check-prefix=EQEQ1 %s
|
// RUN: %sourcekitd-test -req=cursor -pos=18:6 %s -- %s | %FileCheck -check-prefix=EQEQ1 %s
|
||||||
// RUN: %sourcekitd-test -req=cursor -pos=19:6 %s -- %s | %FileCheck -check-prefix=EQEQ1 %s
|
// RUN: %sourcekitd-test -req=cursor -pos=19:6 %s -- %s | %FileCheck -check-prefix=EQEQ1 %s
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ print("")
|
|||||||
find([1,2,3],1)
|
find([1,2,3],1)
|
||||||
|
|
||||||
// RUN: %sourcekitd-test -req=cursor -pos=1:1 %s -- %s | %FileCheck -check-prefix=CHECK1 %s
|
// RUN: %sourcekitd-test -req=cursor -pos=1:1 %s -- %s | %FileCheck -check-prefix=CHECK1 %s
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=2:1 %s -- %s 2>&1 | %FileCheck -check-prefix=CHECK2 %s
|
// RUN: %sourcekitd-test -req=cursor -pos=2:1 %s -- %s | %FileCheck -check-prefix=CHECK2 %s
|
||||||
|
|
||||||
// CHECK1: source.lang.swift.ref.function.free
|
// CHECK1: source.lang.swift.ref.function.free
|
||||||
// CHECK2: (Request Failed): Resolved to incomplete expression or statement
|
// CHECK2: <diagnostic "Resolved to incomplete expression or statement.">
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ func foo(x: FooStruct1) -> S1 {}
|
|||||||
// CHECK_SANITY1-NEXT: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>S1</decl.name></decl.struct>
|
// CHECK_SANITY1-NEXT: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>S1</decl.name></decl.struct>
|
||||||
|
|
||||||
// Bogus USR.
|
// Bogus USR.
|
||||||
// RUN: not %sourcekitd-test -req=cursor -usr "s:blahblahblah" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s 2>&1 | %FileCheck %s -check-prefix=RESOLVE
|
// RUN: %sourcekitd-test -req=cursor -usr "s:blahblahblah" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck %s -check-prefix=RESOLVE
|
||||||
// Missing s: prefix.
|
// Missing s: prefix.
|
||||||
// RUN: not %sourcekitd-test -req=cursor -usr "10cursor_usr6globalSivp" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s 2>&1 | %FileCheck %s -check-prefix=RESOLVE
|
// RUN: %sourcekitd-test -req=cursor -usr "10cursor_usr6globalSivp" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck %s -check-prefix=RESOLVE
|
||||||
// RESOLVE: (Request Failed): Unable to resolve type from USR.
|
// RESOLVE: <diagnostic "Unable to resolve type from USR.">
|
||||||
|
|
||||||
// FIXME: no support for clang USRs.
|
// FIXME: no support for clang USRs.
|
||||||
// RUN: not %sourcekitd-test -req=cursor -usr "c:@S@FooStruct1" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s 2>&1 | %FileCheck %s -check-prefix=CSUPPORT
|
// RUN: %sourcekitd-test -req=cursor -usr "c:@S@FooStruct1" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck %s -check-prefix=CSUPPORT
|
||||||
// CSUPPORT: (Request Failed): Lookup for C/C++/ObjC USRs not implemented.
|
// CSUPPORT: <diagnostic "Lookup for C/C++/ObjC USRs not implemented.">
|
||||||
|
|
||||||
// RUN: %sourcekitd-test -req=cursor -usr "s:10cursor_usr2S1V" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck %s -check-prefix=CHECK1
|
// RUN: %sourcekitd-test -req=cursor -usr "s:10cursor_usr2S1V" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck %s -check-prefix=CHECK1
|
||||||
// CHECK1: source.lang.swift.decl.struct (5:8-5:10)
|
// CHECK1: source.lang.swift.decl.struct (5:8-5:10)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
_ = ""
|
_ = ""
|
||||||
|
|
||||||
// rdar://problem/38314383
|
// rdar://problem/38314383
|
||||||
// RUN: not %sourcekitd-test 2>&1 -req=cursor -offset=0 %s -- -Xllvm -aarch64-use-tbi %s | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -offset=0 %s -- -Xllvm -aarch64-use-tbi %s | %FileCheck %s
|
||||||
|
|
||||||
// CHECK: (Request Failed): Resolved to incomplete expression or statement.
|
// CHECK: <diagnostic "Resolved to incomplete expression or statement.">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Checks that we don't crash.
|
// Checks that we don't crash.
|
||||||
// RUN: not %sourcekitd-test -req=cursor -pos=7:5 %s -- %s 2>&1 | %FileCheck %s
|
// RUN: %sourcekitd-test -req=cursor -pos=7:5 %s -- %s | %FileCheck %s
|
||||||
// CHECK: (Request Failed): Unable to resolve cursor info
|
// CHECK: <diagnostic "Unable to resolve cursor info.">
|
||||||
|
|
||||||
class CameraViewController
|
class CameraViewController
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class MyDerived: FooClassDerived {
|
|||||||
// RUN: %sourcekitd-test -req=translate -objc-name fooProperty2 -pos=6:16 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
|
// RUN: %sourcekitd-test -req=translate -objc-name fooProperty2 -pos=6:16 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc1 -pos=7:16 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK3 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc1 -pos=7:16 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK3 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc1: -pos=7:16 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK3 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc1: -pos=7:16 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK3 %s
|
||||||
// RUN: not %sourcekitd-test -req=translate -objc-selector fooFunc3:d:d:d: -pos=8:4 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s 2>&1 | %FileCheck -check-prefix=CHECK-FAIL %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector fooFunc3:d:d:d: -pos=8:4 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK-DIAG %s
|
||||||
|
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector fooBaseInstanceFuncOverridden1 -pos=12:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK4 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector fooBaseInstanceFuncOverridden1 -pos=12:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK4 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc01 -pos=13:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK5 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc01 -pos=13:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK5 %s
|
||||||
@@ -39,7 +39,7 @@ class MyDerived: FooClassDerived {
|
|||||||
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc2:withBB: -pos=15:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK7 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc2:withBB: -pos=15:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK7 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc21:withBB: -pos=15:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK8 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc21:withBB: -pos=15:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK8 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-name fooProperty11 -pos=16:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK9 %s
|
// RUN: %sourcekitd-test -req=translate -objc-name fooProperty11 -pos=16:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK9 %s
|
||||||
// RUN: not %sourcekitd-test -req=translate -objc-selector fooInstanceFunc21:withBB:withC: -pos=15:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s 2>&1 | %FileCheck -check-prefix=CHECK-FAIL %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc21:withBB:withC: -pos=15:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK-DIAG %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc21: -pos=15:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECKFEWER1 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc21: -pos=15:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECKFEWER1 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc21:: -pos=15:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECKMISSING1 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc21:: -pos=15:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECKMISSING1 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector :withBB: -pos=15:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECKMISSING2 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector :withBB: -pos=15:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECKMISSING2 %s
|
||||||
@@ -47,7 +47,7 @@ class MyDerived: FooClassDerived {
|
|||||||
|
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc21: -pos=17:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK10 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc21: -pos=17:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK10 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector initWithfloat2: -pos=17:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK12 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector initWithfloat2: -pos=17:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK12 %s
|
||||||
// RUN: not %sourcekitd-test -req=translate -objc-selector initWithfloat2:D: -pos=17:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s 2>&1 | %FileCheck -check-prefix=CHECK-FAIL %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector initWithfloat2:D: -pos=17:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK-DIAG %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector init: -pos=17:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK13 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector init: -pos=17:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK13 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector iit: -pos=17:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK13 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector iit: -pos=17:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK13 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector NAME -pos=18:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK14 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector NAME -pos=18:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK14 %s
|
||||||
@@ -56,7 +56,7 @@ class MyDerived: FooClassDerived {
|
|||||||
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc01 -pos=23:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK5 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector fooInstanceFunc01 -pos=23:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK5 %s
|
||||||
|
|
||||||
// CHECK1: FooClassDerived2
|
// CHECK1: FooClassDerived2
|
||||||
// CHECK-FAIL: (Request Failed): Unable to resolve ObjC declaration name
|
// CHECK-DIAG: <diagnostic "Unable to resolve ObjC declaration name.">
|
||||||
// CHECK2: fooProperty2
|
// CHECK2: fooProperty2
|
||||||
// CHECK3: fooInstanceFunc1
|
// CHECK3: fooInstanceFunc1
|
||||||
// CHECK4: fooBaseInstanceFuncOverridden1
|
// CHECK4: fooBaseInstanceFuncOverridden1
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ func foo1() {
|
|||||||
|
|
||||||
// REQUIRES: objc_interop
|
// REQUIRES: objc_interop
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-name orderedSome -pos=4:30 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK1 %s
|
// RUN: %sourcekitd-test -req=translate -objc-name orderedSome -pos=4:30 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK1 %s
|
||||||
// RUN: not %sourcekitd-test -req=translate -objc-selector orderedSome -pos=4:30 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s 2>&1 | %FileCheck -check-prefix=CHECK-FAIL %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector orderedSome -pos=4:30 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK-DIAG %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-name enableThird -pos=7:30 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
|
// RUN: %sourcekitd-test -req=translate -objc-name enableThird -pos=7:30 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-name FooRuncingEnableThird -pos=7:30 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
|
// RUN: %sourcekitd-test -req=translate -objc-name FooRuncingEnableThird -pos=7:30 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-name FooRuncinEnableThird -pos=7:30 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
|
// RUN: %sourcekitd-test -req=translate -objc-name FooRuncinEnableThird -pos=7:30 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-name FooRinEnableThird -pos=7:30 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK3 %s
|
// RUN: %sourcekitd-test -req=translate -objc-name FooRinEnableThird -pos=7:30 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK3 %s
|
||||||
|
|
||||||
// CHECK1: orderedSome
|
// CHECK1: orderedSome
|
||||||
// CHECK-FAIL: (Request Failed): Unable to resolve ObjC declaration name
|
// CHECK-DIAG: <diagnostic "Unable to resolve ObjC declaration name.">
|
||||||
// CHECK2: enableThird
|
// CHECK2: enableThird
|
||||||
// CHECK3: inEnableThird
|
// CHECK3: inEnableThird
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ func foo2 () {
|
|||||||
// RUN: %sourcekitd-test -req=translate -objc-selector initWithFloat2: -pos=4:15 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK1 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector initWithFloat2: -pos=4:15 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK1 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector initWithFloat2 -pos=4:15 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK1 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector initWithFloat2 -pos=4:15 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK1 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector initWithFloat2:second2: -pos=5:15 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector initWithFloat2:second2: -pos=5:15 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
|
||||||
// RUN: not %sourcekitd-test -req=translate -objc-selector initWithFloat2:second2:third: -pos=5:15 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s 2>&1 | %FileCheck -check-prefix=CHECK-FAIL %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector initWithFloat2:second2:third: -pos=5:15 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK-DIAG %s
|
||||||
// RUN: %sourcekitd-test -req=translate -objc-selector initFloat2:second2: -pos=5:15 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
|
// RUN: %sourcekitd-test -req=translate -objc-selector initFloat2:second2: -pos=5:15 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
|
||||||
|
|
||||||
// CHECK-FAIL: (Request Failed): Unable to resolve ObjC declaration name
|
// CHECK-DIAG: <diagnostic "Unable to resolve ObjC declaration name.">
|
||||||
// CHECK1: init(float2:)
|
// CHECK1: init(float2:)
|
||||||
// CHECK2: init(float2:second2:)
|
// CHECK2: init(float2:second2:)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class C3: NSObject {
|
|||||||
// RUN: %sourcekitd-test -req=translate -swift-name "foo2(_:_:_:)" -pos=12:11 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK7 %s
|
// RUN: %sourcekitd-test -req=translate -swift-name "foo2(_:_:_:)" -pos=12:11 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK7 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -swift-name "foo1()" -pos=14:11 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK8 %s
|
// RUN: %sourcekitd-test -req=translate -swift-name "foo1()" -pos=14:11 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK8 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -swift-name "foo1()" -pos=14:11 %s -print-raw-response -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK_RAW8 %s
|
// RUN: %sourcekitd-test -req=translate -swift-name "foo1()" -pos=14:11 %s -print-raw-response -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK_RAW8 %s
|
||||||
// RUN: not %sourcekitd-test -req=translate -swift-name "foo1(a:b:c:)" -pos=14:11 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s 2>&1 | %FileCheck -check-prefix=CHECK-FAIL %s
|
// RUN: %sourcekitd-test -req=translate -swift-name "foo1(a:b:c:)" -pos=14:11 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK-DIAG %s
|
||||||
// RUN: %sourcekitd-test -req=translate -swift-name "C11" -pos=1:8 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK9 %s
|
// RUN: %sourcekitd-test -req=translate -swift-name "C11" -pos=1:8 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK9 %s
|
||||||
|
|
||||||
// RUN: %sourcekitd-test -req=translate -swift-name "init(a1:b2:)" -pos=10:16 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK10 %s
|
// RUN: %sourcekitd-test -req=translate -swift-name "init(a1:b2:)" -pos=10:16 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK10 %s
|
||||||
@@ -86,7 +86,7 @@ class C3: NSObject {
|
|||||||
// RUN: %sourcekitd-test -req=translate -swift-name "zoo(m:)" -pos=55:14 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK17 %s
|
// RUN: %sourcekitd-test -req=translate -swift-name "zoo(m:)" -pos=55:14 %s -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK17 %s
|
||||||
// RUN: %sourcekitd-test -req=translate -swift-name "zoo(m:)" -pos=55:14 %s -print-raw-response -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK_RAW17 %s
|
// RUN: %sourcekitd-test -req=translate -swift-name "zoo(m:)" -pos=55:14 %s -print-raw-response -- -F %S/Inputs/mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK_RAW17 %s
|
||||||
|
|
||||||
// CHECK-FAIL: (Request Failed): Unable to resolve Swift declaration name
|
// CHECK-DIAG: <diagnostic "Unable to resolve Swift declaration name.">
|
||||||
// CHECK1: fooWithA:b:c:
|
// CHECK1: fooWithA:b:c:
|
||||||
// CHECK2: fooWithA1:b1:c1:
|
// CHECK2: fooWithA1:b1:c1:
|
||||||
// CHECK3: foo:b1:c1:
|
// CHECK3: foo:b1:c1:
|
||||||
|
|||||||
@@ -310,6 +310,11 @@ struct RefactoringInfo {
|
|||||||
|
|
||||||
struct CursorInfoData {
|
struct CursorInfoData {
|
||||||
bool IsCancelled = false;
|
bool IsCancelled = false;
|
||||||
|
// If nonempty, a proper Info could not be resolved (and the rest of the Info
|
||||||
|
// will be empty). Clients can potentially use this to show a diagnostic
|
||||||
|
// message to the user in lieu of using the empty response.
|
||||||
|
StringRef InternalDiagnostic;
|
||||||
|
|
||||||
UIdent Kind;
|
UIdent Kind;
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
StringRef USR;
|
StringRef USR;
|
||||||
@@ -358,6 +363,11 @@ struct RangeInfo {
|
|||||||
|
|
||||||
struct NameTranslatingInfo {
|
struct NameTranslatingInfo {
|
||||||
bool IsCancelled = false;
|
bool IsCancelled = false;
|
||||||
|
// If nonempty, a proper Info could not be resolved (and the rest of the Info
|
||||||
|
// will be empty). Clients can potentially use this to show a diagnostic
|
||||||
|
// message to the user in lieu of using the empty response.
|
||||||
|
StringRef InternalDiagnostic;
|
||||||
|
|
||||||
UIdent NameKind;
|
UIdent NameKind;
|
||||||
StringRef BaseName;
|
StringRef BaseName;
|
||||||
std::vector<StringRef> ArgNames;
|
std::vector<StringRef> ArgNames;
|
||||||
|
|||||||
@@ -697,7 +697,7 @@ getParamParentNameOffset(const ValueDecl *VD, SourceLoc Cursor) {
|
|||||||
return SM.getLocOffsetInBuffer(Loc, SM.findBufferContainingLoc(Loc));
|
return SM.getLocOffsetInBuffer(Loc, SM.findBufferContainingLoc(Loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a non-empty StringRef on error.
|
/// Returns a non-empty StringRef on error, representing an internal diagnostic.
|
||||||
static StringRef passCursorInfoForDecl(SourceFile* SF,
|
static StringRef passCursorInfoForDecl(SourceFile* SF,
|
||||||
const ValueDecl *VD,
|
const ValueDecl *VD,
|
||||||
const ModuleDecl *MainModule,
|
const ModuleDecl *MainModule,
|
||||||
@@ -1035,7 +1035,7 @@ static DeclName getSwiftDeclName(const ValueDecl *VD,
|
|||||||
return DeclName(Ctx, BaseName, llvm::makeArrayRef(Args));
|
return DeclName(Ctx, BaseName, llvm::makeArrayRef(Args));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a non-empty StringRef on error.
|
/// Returns a non-empty StringRef on error, representing an internal diagnostic.
|
||||||
static StringRef passNameInfoForDecl(ResolvedCursorInfo CursorInfo,
|
static StringRef passNameInfoForDecl(ResolvedCursorInfo CursorInfo,
|
||||||
NameTranslatingInfo &Info,
|
NameTranslatingInfo &Info,
|
||||||
std::function<void(const NameTranslatingInfo &,
|
std::function<void(const NameTranslatingInfo &,
|
||||||
@@ -1283,7 +1283,9 @@ static void resolveCursor(SwiftLangSupport &Lang,
|
|||||||
CursorInfoResolver Resolver(AstUnit->getPrimarySourceFile());
|
CursorInfoResolver Resolver(AstUnit->getPrimarySourceFile());
|
||||||
ResolvedCursorInfo CursorInfo = Resolver.resolve(Loc);
|
ResolvedCursorInfo CursorInfo = Resolver.resolve(Loc);
|
||||||
if (CursorInfo.isInvalid()) {
|
if (CursorInfo.isInvalid()) {
|
||||||
Receiver(CursorInfoData(), "Unable to resolve cursor info.");
|
CursorInfoData Info;
|
||||||
|
Info.InternalDiagnostic = "Unable to resolve cursor info.";
|
||||||
|
Receiver(Info, "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CompilerInvocation CompInvok;
|
CompilerInvocation CompInvok;
|
||||||
@@ -1303,25 +1305,27 @@ static void resolveCursor(SwiftLangSupport &Lang,
|
|||||||
VD = CursorInfo.CtorTyRef;
|
VD = CursorInfo.CtorTyRef;
|
||||||
ContainerType = Type();
|
ContainerType = Type();
|
||||||
}
|
}
|
||||||
StringRef Error = passCursorInfoForDecl(&AstUnit->getPrimarySourceFile(),
|
StringRef Diag = passCursorInfoForDecl(&AstUnit->getPrimarySourceFile(),
|
||||||
VD, MainModule,
|
VD, MainModule,
|
||||||
ContainerType,
|
ContainerType,
|
||||||
CursorInfo.IsRef,
|
CursorInfo.IsRef,
|
||||||
Actionables,
|
Actionables,
|
||||||
CursorInfo,
|
CursorInfo,
|
||||||
BufferID, Loc,
|
BufferID, Loc,
|
||||||
AvailableRefactorings,
|
AvailableRefactorings,
|
||||||
Lang, CompInvok,
|
Lang, CompInvok,
|
||||||
getPreviousASTSnaps(),
|
getPreviousASTSnaps(),
|
||||||
Receiver);
|
Receiver);
|
||||||
if (!Error.empty()) {
|
if (!Diag.empty()) {
|
||||||
if (!getPreviousASTSnaps().empty()) {
|
if (!getPreviousASTSnaps().empty()) {
|
||||||
// Attempt again using the up-to-date AST.
|
// Attempt again using the up-to-date AST.
|
||||||
resolveCursor(Lang, InputFile, Offset, Length, Actionables, ASTInvok,
|
resolveCursor(Lang, InputFile, Offset, Length, Actionables, ASTInvok,
|
||||||
/*TryExistingAST=*/false, CancelOnSubsequentRequest,
|
/*TryExistingAST=*/false, CancelOnSubsequentRequest,
|
||||||
Receiver);
|
Receiver);
|
||||||
} else {
|
} else {
|
||||||
Receiver(CursorInfoData(), Error);
|
CursorInfoData Info;
|
||||||
|
Info.InternalDiagnostic = Diag;
|
||||||
|
Receiver(Info, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -1351,8 +1355,10 @@ static void resolveCursor(SwiftLangSupport &Lang,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Receiver(CursorInfoData(),
|
CursorInfoData Info;
|
||||||
"Resolved to incomplete expression or statement.");
|
Info.InternalDiagnostic =
|
||||||
|
"Resolved to incomplete expression or statement.";
|
||||||
|
Receiver(Info, "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case CursorInfoKind::Invalid: {
|
case CursorInfoKind::Invalid: {
|
||||||
@@ -1424,7 +1430,9 @@ static void resolveName(SwiftLangSupport &Lang, StringRef InputFile,
|
|||||||
CursorInfoResolver Resolver(AstUnit->getPrimarySourceFile());
|
CursorInfoResolver Resolver(AstUnit->getPrimarySourceFile());
|
||||||
ResolvedCursorInfo CursorInfo = Resolver.resolve(Loc);
|
ResolvedCursorInfo CursorInfo = Resolver.resolve(Loc);
|
||||||
if (CursorInfo.isInvalid()) {
|
if (CursorInfo.isInvalid()) {
|
||||||
Receiver({}, "Unable to resolve cursor info.");
|
NameTranslatingInfo Info;
|
||||||
|
Info.InternalDiagnostic = "Unable to resolve cursor info.";
|
||||||
|
Receiver(Info, "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1436,21 +1444,26 @@ static void resolveName(SwiftLangSupport &Lang, StringRef InputFile,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case CursorInfoKind::ValueRef: {
|
case CursorInfoKind::ValueRef: {
|
||||||
StringRef Error = passNameInfoForDecl(CursorInfo, Input, Receiver);
|
StringRef Diagnostic = passNameInfoForDecl(CursorInfo, Input, Receiver);
|
||||||
if (!Error.empty()) {
|
if (!Diagnostic.empty()) {
|
||||||
if (!getPreviousASTSnaps().empty()) {
|
if (!getPreviousASTSnaps().empty()) {
|
||||||
// Attempt again using the up-to-date AST.
|
// Attempt again using the up-to-date AST.
|
||||||
resolveName(Lang, InputFile, Offset, ASTInvok,
|
resolveName(Lang, InputFile, Offset, ASTInvok,
|
||||||
/*TryExistingAST=*/false, Input, Receiver);
|
/*TryExistingAST=*/false, Input, Receiver);
|
||||||
} else {
|
} else {
|
||||||
Receiver({}, Error);
|
NameTranslatingInfo Info;
|
||||||
|
Info.InternalDiagnostic = Diagnostic;
|
||||||
|
Receiver(Info, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case CursorInfoKind::ExprStart:
|
case CursorInfoKind::ExprStart:
|
||||||
case CursorInfoKind::StmtStart: {
|
case CursorInfoKind::StmtStart: {
|
||||||
Receiver({}, "Resolved to incomplete expression or statement.");
|
NameTranslatingInfo Info;
|
||||||
|
Info.InternalDiagnostic =
|
||||||
|
"Resolved to incomplete expression or statement.";
|
||||||
|
Receiver(Info, "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case CursorInfoKind::Invalid:
|
case CursorInfoKind::Invalid:
|
||||||
@@ -1591,8 +1604,10 @@ void SwiftLangSupport::getCursorInfo(
|
|||||||
{}, *this, Invok, {}, Receiver);
|
{}, *this, Invok, {}, Receiver);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Receiver(CursorInfoData(),
|
CursorInfoData Info;
|
||||||
"Unable to resolve entity from generated interface.");
|
Info.InternalDiagnostic =
|
||||||
|
"Unable to resolve entity from generated interface.";
|
||||||
|
Receiver(Info, "");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -1654,7 +1669,10 @@ getNameInfo(StringRef InputFile, unsigned Offset, NameTranslatingInfo &Input,
|
|||||||
// it's not necessary.
|
// it's not necessary.
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Receiver({}, "Unable to resolve entity from generated interface.");
|
NameTranslatingInfo Info;
|
||||||
|
Info.InternalDiagnostic =
|
||||||
|
"Unable to resolve entity from generated interface.";
|
||||||
|
Receiver(Info, "");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -1726,7 +1744,9 @@ resolveCursorFromUSR(SwiftLangSupport &Lang, StringRef InputFile, StringRef USR,
|
|||||||
|
|
||||||
if (USR.startswith("c:")) {
|
if (USR.startswith("c:")) {
|
||||||
LOG_WARN_FUNC("lookup for C/C++/ObjC USRs not implemented");
|
LOG_WARN_FUNC("lookup for C/C++/ObjC USRs not implemented");
|
||||||
Receiver(CursorInfoData(), "Lookup for C/C++/ObjC USRs not implemented.");
|
CursorInfoData Info;
|
||||||
|
Info.InternalDiagnostic = "Lookup for C/C++/ObjC USRs not implemented.";
|
||||||
|
Receiver(Info, "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1734,7 +1754,9 @@ resolveCursorFromUSR(SwiftLangSupport &Lang, StringRef InputFile, StringRef USR,
|
|||||||
TypeDecl *D = Demangle::getTypeDeclForUSR(context, USR);
|
TypeDecl *D = Demangle::getTypeDeclForUSR(context, USR);
|
||||||
|
|
||||||
if (!D) {
|
if (!D) {
|
||||||
Receiver(CursorInfoData(), "Unable to resolve type from USR.");
|
CursorInfoData Info;
|
||||||
|
Info.InternalDiagnostic = "Unable to resolve type from USR.";
|
||||||
|
Receiver(Info, "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1751,19 +1773,21 @@ resolveCursorFromUSR(SwiftLangSupport &Lang, StringRef InputFile, StringRef USR,
|
|||||||
selfTy = DC->getSelfInterfaceType();
|
selfTy = DC->getSelfInterfaceType();
|
||||||
selfTy = D->getInnermostDeclContext()->mapTypeIntoContext(selfTy);
|
selfTy = D->getInnermostDeclContext()->mapTypeIntoContext(selfTy);
|
||||||
}
|
}
|
||||||
StringRef Error =
|
StringRef Diagnostic =
|
||||||
passCursorInfoForDecl(/*SourceFile*/nullptr, D, MainModule, selfTy,
|
passCursorInfoForDecl(/*SourceFile*/nullptr, D, MainModule, selfTy,
|
||||||
/*IsRef=*/false, false, ResolvedCursorInfo(),
|
/*IsRef=*/false, false, ResolvedCursorInfo(),
|
||||||
BufferID, SourceLoc(), {}, Lang, CompInvok,
|
BufferID, SourceLoc(), {}, Lang, CompInvok,
|
||||||
PreviousASTSnaps, Receiver);
|
PreviousASTSnaps, Receiver);
|
||||||
if (!Error.empty()) {
|
if (!Diagnostic.empty()) {
|
||||||
if (!PreviousASTSnaps.empty()) {
|
if (!PreviousASTSnaps.empty()) {
|
||||||
// Attempt again using the up-to-date AST.
|
// Attempt again using the up-to-date AST.
|
||||||
resolveCursorFromUSR(Lang, InputFile, USR, ASTInvok,
|
resolveCursorFromUSR(Lang, InputFile, USR, ASTInvok,
|
||||||
/*TryExistingAST=*/false,
|
/*TryExistingAST=*/false,
|
||||||
CancelOnSubsequentRequest, Receiver);
|
CancelOnSubsequentRequest, Receiver);
|
||||||
} else {
|
} else {
|
||||||
Receiver(CursorInfoData(), Error);
|
CursorInfoData Info;
|
||||||
|
Info.InternalDiagnostic = Diagnostic;
|
||||||
|
Receiver(Info, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1797,7 +1821,9 @@ void SwiftLangSupport::getCursorInfoFromUSR(
|
|||||||
std::function<void(const CursorInfoData &, StringRef Error)> receiver) {
|
std::function<void(const CursorInfoData &, StringRef Error)> receiver) {
|
||||||
if (auto IFaceGenRef = IFaceGenContexts.get(filename)) {
|
if (auto IFaceGenRef = IFaceGenContexts.get(filename)) {
|
||||||
LOG_WARN_FUNC("Info from usr for generated interface not implemented yet.");
|
LOG_WARN_FUNC("Info from usr for generated interface not implemented yet.");
|
||||||
receiver(CursorInfoData(), "Info for generated interfaces not implemented.");
|
CursorInfoData Info;
|
||||||
|
Info.InternalDiagnostic = "Info for generated interfaces not implemented.";
|
||||||
|
receiver(Info, "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1303,6 +1303,12 @@ static void notification_receiver(sourcekitd_response_t resp) {
|
|||||||
|
|
||||||
static void printNameTranslationInfo(sourcekitd_variant_t Info,
|
static void printNameTranslationInfo(sourcekitd_variant_t Info,
|
||||||
llvm::raw_ostream &OS) {
|
llvm::raw_ostream &OS) {
|
||||||
|
const char *InternalDiagnostic =
|
||||||
|
sourcekitd_variant_dictionary_get_string(Info, KeyInternalDiagnostic);
|
||||||
|
if (InternalDiagnostic) {
|
||||||
|
OS << "<diagnostic \"" << InternalDiagnostic << "\">\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
sourcekitd_uid_t KindUID = sourcekitd_variant_dictionary_get_uid(Info,
|
sourcekitd_uid_t KindUID = sourcekitd_variant_dictionary_get_uid(Info,
|
||||||
KeyNameKind);
|
KeyNameKind);
|
||||||
if (KindUID == nullptr) {
|
if (KindUID == nullptr) {
|
||||||
@@ -1362,6 +1368,12 @@ static void printNameTranslationInfo(sourcekitd_variant_t Info,
|
|||||||
|
|
||||||
static void printCursorInfo(sourcekitd_variant_t Info, StringRef FilenameIn,
|
static void printCursorInfo(sourcekitd_variant_t Info, StringRef FilenameIn,
|
||||||
llvm::raw_ostream &OS) {
|
llvm::raw_ostream &OS) {
|
||||||
|
const char *InternalDiagnostic =
|
||||||
|
sourcekitd_variant_dictionary_get_string(Info, KeyInternalDiagnostic);
|
||||||
|
if (InternalDiagnostic) {
|
||||||
|
OS << "<diagnostic \"" << InternalDiagnostic << "\">\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
sourcekitd_uid_t KindUID = sourcekitd_variant_dictionary_get_uid(Info,
|
sourcekitd_uid_t KindUID = sourcekitd_variant_dictionary_get_uid(Info,
|
||||||
sourcekitd_uid_get_from_cstr("key.kind"));
|
sourcekitd_uid_get_from_cstr("key.kind"));
|
||||||
if (KindUID == nullptr) {
|
if (KindUID == nullptr) {
|
||||||
|
|||||||
@@ -1625,6 +1625,11 @@ static void reportCursorInfo(const CursorInfoData &Info, ResponseReceiver Rec,
|
|||||||
return Rec(createErrorRequestFailed(Error.str().c_str()));
|
return Rec(createErrorRequestFailed(Error.str().c_str()));
|
||||||
|
|
||||||
ResponseBuilder RespBuilder;
|
ResponseBuilder RespBuilder;
|
||||||
|
if (!Info.InternalDiagnostic.empty()) {
|
||||||
|
auto Elem = RespBuilder.getDictionary();
|
||||||
|
Elem.set(KeyInternalDiagnostic, Info.InternalDiagnostic);
|
||||||
|
return Rec(RespBuilder.createResponse());
|
||||||
|
}
|
||||||
if (Info.Kind.isInvalid())
|
if (Info.Kind.isInvalid())
|
||||||
return Rec(RespBuilder.createResponse());
|
return Rec(RespBuilder.createResponse());
|
||||||
|
|
||||||
@@ -1732,6 +1737,11 @@ static void reportNameInfo(const NameTranslatingInfo &Info,
|
|||||||
return Rec(createErrorRequestFailed(Error.str().c_str()));
|
return Rec(createErrorRequestFailed(Error.str().c_str()));
|
||||||
|
|
||||||
ResponseBuilder RespBuilder;
|
ResponseBuilder RespBuilder;
|
||||||
|
if (!Info.InternalDiagnostic.empty()) {
|
||||||
|
auto Elem = RespBuilder.getDictionary();
|
||||||
|
Elem.set(KeyInternalDiagnostic, Info.InternalDiagnostic);
|
||||||
|
return Rec(RespBuilder.createResponse());
|
||||||
|
}
|
||||||
if (Info.NameKind.isInvalid())
|
if (Info.NameKind.isInvalid())
|
||||||
return Rec(RespBuilder.createResponse());
|
return Rec(RespBuilder.createResponse());
|
||||||
if (Info.BaseName.empty() && Info.ArgNames.empty())
|
if (Info.BaseName.empty() && Info.ArgNames.empty())
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ UID_KEYS = [
|
|||||||
KEY('ExpressionOffset', 'key.expression_offset'),
|
KEY('ExpressionOffset', 'key.expression_offset'),
|
||||||
KEY('ExpressionLength', 'key.expression_length'),
|
KEY('ExpressionLength', 'key.expression_length'),
|
||||||
KEY('ExpressionType', 'key.expression_type'),
|
KEY('ExpressionType', 'key.expression_type'),
|
||||||
|
KEY('InternalDiagnostic', "key.internal_diagnostic"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user