NI: don't collect members if a receiver type is StubType to avoid creating error candidates instead of not crating them at all
^KT-37717 Fixed
This commit is contained in:
+5
@@ -10409,6 +10409,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
|||||||
runTest("compiler/testData/diagnostics/tests/inference/returningLambdaInSuspendContext.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/returningLambdaInSuspendContext.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt")
|
||||||
|
public void testSkipedUnresolvedInBuilderInferenceWithStubReceiverType() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("starApproximation.kt")
|
@TestMetadata("starApproximation.kt")
|
||||||
public void testStarApproximation() throws Exception {
|
public void testStarApproximation() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
||||||
|
|||||||
@@ -90,8 +90,14 @@ internal class MemberScopeTowerLevel(
|
|||||||
private fun collectMembers(
|
private fun collectMembers(
|
||||||
getMembers: ResolutionScope.(KotlinType?) -> Collection<CallableDescriptor>
|
getMembers: ResolutionScope.(KotlinType?) -> Collection<CallableDescriptor>
|
||||||
): Collection<CandidateWithBoundDispatchReceiver> {
|
): Collection<CandidateWithBoundDispatchReceiver> {
|
||||||
val result = ArrayList<CandidateWithBoundDispatchReceiver>(0)
|
|
||||||
val receiverValue = dispatchReceiver.receiverValue
|
val receiverValue = dispatchReceiver.receiverValue
|
||||||
|
|
||||||
|
if (receiverValue.type is StubType) {
|
||||||
|
return arrayListOf()
|
||||||
|
}
|
||||||
|
|
||||||
|
val result = ArrayList<CandidateWithBoundDispatchReceiver>(0)
|
||||||
|
|
||||||
receiverValue.type.memberScope.getMembers(receiverValue.type).mapTo(result) {
|
receiverValue.type.memberScope.getMembers(receiverValue.type).mapTo(result) {
|
||||||
createCandidateDescriptor(it, dispatchReceiver)
|
createCandidateDescriptor(it, dispatchReceiver)
|
||||||
}
|
}
|
||||||
|
|||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -EXPERIMENTAL_IS_NOT_ENABLED
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
import kotlin.experimental.ExperimentalTypeInference
|
||||||
|
|
||||||
|
@OptIn(ExperimentalTypeInference::class)
|
||||||
|
fun <T> foo(x: T, @BuilderInference builder: T.() -> Unit): Unit = TODO()
|
||||||
|
|
||||||
|
class Bar<T>
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
foo(1) {
|
||||||
|
<!UNRESOLVED_REFERENCE!>dsgfsdg<!>
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -EXPERIMENTAL_IS_NOT_ENABLED
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
import kotlin.experimental.ExperimentalTypeInference
|
||||||
|
|
||||||
|
@OptIn(ExperimentalTypeInference::class)
|
||||||
|
fun <T> foo(x: T, @BuilderInference builder: T.() -> Unit): Unit = TODO()
|
||||||
|
|
||||||
|
class Bar<T>
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
foo(1) {
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, DEBUG_INFO_UNRESOLVED_WITH_TARGET, UNRESOLVED_REFERENCE!>dsgfsdg<!>
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ T> foo(/*0*/ x: T, /*1*/ @kotlin.BuilderInference builder: T.() -> kotlin.Unit): kotlin.Unit
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
|
||||||
|
public final class Bar</*0*/ T> {
|
||||||
|
public constructor Bar</*0*/ T>()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+1
-1
@@ -15,6 +15,6 @@ fun <KotlinType : Any> defineType(@BuilderInference definition: TypeDefinition<K
|
|||||||
fun main() {
|
fun main() {
|
||||||
<!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>defineType<!> {
|
<!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>defineType<!> {
|
||||||
parse { it.toInt() }
|
parse { it.toInt() }
|
||||||
serialize { <!OI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>it<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>toString<!>() }
|
serialize { <!OI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>it<!>.<!OI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>toString<!>() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10416,6 +10416,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali
|
|||||||
runTest("compiler/testData/diagnostics/tests/inference/returningLambdaInSuspendContext.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/returningLambdaInSuspendContext.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt")
|
||||||
|
public void testSkipedUnresolvedInBuilderInferenceWithStubReceiverType() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("starApproximation.kt")
|
@TestMetadata("starApproximation.kt")
|
||||||
public void testStarApproximation() throws Exception {
|
public void testStarApproximation() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
||||||
|
|||||||
Generated
+5
@@ -10411,6 +10411,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
runTest("compiler/testData/diagnostics/tests/inference/returningLambdaInSuspendContext.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/returningLambdaInSuspendContext.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt")
|
||||||
|
public void testSkipedUnresolvedInBuilderInferenceWithStubReceiverType() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("starApproximation.kt")
|
@TestMetadata("starApproximation.kt")
|
||||||
public void testStarApproximation() throws Exception {
|
public void testStarApproximation() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
||||||
|
|||||||
Generated
+5
@@ -41,6 +41,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("constValInAnnotation.kt")
|
||||||
|
public void testConstValInAnnotation() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/annotations/constValInAnnotation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedAnnotation.kt")
|
@TestMetadata("nestedAnnotation.kt")
|
||||||
public void testNestedAnnotation() throws Exception {
|
public void testNestedAnnotation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/annotations/nestedAnnotation.kt");
|
runTest("compiler/testData/codegen/box/annotations/nestedAnnotation.kt");
|
||||||
|
|||||||
Generated
+5
@@ -41,6 +41,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("constValInAnnotation.kt")
|
||||||
|
public void testConstValInAnnotation() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/annotations/constValInAnnotation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedAnnotation.kt")
|
@TestMetadata("nestedAnnotation.kt")
|
||||||
public void testNestedAnnotation() throws Exception {
|
public void testNestedAnnotation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/annotations/nestedAnnotation.kt");
|
runTest("compiler/testData/codegen/box/annotations/nestedAnnotation.kt");
|
||||||
|
|||||||
+5
@@ -41,6 +41,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("constValInAnnotation.kt")
|
||||||
|
public void testConstValInAnnotation() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/annotations/constValInAnnotation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedAnnotation.kt")
|
@TestMetadata("nestedAnnotation.kt")
|
||||||
public void testNestedAnnotation() throws Exception {
|
public void testNestedAnnotation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/annotations/nestedAnnotation.kt");
|
runTest("compiler/testData/codegen/box/annotations/nestedAnnotation.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user