[NI] Fix exception for type check callable reference against error type
#KT-32029 Fixed #EA-145311 Fixed
This commit is contained in:
+5
@@ -1704,6 +1704,11 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
|
|||||||
runTest("compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.kt");
|
runTest("compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("noExceptionOnRedCodeWithArrayLikeCall.kt")
|
||||||
|
public void testNoExceptionOnRedCodeWithArrayLikeCall() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("packageInLhs.kt")
|
@TestMetadata("packageInLhs.kt")
|
||||||
public void testPackageInLhs() throws Exception {
|
public void testPackageInLhs() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/callableReference/packageInLhs.kt");
|
runTest("compiler/testData/diagnostics/tests/callableReference/packageInLhs.kt");
|
||||||
|
|||||||
Vendored
+13
@@ -0,0 +1,13 @@
|
|||||||
|
// !LANGUAGE: +NewInference
|
||||||
|
|
||||||
|
class DTO {
|
||||||
|
val q: Int = 0
|
||||||
|
operator fun get(<!UNUSED_PARAMETER!>prop<!>: <!UNRESOLVED_REFERENCE!>KProperty1<!><*, Int>): Int = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo(intDTO: DTO?, <!UNUSED_PARAMETER!>p<!>: <!UNRESOLVED_REFERENCE!>KProperty1<!><*, Int>) {
|
||||||
|
if (intDTO != null) {
|
||||||
|
<!DEBUG_INFO_SMARTCAST!>intDTO<!>[DTO::q]
|
||||||
|
<!DEBUG_INFO_SMARTCAST!>intDTO<!>.q
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+12
@@ -0,0 +1,12 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun foo(/*0*/ intDTO: DTO?, /*1*/ p: [ERROR : KProperty1<*, Int>]<out [ERROR : *], kotlin.Int>): kotlin.Unit
|
||||||
|
|
||||||
|
public final class DTO {
|
||||||
|
public constructor DTO()
|
||||||
|
public final val q: kotlin.Int = 0
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final operator fun get(/*0*/ prop: [ERROR : KProperty1<*, Int>]<out [ERROR : *], kotlin.Int>): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -1711,6 +1711,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.kt");
|
runTest("compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("noExceptionOnRedCodeWithArrayLikeCall.kt")
|
||||||
|
public void testNoExceptionOnRedCodeWithArrayLikeCall() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("packageInLhs.kt")
|
@TestMetadata("packageInLhs.kt")
|
||||||
public void testPackageInLhs() throws Exception {
|
public void testPackageInLhs() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/callableReference/packageInLhs.kt");
|
runTest("compiler/testData/diagnostics/tests/callableReference/packageInLhs.kt");
|
||||||
|
|||||||
Generated
+5
@@ -1706,6 +1706,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
runTest("compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.kt");
|
runTest("compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("noExceptionOnRedCodeWithArrayLikeCall.kt")
|
||||||
|
public void testNoExceptionOnRedCodeWithArrayLikeCall() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("packageInLhs.kt")
|
@TestMetadata("packageInLhs.kt")
|
||||||
public void testPackageInLhs() throws Exception {
|
public void testPackageInLhs() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/callableReference/packageInLhs.kt");
|
runTest("compiler/testData/diagnostics/tests/callableReference/packageInLhs.kt");
|
||||||
|
|||||||
@@ -129,7 +129,10 @@ class ReflectionTypes(module: ModuleDescriptor, private val notFoundClasses: Not
|
|||||||
|
|
||||||
fun isNumberedTypeWithOneOrMoreNumber(type: KotlinType): Boolean {
|
fun isNumberedTypeWithOneOrMoreNumber(type: KotlinType): Boolean {
|
||||||
val descriptor = type.constructor.declarationDescriptor as? ClassDescriptor ?: return false
|
val descriptor = type.constructor.declarationDescriptor as? ClassDescriptor ?: return false
|
||||||
if (DescriptorUtils.getFqName(descriptor).parent().toSafe() != KOTLIN_REFLECT_FQ_NAME) return false
|
val fqName = DescriptorUtils.getFqName(descriptor)
|
||||||
|
if (fqName.isRoot) return false
|
||||||
|
|
||||||
|
if (fqName.parent().toSafe() != KOTLIN_REFLECT_FQ_NAME) return false
|
||||||
val shortName = descriptor.name.asString()
|
val shortName = descriptor.name.asString()
|
||||||
|
|
||||||
for (prefix in PREFIXES) {
|
for (prefix in PREFIXES) {
|
||||||
|
|||||||
Reference in New Issue
Block a user