Fix NPE in checkLValue when selector is absent. Add test for incomplete syntax.

This commit is contained in:
Ilya Ryzhenkov
2015-08-12 13:34:19 +03:00
parent 8104a78746
commit a717afd9db
3 changed files with 11 additions and 2 deletions
@@ -913,8 +913,11 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
boolean result = true;
JetExpression reportOn = expression != null ? expression : expressionWithParenthesis;
if (reportOn instanceof JetQualifiedExpression)
reportOn = ((JetQualifiedExpression)reportOn).getSelectorExpression();
if (reportOn instanceof JetQualifiedExpression) {
JetExpression selector = ((JetQualifiedExpression) reportOn).getSelectorExpression();
if (selector != null)
reportOn = selector;
}
if (variable instanceof PropertyDescriptor) {
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) variable;
@@ -91,6 +91,11 @@ class Test() {
s += (a@ 2)
}
fun testIncompleteSyntax() {
val s = "s"
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>++<!>s.<!SYNTAX!><!>
}
fun testVariables() {
var a: Int = 34
val b: Int = 34
@@ -67,6 +67,7 @@ package lvalue_assignment {
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 testIllegalValues(): kotlin.Unit
internal final fun testIncompleteSyntax(): kotlin.Unit
internal final fun testVariables(): kotlin.Unit
internal final fun testVariables1(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String