Fix TCE for invalid code with wrong callee expression

#KT-14927 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2017-05-08 03:09:33 +03:00
parent 0032719ab9
commit dbfea9b787
6 changed files with 25 additions and 3 deletions
@@ -276,9 +276,11 @@ class QualifiedExpressionResolver {
return true
}
if (doubleColonLHS && expression is KtCallExpression && expression.isWithoutValueArguments) {
val simpleName = expression.calleeExpression as KtSimpleNameExpression
result.add(QualifierPart(simpleName.getReferencedNameAsName(), simpleName, expression.typeArgumentList))
return true
val simpleName = expression.calleeExpression
if (simpleName is KtSimpleNameExpression) {
result.add(QualifierPart(simpleName.getReferencedNameAsName(), simpleName, expression.typeArgumentList))
return true
}
}
return false
}
@@ -0,0 +1 @@
val unwrapped = <!UNRESOLVED_REFERENCE!>some<!><!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!><<!><!DEBUG_INFO_MISSING_UNRESOLVED!>sdf<!>()()<out <!DEBUG_INFO_MISSING_UNRESOLVED!>Any<!>>::<!UNRESOLVED_REFERENCE!>unwrap<!>
@@ -0,0 +1,3 @@
package
public val unwrapped: [ERROR : Type for some<sdf()()<out Any>::unwrap]
@@ -0,0 +1 @@
val unwrapped = <!UNRESOLVED_REFERENCE!>some<!>.<!SYNTAX!><<!><!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>cabc<!><!SYNTAX!>$Wrapper<!><out <!DEBUG_INFO_MISSING_UNRESOLVED!>Any<!>>::<!UNRESOLVED_REFERENCE!>unwrap<!>
@@ -0,0 +1,3 @@
package
public val unwrapped: [ERROR : <ERROR FUNCTION RETURN TYPE>]
@@ -15946,6 +15946,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/qualifiedExpression"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("calleeExpressionAsCallExpression.kt")
public void testCalleeExpressionAsCallExpression() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/qualifiedExpression/calleeExpressionAsCallExpression.kt");
doTest(fileName);
}
@TestMetadata("GenericClassVsPackage.kt")
public void testGenericClassVsPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/qualifiedExpression/GenericClassVsPackage.kt");
@@ -15958,6 +15964,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("nullCalleeExpression.kt")
public void testNullCalleeExpression() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/qualifiedExpression/nullCalleeExpression.kt");
doTest(fileName);
}
@TestMetadata("PackageVsClass.kt")
public void testPackageVsClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/qualifiedExpression/PackageVsClass.kt");