From 26b158bdedf8b348ae1ed5c5c1e1d213f07d9b1d Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Mon, 22 Nov 2021 16:03:08 +0300 Subject: [PATCH] FIR: Update test-data (Delegate inference) --- .../delegates/delegateWithAnonymousObject.dot | 97 +++++++++---------- ...ocalVariablesWithTypeParameters_1_3.fir.kt | 2 +- ...ocalVariablesWithTypeParameters_1_4.fir.kt | 2 +- .../inference/extensionProperty.fir.kt | 4 +- .../propertyDefferedType.fir.kt | 2 +- .../provideDelegate/hostAndReceiver2.fir.kt | 13 +++ .../provideDelegate/hostAndReceiver2.kt | 1 - .../tests/delegation/kt44843.fir.kt | 4 +- .../tests/typeParameters/kt42472.fir.kt | 2 +- 9 files changed, 65 insertions(+), 62 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver2.fir.kt diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.dot b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.dot index 0f496e532db..a091d7b3d06 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.dot +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.dot @@ -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 " style="filled" fillcolor=red]; + 34 [label="Exit class " 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 " style="filled" fillcolor=red]; 36 [label="Delegated constructor call: super()"]; @@ -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|(...)"]; 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 " style="filled" fillcolor=red]; - 34 [label="Exit class " 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|(...)"]; - 80 [label="Exit property" style="filled" fillcolor=red]; + 76 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|(...).#(...)"]; + 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]; } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_3.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_3.fir.kt index 17c60e71162..f651b1bf0dc 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_3.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_3.fir.kt @@ -10,7 +10,7 @@ fun test() { const val a3 = 0 lateinit val a4 = 0 val a5 by Delegate() - val a6 by Delegate<T>() + val a6 by Delegate<T>() } class Delegate { diff --git a/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_4.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_4.fir.kt index 76480ca1c61..1353b8269c4 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_4.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/localVariablesWithTypeParameters_1_4.fir.kt @@ -10,7 +10,7 @@ fun test() { const val a3 = 0 lateinit val a4 = 0 val a5 by Delegate() - val a6 by Delegate<T>() + val a6 by Delegate<T>() } class Delegate { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.fir.kt index 6d6567c8f9c..849db3921d2 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.fir.kt @@ -3,10 +3,10 @@ package foo import kotlin.reflect.KProperty open class A { - val B.w: Int by MyProperty() + val B.w: Int by MyProperty() } -val B.r: Int by MyProperty() +val B.r: Int by MyProperty() val A.e: Int by MyProperty() diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.fir.kt index d2f3400c99b..4e31f63ea74 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.fir.kt @@ -4,7 +4,7 @@ import kotlin.reflect.KProperty class B { - val c by Delegate(ag) + val c by Delegate(ag) } class Delegate(val init: T) { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver2.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver2.fir.kt new file mode 100644 index 00000000000..4a4fe2bf30e --- /dev/null +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver2.fir.kt @@ -0,0 +1,13 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +object T2 { + interface Foo + + fun delegate(): Foo = TODO() + + operator fun Foo.provideDelegate(host: T2, p: Any?): Foo = TODO() + operator fun Foo.getValue(receiver: String, p: Any?): T = TODO() + + val String.test1: String by delegate() + val test2: String by delegate() +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver2.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver2.kt index 72808b722b1..88fd51b3f3b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver2.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver2.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER object T2 { diff --git a/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt b/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt index 8c803bcde67..42fa89052bf 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt @@ -1,13 +1,13 @@ // WITH_STDLIB // FILE: test.kt -val bar2 by bar2() +val bar2 by bar2() // FILE: lt/neworld/compiler/Foo.kt package lt.neworld.compiler class Foo { - val bar by bar() + val bar by bar() } // FILE: lt/neworld/compiler/bar/Bar.kt diff --git a/compiler/testData/diagnostics/tests/typeParameters/kt42472.fir.kt b/compiler/testData/diagnostics/tests/typeParameters/kt42472.fir.kt index 00766fb7a93..7ba4db86fee 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/kt42472.fir.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/kt42472.fir.kt @@ -7,6 +7,6 @@ fun interface ReadOnlyProperty { } class Problem { - val variable: Int by delegate() // delegate returns `ReadOnlyProperty` + val variable: Int by delegate() // delegate returns `ReadOnlyProperty` fun delegate() = null as ReadOnlyProperty }