FIR: Update test-data (Delegate inference)

This commit is contained in:
Simon Ogorodnik
2021-11-22 16:03:08 +03:00
committed by teamcity
parent 951eebcd68
commit 26b158bded
9 changed files with 65 additions and 62 deletions
@@ -84,6 +84,38 @@ digraph delegateWithAnonymousObject_kt {
24 -> {25};
subgraph cluster_9 {
color=red
26 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
27 [label="Enter block"];
28 [label="Enter anonymous object"];
subgraph cluster_11 {
color=blue
33 [label="Enter class <anonymous object>" style="filled" fillcolor=red];
34 [label="Exit class <anonymous object>" style="filled" fillcolor=red];
}
29 [label="Exit anonymous object"];
30 [label="Exit anonymous object expression"];
31 [label="Exit block"];
}
32 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
26 -> {27};
27 -> {28};
27 -> {35 38 45} [color=red];
28 -> {29} [color=red];
28 -> {33} [color=green];
28 -> {33} [style=dashed];
29 -> {30};
29 -> {35 38 45} [color=green];
29 -> {35 38 45} [style=dashed];
30 -> {31};
31 -> {32};
33 -> {34} [color=green];
34 -> {29} [color=green];
subgraph cluster_12 {
color=red
35 [label="Enter function <init>" style="filled" fillcolor=red];
36 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
@@ -190,70 +222,29 @@ digraph delegateWithAnonymousObject_kt {
71 [label="Enter property" style="filled" fillcolor=red];
72 [label="Postponed enter to lambda"];
73 [label="Postponed exit from lambda"];
74 [label="Function call: R?C|/delegate|(...)"];
74 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
75 [label="Access variable this@R|/IssuesListUserProfile|"];
76 [label="Function call: R?C|/delegate|(...).R?C|special/error|(...)"];
77 [label="Postponed enter to lambda"];
subgraph cluster_19 {
color=blue
26 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_20 {
color=blue
27 [label="Enter block"];
28 [label="Enter anonymous object"];
subgraph cluster_21 {
color=blue
33 [label="Enter class <anonymous object>" style="filled" fillcolor=red];
34 [label="Exit class <anonymous object>" style="filled" fillcolor=red];
}
29 [label="Exit anonymous object"];
30 [label="Exit anonymous object expression"];
31 [label="Exit block"];
}
32 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
78 [label="Postponed exit from lambda"];
79 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
80 [label="Exit property" style="filled" fillcolor=red];
76 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...).<Unresolved name: provideDelegate>#(...)"];
77 [label="Exit property" style="filled" fillcolor=red];
}
70 -> {71};
71 -> {72};
71 -> {26} [style=dashed];
71 -> {72};
72 -> {73};
72 -> {} [style=dashed];
72 -> {26} [style=dashed];
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {77};
77 -> {78 26};
77 -> {26} [style=dashed];
78 -> {79};
79 -> {80};
80 -> {83} [color=green];
26 -> {27};
27 -> {28};
27 -> {35 38 45} [color=red];
28 -> {29} [color=red];
28 -> {33} [color=green];
28 -> {33} [style=dashed];
29 -> {30};
29 -> {35 38 45} [color=green];
29 -> {35 38 45} [style=dashed];
30 -> {31};
31 -> {32};
33 -> {34} [color=green];
34 -> {29} [color=green];
77 -> {80} [color=green];
subgraph cluster_22 {
color=red
81 [label="Enter class IssuesListUserProfile" style="filled" fillcolor=red];
82 [label="Part of class initialization"];
83 [label="Exit class IssuesListUserProfile" style="filled" fillcolor=red];
78 [label="Enter class IssuesListUserProfile" style="filled" fillcolor=red];
79 [label="Part of class initialization"];
80 [label="Exit class IssuesListUserProfile" style="filled" fillcolor=red];
}
81 -> {82} [color=green];
82 -> {83} [style=dotted];
82 -> {71} [color=green];
82 -> {71} [style=dashed];
78 -> {79} [color=green];
79 -> {80} [style=dotted];
79 -> {71} [color=green];
79 -> {71} [style=dashed];
}
@@ -10,7 +10,7 @@ fun test() {
<!WRONG_MODIFIER_TARGET!>const<!> val <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS_WARNING!><T><!> a3 = 0
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> val <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS_WARNING!><T><!> a4 = 0
val <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS_WARNING!><T><!> a5 by Delegate<Int>()
val <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS_WARNING!><T><!> a6 by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!>Delegate<<!UNRESOLVED_REFERENCE!>T<!>>()<!>
val <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS_WARNING!><T><!> a6 by Delegate<<!UNRESOLVED_REFERENCE!>T<!>>()
}
class Delegate<F> {
@@ -10,7 +10,7 @@ fun test() {
<!WRONG_MODIFIER_TARGET!>const<!> val <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS!><T><!> a3 = 0
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> val <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS!><T><!> a4 = 0
val <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS!><T><!> a5 by Delegate<Int>()
val <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS!><T><!> a6 by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!>Delegate<<!UNRESOLVED_REFERENCE!>T<!>>()<!>
val <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS!><T><!> a6 by Delegate<<!UNRESOLVED_REFERENCE!>T<!>>()
}
class Delegate<F> {
@@ -3,10 +3,10 @@ package foo
import kotlin.reflect.KProperty
open class A {
val B.w: Int by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>MyProperty<!>()<!>
val B.w: Int by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>MyProperty<!>()<!>
}
val B.r: Int by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>MyProperty<!>()<!>
val B.r: Int by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>MyProperty<!>()<!>
val A.e: Int by MyProperty()
@@ -4,7 +4,7 @@
import kotlin.reflect.KProperty
class B {
val c by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Delegate<!>(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>ag<!>)
val c by Delegate(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>ag<!>)
}
class Delegate<T: Any>(val init: T) {
@@ -0,0 +1,13 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
object T2 {
interface Foo<T>
fun <T> delegate(): Foo<T> = TODO()
operator fun <T> Foo<T>.provideDelegate(host: T2, p: Any?): Foo<T> = TODO()
operator fun <T> Foo<T>.getValue(receiver: String, p: Any?): T = TODO()
val String.test1: String by delegate()
val test2: String by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>delegate<!>()<!>
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
object T2 {
@@ -1,13 +1,13 @@
// WITH_STDLIB
// FILE: test.kt
val bar2 by bar2(<!NO_VALUE_FOR_PARAMETER!>)<!>
val bar2 by <!DELEGATE_SPECIAL_FUNCTION_AMBIGUITY!>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!>)<!>
val bar by <!DELEGATE_SPECIAL_FUNCTION_AMBIGUITY!>bar(<!NO_VALUE_FOR_PARAMETER!>)<!><!>
}
// FILE: lt/neworld/compiler/bar/Bar.kt
@@ -7,6 +7,6 @@ fun interface ReadOnlyProperty<in T, out V> {
}
class Problem {
val variable: Int by <!DELEGATE_SPECIAL_FUNCTION_RETURN_TYPE_MISMATCH, NEW_INFERENCE_ERROR!>delegate()<!> // delegate returns `ReadOnlyProperty<Problem, {CharSequence & Int}>`
val variable: Int by <!NEW_INFERENCE_ERROR!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>delegate<!>()<!> // delegate returns `ReadOnlyProperty<Problem, {CharSequence & Int}>`
fun <T : CharSequence> delegate() = null <!CAST_NEVER_SUCCEEDS!>as<!> ReadOnlyProperty<Problem, T>
}