Commit delegation expression's trace with errors if we couldn't extract type info for it

^KT-44843 Fixed
This commit is contained in:
Victor Petukhov
2021-09-22 13:50:13 +03:00
parent 561ef5947a
commit 2bdbbdd1a7
8 changed files with 107 additions and 3 deletions
@@ -8355,6 +8355,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/delegation/kt40510.kt");
}
@Test
@TestMetadata("kt44843.kt")
public void testKt44843() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegation/kt44843.kt");
}
@Test
@TestMetadata("kt8154.kt")
public void testKt8154() throws Exception {
@@ -8355,6 +8355,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/delegation/kt40510.kt");
}
@Test
@TestMetadata("kt44843.kt")
public void testKt44843() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegation/kt44843.kt");
}
@Test
@TestMetadata("kt8154.kt")
public void testKt8154() throws Exception {
@@ -560,7 +560,11 @@ class DelegatedPropertyResolver(
traceToResolveDelegatedProperty, false, delegateExpression, ContextDependency.DEPENDENT
)
var delegateType = delegateTypeInfo.type ?: return null
var delegateType = delegateTypeInfo.type ?: run {
traceToResolveDelegatedProperty.commit()
return null
}
var delegateDataFlow = delegateTypeInfo.dataFlowInfo
val delegateTypeConstructor = delegateType.constructor
@@ -3,12 +3,12 @@
import kotlin.reflect.KProperty
val a by <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!>
val a by <!DEBUG_INFO_MISSING_UNRESOLVED, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>a<!>
val b by Delegate(<!DEBUG_INFO_MISSING_UNRESOLVED, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>b<!>)
val c by <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, UNINITIALIZED_VARIABLE!>d<!>
val d by <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>c<!>
val d by <!DEBUG_INFO_MISSING_UNRESOLVED, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>c<!>
class Delegate(i: Int) {
operator fun getValue(t: Any?, p: KProperty<*>): Int {
@@ -0,0 +1,25 @@
// WITH_RUNTIME
// FILE: test.kt
val bar2 by bar2(<!NO_VALUE_FOR_PARAMETER!>)<!>
// FILE: lt/neworld/compiler/Foo.kt
package lt.neworld.compiler
class Foo {
val bar by bar(<!NO_VALUE_FOR_PARAMETER!>)<!>
}
// FILE: lt/neworld/compiler/bar/Bar.kt
package lt.neworld.compiler.bar
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
fun <T, V> bar() = Bar<T, V>()
class Bar<T, V> : ReadOnlyProperty<T, V> {
override fun getValue(thisRef: T, property: KProperty<*>): V {
TODO("Not yet implemented")
}
}
@@ -0,0 +1,25 @@
// WITH_RUNTIME
// FILE: test.kt
val bar2 by <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>bar2<!>()<!>
// FILE: lt/neworld/compiler/Foo.kt
package lt.neworld.compiler
class Foo {
val bar by <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!>()<!>
}
// FILE: lt/neworld/compiler/bar/Bar.kt
package lt.neworld.compiler.bar
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
fun <T, V> bar() = Bar<T, V>()
class Bar<T, V> : ReadOnlyProperty<T, V> {
override fun getValue(thisRef: T, property: KProperty<*>): V {
TODO("Not yet implemented")
}
}
@@ -0,0 +1,32 @@
package
public val bar2: [ERROR : <ERROR FUNCTION RETURN TYPE>]
package lt {
package lt.neworld {
package lt.neworld.compiler {
public final class Foo {
public constructor Foo()
public final val bar: [ERROR : <ERROR FUNCTION RETURN TYPE>]
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
}
package lt.neworld.compiler.bar {
public fun </*0*/ T, /*1*/ V> bar(): lt.neworld.compiler.bar.Bar<T, V>
public final class Bar</*0*/ T, /*1*/ V> : kotlin.properties.ReadOnlyProperty<T, V> {
public constructor Bar</*0*/ T, /*1*/ V>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ fun getValue(/*0*/ thisRef: T, /*1*/ property: kotlin.reflect.KProperty<*>): V
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
}
}
}
@@ -8361,6 +8361,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/delegation/kt40510.kt");
}
@Test
@TestMetadata("kt44843.kt")
public void testKt44843() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegation/kt44843.kt");
}
@Test
@TestMetadata("kt8154.kt")
public void testKt8154() throws Exception {