Analysis API: add test for KtDiagnosticsProvider

This commit is contained in:
Tianyu Geng
2021-11-16 04:26:45 +01:00
committed by TeamCityServer
parent cd3827ca2e
commit f197fc93db
18 changed files with 351 additions and 3 deletions
@@ -0,0 +1,19 @@
Diagnostics from elements:
for PSI element of type KtClass at (6,1-11)
ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED text ranges: [(62,69)]
PSI: KtClass at (6,1-11)
for PSI element of type KtNamedFunction at (4,3-21)
ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS text ranges: [(41,49)]
PSI: KtNamedFunction at (4,3-21)
for PSI element of type KtTypeReference at (6,10-11)
FINAL_SUPERTYPE text ranges: [(71,72)]
PSI: KtTypeReference at (6,10-11)
for PSI element of type KtProperty at (1,1-11)
MUST_BE_INITIALIZED text ranges: [(0,10)]
PSI: KtProperty at (1,1-11)
for PSI element of type KtNamedFunction at (2,1-18)
NON_MEMBER_FUNCTION_NO_BODY text ranges: [(11,28)]
PSI: KtNamedFunction at (2,1-18)
for PSI element of type KtSuperTypeEntry at (6,10-11)
SUPERTYPE_NOT_INITIALIZED text ranges: [(71,72)]
PSI: KtSuperTypeEntry at (6,10-11)
@@ -0,0 +1,6 @@
val i: Int
fun foo(): String
class A {
abstract fun foo()
}
class B: A
@@ -0,0 +1,19 @@
Diagnostics from elements:
for PSI element of type KtClass at (6,1-11)
ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED text ranges: [(62,69)]
PSI: KtClass at (6,1-11)
for PSI element of type KtNamedFunction at (4,3-21)
ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS text ranges: [(41,49)]
PSI: KtNamedFunction at (4,3-21)
for PSI element of type KtTypeReference at (6,10-11)
FINAL_SUPERTYPE text ranges: [(71,72)]
PSI: KtTypeReference at (6,10-11)
for PSI element of type KtProperty at (1,1-11)
MUST_BE_INITIALIZED text ranges: [(0,10)]
PSI: KtProperty at (1,1-11)
for PSI element of type KtNamedFunction at (2,1-18)
NON_MEMBER_FUNCTION_NO_BODY text ranges: [(11,28)]
PSI: KtNamedFunction at (2,1-18)
for PSI element of type KtTypeReference at (6,10-11)
SUPERTYPE_NOT_INITIALIZED text ranges: [(71,72)]
PSI: KtTypeReference at (6,10-11)
@@ -0,0 +1,19 @@
Diagnostics from elements:
for PSI element of type KtNameReferenceExpression at (6,5-8)
NONE_APPLICABLE text ranges: [(89,92)]
PSI: KtNameReferenceExpression at (6,5-8)
for PSI element of type KtNameReferenceExpression at (7,5-8)
NONE_APPLICABLE text ranges: [(100,103)]
PSI: KtNameReferenceExpression at (7,5-8)
for PSI element of type KtNameReferenceExpression at (8,5-8)
NONE_APPLICABLE text ranges: [(115,118)]
PSI: KtNameReferenceExpression at (8,5-8)
for PSI element of type KtConstantExpression at (5,9-10)
TOO_MANY_ARGUMENTS text ranges: [(82,83)]
PSI: KtConstantExpression at (5,9-10)
for PSI element of type KtParameter at (2,9-18)
UNUSED_PARAMETER text ranges: [(21,22)]
PSI: KtParameter at (2,9-18)
for PSI element of type KtParameter at (3,9-22)
UNUSED_PARAMETER text ranges: [(43,44)]
PSI: KtParameter at (3,9-22)
@@ -0,0 +1,9 @@
fun foo() {}
fun bar(s: String) {}
fun bar(f: () -> Unit) {}
fun test() {
foo(1)
bar(2)
bar("", 1)
bar()
}
@@ -0,0 +1,13 @@
Diagnostics from elements:
for PSI element of type KtNameReferenceExpression at (6,5-8)
NONE_APPLICABLE text ranges: [(89,92)]
PSI: KtNameReferenceExpression at (6,5-8)
for PSI element of type KtNameReferenceExpression at (7,5-8)
NONE_APPLICABLE text ranges: [(100,103)]
PSI: KtNameReferenceExpression at (7,5-8)
for PSI element of type KtNameReferenceExpression at (8,5-8)
NONE_APPLICABLE text ranges: [(115,118)]
PSI: KtNameReferenceExpression at (8,5-8)
for PSI element of type KtConstantExpression at (5,9-10)
TOO_MANY_ARGUMENTS text ranges: [(82,83)]
PSI: KtConstantExpression at (5,9-10)
@@ -0,0 +1,13 @@
Diagnostics from elements:
for PSI element of type KtConstantExpression at (5,12-13)
CONSTANT_EXPECTED_TYPE_MISMATCH text ranges: [(68,69)]
PSI: KtConstantExpression at (5,12-13)
for PSI element of type KtNameReferenceExpression at (4,9-10)
TYPE_MISMATCH text ranges: [(54,55)]
PSI: KtNameReferenceExpression at (4,9-10)
for PSI element of type KtStringTemplateExpression at (1,14-16)
TYPE_MISMATCH text ranges: [(13,15)]
PSI: KtStringTemplateExpression at (1,14-16)
for PSI element of type KtParameter at (3,9-18)
UNUSED_PARAMETER text ranges: [(25,26)]
PSI: KtParameter at (3,9-18)
@@ -0,0 +1,6 @@
val i: Int = ""
fun foo(s: String): String {
foo(i)
return 1
}
@@ -0,0 +1,10 @@
Diagnostics from elements:
for PSI element of type KtNameReferenceExpression at (4,9-10)
ARGUMENT_TYPE_MISMATCH text ranges: [(54,55)]
PSI: KtNameReferenceExpression at (4,9-10)
for PSI element of type KtProperty at (1,1-16)
INITIALIZER_TYPE_MISMATCH text ranges: [(13,15)]
PSI: KtProperty at (1,1-16)
for PSI element of type KtConstantExpression at (5,12-13)
RETURN_TYPE_MISMATCH text ranges: [(68,69)]
PSI: KtConstantExpression at (5,12-13)
@@ -0,0 +1,6 @@
fun test() {
foo(1)
bar(abc)
a.b.c.d
"" - ""
}
@@ -0,0 +1,16 @@
Diagnostics from elements:
for PSI element of type KtNameReferenceExpression at (2,5-8)
UNRESOLVED_REFERENCE text ranges: [(17,20)]
PSI: KtNameReferenceExpression at (2,5-8)
for PSI element of type KtNameReferenceExpression at (3,5-8)
UNRESOLVED_REFERENCE text ranges: [(28,31)]
PSI: KtNameReferenceExpression at (3,5-8)
for PSI element of type KtNameReferenceExpression at (3,9-12)
UNRESOLVED_REFERENCE text ranges: [(32,35)]
PSI: KtNameReferenceExpression at (3,9-12)
for PSI element of type KtNameReferenceExpression at (4,5-6)
UNRESOLVED_REFERENCE text ranges: [(41,42)]
PSI: KtNameReferenceExpression at (4,5-6)
for PSI element of type KtOperationReferenceExpression at (5,8-9)
UNRESOLVED_REFERENCE text ranges: [(56,57)]
PSI: KtOperationReferenceExpression at (5,8-9)