Create class descriptors for local classes in illegal positions

Typecheck code in illegal selector position
Fixes exceptions on "val p = A.class" erroneous code
This commit is contained in:
Pavel V. Talanov
2015-12-28 16:49:46 +03:00
parent 06e829936e
commit 1c4d4f3e36
18 changed files with 127 additions and 9 deletions
@@ -0,0 +1,5 @@
class A
fun f() {
A.class<EOLError descr="Name expected"></EOLError>
}
@@ -0,0 +1,9 @@
class A
fun f() {
A.<error>class B {
fun f() {
f()
}
}</error>
}
@@ -0,0 +1,5 @@
val p = 1 < <error>class A {
fun f() {
f()
}
}</error>
@@ -0,0 +1 @@
fun g() = 1 < <error>class A</error>
@@ -0,0 +1,7 @@
fun f(<warning>i</warning>: Int = 3 < <error>class A {
fun f() {
f()
}
}</error>) {
}
@@ -0,0 +1,7 @@
class A
fun f() {
A.<error>fun <error>g</error>() {
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: g">g</error>()
}</error>
}
@@ -1,10 +1,10 @@
interface Hi {
fun foo(): Int
interface <lineMarker></lineMarker>Hi {
fun <lineMarker></lineMarker>foo(): Int
}
// Closing brace is intentionally missed
val id = array("kotlin.FlexibleType"
private class Some(): Hi {
override fun foo() = 1
override fun <lineMarker></lineMarker>foo() = 1
}
@@ -0,0 +1,3 @@
<node text="Object (java.lang)">
<node text="no_name_in_PSI_3d19d79d_1ba9_4cd0_b7f5_b46aa3cd5d40 in f() in main.kt ()" base="true"/>
</node>
@@ -0,0 +1,6 @@
class A
fun f() {
A.class<caret>
}
@@ -55,4 +55,12 @@
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused Symbol</problem_class>
<description>Property 'id' is never used</description>
</problem>
<problem>
<file>BadCodeNoExceptions.kt</file>
<line>4</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/BadCodeNoExceptions.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused symbol</problem_class>
<description>Class 'Some' is never used</description>
</problem>
</problems>