[FIR] Fix ambiguity between Sequence.forEach and Iterable.forEach (with @HidesMembers) ^KT-50776 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
4a200a2d7e
commit
defb0cf611
+6
@@ -25721,6 +25721,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/resolve/priority/memberVsLocalExt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberWithHidesMemberAnnotationVsMemberWithout.kt")
|
||||
public void testMemberWithHidesMemberAnnotationVsMemberWithout() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/resolve/priority/memberWithHidesMemberAnnotationVsMemberWithout.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticVsImplicitReceiverMember.kt")
|
||||
public void testStaticVsImplicitReceiverMember() throws Exception {
|
||||
|
||||
+155
-169
@@ -19,102 +19,88 @@ digraph complex_kt {
|
||||
|
||||
subgraph cluster_2 {
|
||||
color=red
|
||||
4 [label="Enter function addSuppressed" style="filled" fillcolor=red];
|
||||
4 [label="Enter function closeFinally" style="filled" fillcolor=red];
|
||||
subgraph cluster_3 {
|
||||
color=blue
|
||||
5 [label="Enter block"];
|
||||
6 [label="Exit block"];
|
||||
}
|
||||
7 [label="Exit function addSuppressed" style="filled" fillcolor=red];
|
||||
}
|
||||
4 -> {5};
|
||||
5 -> {6};
|
||||
6 -> {7};
|
||||
|
||||
subgraph cluster_4 {
|
||||
color=red
|
||||
8 [label="Enter function closeFinally" style="filled" fillcolor=red];
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
9 [label="Enter block"];
|
||||
subgraph cluster_6 {
|
||||
subgraph cluster_4 {
|
||||
color=blue
|
||||
10 [label="Enter when"];
|
||||
6 [label="Enter when"];
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
7 [label="Enter when branch condition "];
|
||||
8 [label="Access variable this@R|/closeFinally|"];
|
||||
9 [label="Const: Null(null)"];
|
||||
10 [label="Equality operator =="];
|
||||
11 [label="Exit when branch condition"];
|
||||
}
|
||||
subgraph cluster_6 {
|
||||
color=blue
|
||||
12 [label="Enter when branch condition "];
|
||||
13 [label="Access variable R|<local>/cause|"];
|
||||
14 [label="Const: Null(null)"];
|
||||
15 [label="Equality operator =="];
|
||||
16 [label="Exit when branch condition"];
|
||||
}
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
11 [label="Enter when branch condition "];
|
||||
12 [label="Access variable this@R|/closeFinally|"];
|
||||
13 [label="Const: Null(null)"];
|
||||
14 [label="Equality operator =="];
|
||||
15 [label="Exit when branch condition"];
|
||||
17 [label="Enter when branch condition else"];
|
||||
18 [label="Exit when branch condition"];
|
||||
}
|
||||
19 [label="Enter when branch result"];
|
||||
subgraph cluster_8 {
|
||||
color=blue
|
||||
16 [label="Enter when branch condition "];
|
||||
17 [label="Access variable R|<local>/cause|"];
|
||||
18 [label="Const: Null(null)"];
|
||||
19 [label="Equality operator =="];
|
||||
20 [label="Exit when branch condition"];
|
||||
}
|
||||
subgraph cluster_9 {
|
||||
color=blue
|
||||
21 [label="Enter when branch condition else"];
|
||||
22 [label="Exit when branch condition"];
|
||||
}
|
||||
23 [label="Enter when branch result"];
|
||||
subgraph cluster_10 {
|
||||
color=blue
|
||||
24 [label="Enter block"];
|
||||
subgraph cluster_11 {
|
||||
20 [label="Enter block"];
|
||||
subgraph cluster_9 {
|
||||
color=blue
|
||||
25 [label="Try expression enter"];
|
||||
21 [label="Try expression enter"];
|
||||
subgraph cluster_10 {
|
||||
color=blue
|
||||
22 [label="Try main block enter"];
|
||||
subgraph cluster_11 {
|
||||
color=blue
|
||||
23 [label="Enter block"];
|
||||
24 [label="Function call: this@R|/closeFinally|.R|/AutoCloseable.close|()"];
|
||||
25 [label="Exit block"];
|
||||
}
|
||||
26 [label="Try main block exit"];
|
||||
}
|
||||
subgraph cluster_12 {
|
||||
color=blue
|
||||
26 [label="Try main block enter"];
|
||||
27 [label="Catch enter"];
|
||||
subgraph cluster_13 {
|
||||
color=blue
|
||||
27 [label="Enter block"];
|
||||
28 [label="Function call: this@R|/closeFinally|.R|/AutoCloseable.close|()"];
|
||||
29 [label="Exit block"];
|
||||
28 [label="Enter block"];
|
||||
29 [label="Access variable R|<local>/cause|"];
|
||||
30 [label="Access variable R|<local>/closeException|"];
|
||||
31 [label="Function call: R|<local>/cause|.R|kotlin/Throwable.addSuppressed|(...)"];
|
||||
32 [label="Exit block"];
|
||||
}
|
||||
30 [label="Try main block exit"];
|
||||
33 [label="Catch exit"];
|
||||
}
|
||||
subgraph cluster_14 {
|
||||
color=blue
|
||||
31 [label="Catch enter"];
|
||||
subgraph cluster_15 {
|
||||
color=blue
|
||||
32 [label="Enter block"];
|
||||
33 [label="Access variable R|<local>/cause|"];
|
||||
34 [label="Access variable R|<local>/closeException|"];
|
||||
35 [label="Function call: R|<local>/cause|.R|/addSuppressed|(...)"];
|
||||
36 [label="Exit block"];
|
||||
}
|
||||
37 [label="Catch exit"];
|
||||
}
|
||||
38 [label="Try expression exit"];
|
||||
34 [label="Try expression exit"];
|
||||
}
|
||||
39 [label="Exit block"];
|
||||
35 [label="Exit block"];
|
||||
}
|
||||
40 [label="Exit when branch result"];
|
||||
41 [label="Enter when branch result"];
|
||||
subgraph cluster_16 {
|
||||
36 [label="Exit when branch result"];
|
||||
37 [label="Enter when branch result"];
|
||||
subgraph cluster_14 {
|
||||
color=blue
|
||||
42 [label="Enter block"];
|
||||
43 [label="Function call: this@R|/closeFinally|.R|/AutoCloseable.close|()"];
|
||||
38 [label="Enter block"];
|
||||
39 [label="Function call: this@R|/closeFinally|.R|/AutoCloseable.close|()"];
|
||||
40 [label="Exit block"];
|
||||
}
|
||||
41 [label="Exit when branch result"];
|
||||
42 [label="Enter when branch result"];
|
||||
subgraph cluster_15 {
|
||||
color=blue
|
||||
43 [label="Enter block"];
|
||||
44 [label="Exit block"];
|
||||
}
|
||||
45 [label="Exit when branch result"];
|
||||
46 [label="Enter when branch result"];
|
||||
subgraph cluster_17 {
|
||||
color=blue
|
||||
47 [label="Enter block"];
|
||||
48 [label="Exit block"];
|
||||
}
|
||||
49 [label="Exit when branch result"];
|
||||
50 [label="Exit when"];
|
||||
46 [label="Exit when"];
|
||||
}
|
||||
51 [label="Jump: ^closeFinally when () {
|
||||
47 [label="Jump: ^closeFinally when () {
|
||||
==(this@R|/closeFinally|, Null(null)) -> {
|
||||
}
|
||||
==(R|<local>/cause|, Null(null)) -> {
|
||||
@@ -125,174 +111,174 @@ digraph complex_kt {
|
||||
this@R|/closeFinally|.R|/AutoCloseable.close|()
|
||||
}
|
||||
catch (closeException: R|kotlin/Throwable|) {
|
||||
R|<local>/cause|.R|/addSuppressed|(R|<local>/closeException|)
|
||||
R|<local>/cause|.R|kotlin/Throwable.addSuppressed|(R|<local>/closeException|)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
"];
|
||||
52 [label="Stub" style="filled" fillcolor=gray];
|
||||
53 [label="Exit block" style="filled" fillcolor=gray];
|
||||
48 [label="Stub" style="filled" fillcolor=gray];
|
||||
49 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
54 [label="Exit function closeFinally" style="filled" fillcolor=red];
|
||||
50 [label="Exit function closeFinally" style="filled" fillcolor=red];
|
||||
}
|
||||
4 -> {5};
|
||||
5 -> {6};
|
||||
6 -> {7};
|
||||
7 -> {8};
|
||||
8 -> {9};
|
||||
9 -> {10};
|
||||
10 -> {11};
|
||||
11 -> {12};
|
||||
11 -> {42 12};
|
||||
12 -> {13};
|
||||
13 -> {14};
|
||||
14 -> {15};
|
||||
15 -> {46 16};
|
||||
16 -> {17};
|
||||
15 -> {16};
|
||||
16 -> {37 17};
|
||||
17 -> {18};
|
||||
18 -> {19};
|
||||
19 -> {20};
|
||||
20 -> {41 21};
|
||||
21 -> {22};
|
||||
20 -> {21};
|
||||
21 -> {22 27};
|
||||
22 -> {23};
|
||||
23 -> {24};
|
||||
24 -> {25};
|
||||
25 -> {26 31};
|
||||
26 -> {27};
|
||||
25 -> {26};
|
||||
26 -> {34 27};
|
||||
27 -> {28};
|
||||
27 -> {50} [label=onUncaughtException];
|
||||
28 -> {29};
|
||||
29 -> {30};
|
||||
30 -> {38 31};
|
||||
30 -> {31};
|
||||
31 -> {32};
|
||||
31 -> {54} [label=onUncaughtException];
|
||||
32 -> {33};
|
||||
33 -> {34};
|
||||
34 -> {35};
|
||||
35 -> {36};
|
||||
36 -> {37};
|
||||
36 -> {46};
|
||||
37 -> {38};
|
||||
38 -> {39};
|
||||
39 -> {40};
|
||||
40 -> {50};
|
||||
41 -> {42};
|
||||
40 -> {41};
|
||||
41 -> {46};
|
||||
42 -> {43};
|
||||
43 -> {44};
|
||||
44 -> {45};
|
||||
45 -> {50};
|
||||
45 -> {46};
|
||||
46 -> {47};
|
||||
47 -> {48};
|
||||
48 -> {49};
|
||||
49 -> {50};
|
||||
50 -> {51};
|
||||
51 -> {54};
|
||||
51 -> {52} [style=dotted];
|
||||
52 -> {53} [style=dotted];
|
||||
53 -> {54} [style=dotted];
|
||||
47 -> {50};
|
||||
47 -> {48} [style=dotted];
|
||||
48 -> {49} [style=dotted];
|
||||
49 -> {50} [style=dotted];
|
||||
|
||||
subgraph cluster_18 {
|
||||
subgraph cluster_16 {
|
||||
color=red
|
||||
55 [label="Enter function firstIsInstanceOrNull" style="filled" fillcolor=red];
|
||||
subgraph cluster_19 {
|
||||
51 [label="Enter function firstIsInstanceOrNull" style="filled" fillcolor=red];
|
||||
subgraph cluster_17 {
|
||||
color=blue
|
||||
56 [label="Enter block"];
|
||||
subgraph cluster_20 {
|
||||
52 [label="Enter block"];
|
||||
subgraph cluster_18 {
|
||||
color=blue
|
||||
57 [label="Enter block"];
|
||||
58 [label="Access variable this@R|/firstIsInstanceOrNull|"];
|
||||
59 [label="Function call: this@R|/firstIsInstanceOrNull|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<CapturedType(*)>|>|()"];
|
||||
60 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>|"];
|
||||
subgraph cluster_21 {
|
||||
53 [label="Enter block"];
|
||||
54 [label="Access variable this@R|/firstIsInstanceOrNull|"];
|
||||
55 [label="Function call: this@R|/firstIsInstanceOrNull|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<CapturedType(*)>|>|()"];
|
||||
56 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>|"];
|
||||
subgraph cluster_19 {
|
||||
color=blue
|
||||
61 [label="Enter while loop"];
|
||||
subgraph cluster_22 {
|
||||
57 [label="Enter while loop"];
|
||||
subgraph cluster_20 {
|
||||
color=blue
|
||||
62 [label="Enter loop condition"];
|
||||
63 [label="Access variable R|<local>/<iterator>|"];
|
||||
64 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()"];
|
||||
65 [label="Exit loop condition"];
|
||||
58 [label="Enter loop condition"];
|
||||
59 [label="Access variable R|<local>/<iterator>|"];
|
||||
60 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()"];
|
||||
61 [label="Exit loop condition"];
|
||||
}
|
||||
subgraph cluster_23 {
|
||||
subgraph cluster_21 {
|
||||
color=blue
|
||||
66 [label="Enter loop block"];
|
||||
subgraph cluster_24 {
|
||||
62 [label="Enter loop block"];
|
||||
subgraph cluster_22 {
|
||||
color=blue
|
||||
67 [label="Enter block"];
|
||||
68 [label="Access variable R|<local>/<iterator>|"];
|
||||
69 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()"];
|
||||
70 [label="Variable declaration: lval element: R|kotlin/Any?|"];
|
||||
subgraph cluster_25 {
|
||||
63 [label="Enter block"];
|
||||
64 [label="Access variable R|<local>/<iterator>|"];
|
||||
65 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()"];
|
||||
66 [label="Variable declaration: lval element: R|kotlin/Any?|"];
|
||||
subgraph cluster_23 {
|
||||
color=blue
|
||||
71 [label="Enter when"];
|
||||
subgraph cluster_26 {
|
||||
67 [label="Enter when"];
|
||||
subgraph cluster_24 {
|
||||
color=blue
|
||||
72 [label="Enter when branch condition "];
|
||||
73 [label="Access variable R|<local>/element|"];
|
||||
74 [label="Type operator: (R|<local>/element| is R|T|)"];
|
||||
75 [label="Exit when branch condition"];
|
||||
68 [label="Enter when branch condition "];
|
||||
69 [label="Access variable R|<local>/element|"];
|
||||
70 [label="Type operator: (R|<local>/element| is R|T|)"];
|
||||
71 [label="Exit when branch condition"];
|
||||
}
|
||||
76 [label="Synthetic else branch"];
|
||||
77 [label="Enter when branch result"];
|
||||
subgraph cluster_27 {
|
||||
72 [label="Synthetic else branch"];
|
||||
73 [label="Enter when branch result"];
|
||||
subgraph cluster_25 {
|
||||
color=blue
|
||||
78 [label="Enter block"];
|
||||
79 [label="Access variable R|<local>/element|"];
|
||||
80 [label="Jump: ^firstIsInstanceOrNull R|<local>/element|"];
|
||||
81 [label="Stub" style="filled" fillcolor=gray];
|
||||
82 [label="Exit block" style="filled" fillcolor=gray];
|
||||
74 [label="Enter block"];
|
||||
75 [label="Access variable R|<local>/element|"];
|
||||
76 [label="Jump: ^firstIsInstanceOrNull R|<local>/element|"];
|
||||
77 [label="Stub" style="filled" fillcolor=gray];
|
||||
78 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
83 [label="Exit when branch result" style="filled" fillcolor=gray];
|
||||
84 [label="Exit when"];
|
||||
79 [label="Exit when branch result" style="filled" fillcolor=gray];
|
||||
80 [label="Exit when"];
|
||||
}
|
||||
85 [label="Exit block"];
|
||||
81 [label="Exit block"];
|
||||
}
|
||||
86 [label="Exit loop block"];
|
||||
82 [label="Exit loop block"];
|
||||
}
|
||||
87 [label="Exit whileloop"];
|
||||
83 [label="Exit whileloop"];
|
||||
}
|
||||
88 [label="Exit block"];
|
||||
84 [label="Exit block"];
|
||||
}
|
||||
89 [label="Const: Null(null)"];
|
||||
90 [label="Jump: ^firstIsInstanceOrNull Null(null)"];
|
||||
91 [label="Stub" style="filled" fillcolor=gray];
|
||||
92 [label="Exit block" style="filled" fillcolor=gray];
|
||||
85 [label="Const: Null(null)"];
|
||||
86 [label="Jump: ^firstIsInstanceOrNull Null(null)"];
|
||||
87 [label="Stub" style="filled" fillcolor=gray];
|
||||
88 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
93 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red];
|
||||
89 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red];
|
||||
}
|
||||
51 -> {52};
|
||||
52 -> {53};
|
||||
53 -> {54};
|
||||
54 -> {55};
|
||||
55 -> {56};
|
||||
56 -> {57};
|
||||
57 -> {58};
|
||||
58 -> {59};
|
||||
59 -> {60};
|
||||
60 -> {61};
|
||||
61 -> {62};
|
||||
61 -> {83 62};
|
||||
62 -> {63};
|
||||
63 -> {64};
|
||||
64 -> {65};
|
||||
65 -> {87 66};
|
||||
65 -> {66};
|
||||
66 -> {67};
|
||||
67 -> {68};
|
||||
68 -> {69};
|
||||
69 -> {70};
|
||||
70 -> {71};
|
||||
71 -> {72};
|
||||
72 -> {73};
|
||||
71 -> {73 72};
|
||||
72 -> {80};
|
||||
73 -> {74};
|
||||
74 -> {75};
|
||||
75 -> {77 76};
|
||||
76 -> {84};
|
||||
77 -> {78};
|
||||
78 -> {79};
|
||||
79 -> {80};
|
||||
80 -> {93};
|
||||
80 -> {81} [style=dotted];
|
||||
81 -> {82} [style=dotted];
|
||||
82 -> {83} [style=dotted];
|
||||
83 -> {84} [style=dotted];
|
||||
75 -> {76};
|
||||
76 -> {89};
|
||||
76 -> {77} [style=dotted];
|
||||
77 -> {78} [style=dotted];
|
||||
78 -> {79} [style=dotted];
|
||||
79 -> {80} [style=dotted];
|
||||
80 -> {81};
|
||||
81 -> {82};
|
||||
82 -> {58} [color=green style=dashed];
|
||||
83 -> {84};
|
||||
84 -> {85};
|
||||
85 -> {86};
|
||||
86 -> {62} [color=green style=dashed];
|
||||
87 -> {88};
|
||||
88 -> {89};
|
||||
89 -> {90};
|
||||
90 -> {93};
|
||||
90 -> {91} [style=dotted];
|
||||
91 -> {92} [style=dotted];
|
||||
92 -> {93} [style=dotted];
|
||||
86 -> {89};
|
||||
86 -> {87} [style=dotted];
|
||||
87 -> {88} [style=dotted];
|
||||
88 -> {89} [style=dotted];
|
||||
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ FILE: complex.kt
|
||||
public abstract interface AutoCloseable : R|kotlin/Any| {
|
||||
public abstract fun close(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public final fun R|kotlin/Throwable|.addSuppressed(other: R|kotlin/Throwable|): R|kotlin/Unit| {
|
||||
}
|
||||
internal final fun R|AutoCloseable?|.closeFinally(cause: R|kotlin/Throwable?|): R|kotlin/Unit| {
|
||||
^closeFinally when () {
|
||||
@@ -17,7 +15,7 @@ FILE: complex.kt
|
||||
this@R|/closeFinally|.R|/AutoCloseable.close|()
|
||||
}
|
||||
catch (closeException: R|kotlin/Throwable|) {
|
||||
R|<local>/cause|.R|/addSuppressed|(R|<local>/closeException|)
|
||||
R|<local>/cause|.R|kotlin/Throwable.addSuppressed|(R|<local>/closeException|)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ interface AutoCloseable {
|
||||
fun close()
|
||||
}
|
||||
|
||||
fun Throwable.addSuppressed(other: Throwable) {}
|
||||
|
||||
internal fun AutoCloseable?.closeFinally(cause: Throwable?) = when {
|
||||
this == null -> {}
|
||||
cause == null -> close()
|
||||
|
||||
+6
@@ -25721,6 +25721,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/resolve/priority/memberVsLocalExt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberWithHidesMemberAnnotationVsMemberWithout.kt")
|
||||
public void testMemberWithHidesMemberAnnotationVsMemberWithout() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/resolve/priority/memberWithHidesMemberAnnotationVsMemberWithout.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticVsImplicitReceiverMember.kt")
|
||||
public void testStaticVsImplicitReceiverMember() throws Exception {
|
||||
|
||||
+6
@@ -25721,6 +25721,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/resolve/priority/memberVsLocalExt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberWithHidesMemberAnnotationVsMemberWithout.kt")
|
||||
public void testMemberWithHidesMemberAnnotationVsMemberWithout() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/resolve/priority/memberWithHidesMemberAnnotationVsMemberWithout.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticVsImplicitReceiverMember.kt")
|
||||
public void testStaticVsImplicitReceiverMember() throws Exception {
|
||||
|
||||
+7
-1
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.resolve.calls
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.getAnnotationByClassId
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.modality
|
||||
import org.jetbrains.kotlin.fir.render
|
||||
import org.jetbrains.kotlin.fir.resolve.inference.ConeTypeParameterBasedTypeVariable
|
||||
@@ -15,6 +16,7 @@ import org.jetbrains.kotlin.fir.resolve.inference.InferenceComponents
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag
|
||||
import org.jetbrains.kotlin.fir.types.coneType
|
||||
import org.jetbrains.kotlin.name.StandardClassIds.Annotations.HidesMembers
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.NewConstraintSystemImpl
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.SimpleConstraintSystemConstraintPosition
|
||||
import org.jetbrains.kotlin.resolve.calls.results.FlatSignature
|
||||
@@ -43,7 +45,11 @@ class ConeOverloadConflictResolver(
|
||||
candidates
|
||||
|
||||
return chooseMaximallySpecificCandidates(
|
||||
fixedCandidates, discriminateGenerics, discriminateAbstracts, discriminateSAMs = true, discriminateSuspendConversions = true
|
||||
fixedCandidates,
|
||||
discriminateGenerics,
|
||||
discriminateAbstracts,
|
||||
discriminateSAMs = true,
|
||||
discriminateSuspendConversions = true
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+12
-10
@@ -78,11 +78,11 @@ internal abstract class FirBaseTowerResolveTask(
|
||||
|
||||
protected fun FirScope.toScopeTowerLevel(
|
||||
extensionReceiver: ReceiverValue? = null,
|
||||
extensionsOnly: Boolean = false,
|
||||
withHideMembersOnly: Boolean = false,
|
||||
includeInnerConstructors: Boolean = extensionReceiver != null,
|
||||
): ScopeTowerLevel = ScopeTowerLevel(
|
||||
session, components, this,
|
||||
extensionReceiver, extensionsOnly, includeInnerConstructors
|
||||
extensionReceiver, withHideMembersOnly, includeInnerConstructors
|
||||
)
|
||||
|
||||
protected fun ReceiverValue.toMemberScopeTowerLevel(
|
||||
@@ -386,12 +386,14 @@ internal open class FirTowerResolveTask(
|
||||
depth: Int?,
|
||||
explicitReceiverKind: ExplicitReceiverKind,
|
||||
parentGroup: TowerGroup
|
||||
) = processLevel(
|
||||
topLevelScope.toScopeTowerLevel(
|
||||
extensionReceiver = receiverValue, extensionsOnly = true
|
||||
),
|
||||
info,
|
||||
parentGroup.TopPrioritized(index).let { if (depth != null) it.Implicit(depth) else it },
|
||||
explicitReceiverKind,
|
||||
)
|
||||
) {
|
||||
processLevel(
|
||||
topLevelScope.toScopeTowerLevel(
|
||||
extensionReceiver = receiverValue, withHideMembersOnly = true
|
||||
),
|
||||
info,
|
||||
parentGroup.TopPrioritized(index).let { if (depth != null) it.Implicit(depth) else it },
|
||||
explicitReceiverKind,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+7
-2
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.resolve.calls.tower
|
||||
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
||||
import org.jetbrains.kotlin.fir.declarations.getAnnotationByClassId
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.isInner
|
||||
import org.jetbrains.kotlin.fir.expressions.builder.buildResolvedQualifier
|
||||
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
|
||||
@@ -23,6 +24,7 @@ import org.jetbrains.kotlin.fir.scopes.processClassifiersByName
|
||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.name.StandardClassIds.Annotations.HidesMembers
|
||||
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
@@ -220,7 +222,7 @@ class ScopeTowerLevel(
|
||||
private val bodyResolveComponents: BodyResolveComponents,
|
||||
val scope: FirScope,
|
||||
val extensionReceiver: ReceiverValue?,
|
||||
private val extensionsOnly: Boolean,
|
||||
private val withHideMembersOnly: Boolean,
|
||||
private val includeInnerConstructors: Boolean
|
||||
) : SessionBasedTowerLevel(session) {
|
||||
|
||||
@@ -286,7 +288,10 @@ class ScopeTowerLevel(
|
||||
processor: TowerScopeLevelProcessor<T>
|
||||
) {
|
||||
val candidateReceiverTypeRef = candidate.fir.receiverTypeRef
|
||||
val receiverExpected = extensionsOnly || extensionReceiver != null
|
||||
if (withHideMembersOnly && candidate.getAnnotationByClassId(HidesMembers) == null) {
|
||||
return
|
||||
}
|
||||
val receiverExpected = withHideMembersOnly || extensionReceiver != null
|
||||
if (candidateReceiverTypeRef == null == receiverExpected) return
|
||||
val dispatchReceiverValue = dispatchReceiverValue(candidate)
|
||||
if (dispatchReceiverValue == null && shouldSkipCandidateWithInconsistentExtensionReceiver(candidate)) {
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-50776
|
||||
interface Entities<Target> : MutableCollection<Target>, Sequence<Target>
|
||||
|
||||
abstract class StringEntities : Entities<String> {
|
||||
fun foo() {
|
||||
forEach {
|
||||
println(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package
|
||||
|
||||
public interface Entities</*0*/ Target> : kotlin.collections.MutableCollection<Target>, kotlin.sequences.Sequence<Target> {
|
||||
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ fun add(/*0*/ element: Target): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun addAll(/*0*/ elements: kotlin.collections.Collection<Target>): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
|
||||
public abstract override /*1*/ /*fake_override*/ fun contains(/*0*/ element: Target): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection<Target>): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||
public abstract override /*2*/ /*fake_override*/ fun iterator(): kotlin.collections.MutableIterator<Target>
|
||||
public abstract override /*1*/ /*fake_override*/ fun remove(/*0*/ element: Target): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun removeAll(/*0*/ elements: kotlin.collections.Collection<Target>): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun retainAll(/*0*/ elements: kotlin.collections.Collection<Target>): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public abstract class StringEntities : Entities<kotlin.String> {
|
||||
public constructor StringEntities()
|
||||
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ fun add(/*0*/ element: kotlin.String): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun addAll(/*0*/ elements: kotlin.collections.Collection<kotlin.String>): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
|
||||
public abstract override /*1*/ /*fake_override*/ fun contains(/*0*/ element: kotlin.String): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection<kotlin.String>): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun iterator(): kotlin.collections.MutableIterator<kotlin.String>
|
||||
public abstract override /*1*/ /*fake_override*/ fun remove(/*0*/ element: kotlin.String): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun removeAll(/*0*/ elements: kotlin.collections.Collection<kotlin.String>): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun retainAll(/*0*/ elements: kotlin.collections.Collection<kotlin.String>): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Generated
+6
@@ -25733,6 +25733,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/resolve/priority/memberVsLocalExt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberWithHidesMemberAnnotationVsMemberWithout.kt")
|
||||
public void testMemberWithHidesMemberAnnotationVsMemberWithout() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/resolve/priority/memberWithHidesMemberAnnotationVsMemberWithout.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticVsImplicitReceiverMember.kt")
|
||||
public void testStaticVsImplicitReceiverMember() throws Exception {
|
||||
|
||||
@@ -142,6 +142,8 @@ object StandardClassIds {
|
||||
val Deprecated = "Deprecated".baseId()
|
||||
val DeprecatedSinceKotlin = "DeprecatedSinceKotlin".baseId()
|
||||
|
||||
val HidesMembers = "HidesMembers".internalId()
|
||||
|
||||
val Retention = "Retention".annotationId()
|
||||
val Target = "Target".annotationId()
|
||||
val Repeatable = "Repeatable".annotationId()
|
||||
|
||||
Reference in New Issue
Block a user