Fix NPE in checkLValue when selector is absent. Add test for incomplete syntax.
This commit is contained in:
+5
-2
@@ -913,8 +913,11 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
|
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
JetExpression reportOn = expression != null ? expression : expressionWithParenthesis;
|
JetExpression reportOn = expression != null ? expression : expressionWithParenthesis;
|
||||||
if (reportOn instanceof JetQualifiedExpression)
|
if (reportOn instanceof JetQualifiedExpression) {
|
||||||
reportOn = ((JetQualifiedExpression)reportOn).getSelectorExpression();
|
JetExpression selector = ((JetQualifiedExpression) reportOn).getSelectorExpression();
|
||||||
|
if (selector != null)
|
||||||
|
reportOn = selector;
|
||||||
|
}
|
||||||
|
|
||||||
if (variable instanceof PropertyDescriptor) {
|
if (variable instanceof PropertyDescriptor) {
|
||||||
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) variable;
|
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) variable;
|
||||||
|
|||||||
@@ -91,6 +91,11 @@ class Test() {
|
|||||||
s += (a@ 2)
|
s += (a@ 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testIncompleteSyntax() {
|
||||||
|
val s = "s"
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>++<!>s.<!SYNTAX!><!>
|
||||||
|
}
|
||||||
|
|
||||||
fun testVariables() {
|
fun testVariables() {
|
||||||
var a: Int = 34
|
var a: Int = 34
|
||||||
val b: Int = 34
|
val b: Int = 34
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ package lvalue_assignment {
|
|||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
internal final fun testArrays(/*0*/ a: kotlin.Array<kotlin.Int>, /*1*/ ab: lvalue_assignment.Ab): kotlin.Unit
|
internal final fun testArrays(/*0*/ a: kotlin.Array<kotlin.Int>, /*1*/ ab: lvalue_assignment.Ab): kotlin.Unit
|
||||||
internal final fun testIllegalValues(): kotlin.Unit
|
internal final fun testIllegalValues(): kotlin.Unit
|
||||||
|
internal final fun testIncompleteSyntax(): kotlin.Unit
|
||||||
internal final fun testVariables(): kotlin.Unit
|
internal final fun testVariables(): kotlin.Unit
|
||||||
internal final fun testVariables1(): kotlin.Unit
|
internal final fun testVariables1(): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|||||||
Reference in New Issue
Block a user