Fix exception on invalid code, don't resolve uninitialized type

#KT-11963 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2017-09-01 19:22:21 +03:00
parent 6d4bb229ac
commit 4a6f35b9c2
5 changed files with 19 additions and 2 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -853,7 +853,8 @@ class TypeResolver(
if (userType.qualifier != null) { // we must resolve all type references in arguments of qualifier type
for (typeArgument in userType.qualifier!!.typeArguments) {
typeArgument.typeReference?.let {
forceResolveTypeContents(resolveType(scope, it, trace, true))
// in qualified expression, type argument can have bounds only in incorrect code
forceResolveTypeContents(resolveType(scope, it, trace, false))
}
}
}
@@ -0,0 +1 @@
<!MUST_BE_INITIALIZED!>val <<!TYPE_PARAMETER_OF_PROPERTY_NOT_USED_IN_RECEIVER!>T : <!UNRESOLVED_REFERENCE!>KClass<!><T>.<!DEBUG_INFO_MISSING_UNRESOLVED!>something<!><!>> abc<!>
@@ -0,0 +1,3 @@
package
public val </*0*/ T> abc: [ERROR : No type, no body]
@@ -10216,6 +10216,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("kt11963.kt")
public void testKt11963() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/kt11963.kt");
doTest(fileName);
}
@TestMetadata("kt12399.kt")
public void testKt12399() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/kt12399.kt");
@@ -10216,6 +10216,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
doTest(fileName);
}
@TestMetadata("kt11963.kt")
public void testKt11963() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/kt11963.kt");
doTest(fileName);
}
@TestMetadata("kt12399.kt")
public void testKt12399() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/kt12399.kt");