[FIR] Properly set isOperator flag for java functions
^KT-56875 Fixed
This commit is contained in:
committed by
Space Team
parent
df47581c5a
commit
244dbb37cf
+5
@@ -933,6 +933,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/extensionInvokeAfterSafeCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incorrectPlusOperatorFromJava.kt")
|
||||
public void testIncorrectPlusOperatorFromJava() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/incorrectPlusOperatorFromJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("invokeAmbiguity.kt")
|
||||
public void testInvokeAmbiguity() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/invokeAmbiguity.kt");
|
||||
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
FILE: main.kt
|
||||
public final operator fun R|Base|.plus(s: R|kotlin/String|): R|kotlin/Int| {
|
||||
^plus Int(0)
|
||||
}
|
||||
public final class Derived : R|Base| {
|
||||
public constructor(): R|Derived| {
|
||||
super<R|Base|>()
|
||||
}
|
||||
|
||||
public final fun test_1(x: R|Base|): R|kotlin/Unit| {
|
||||
lval y: R|kotlin/Int| = R|<local>/x|.R|/plus|(String())
|
||||
R|<local>/y|.R|kotlin/Int.inc|()
|
||||
}
|
||||
|
||||
public final fun test_2(x: R|Base|): R|kotlin/Unit| {
|
||||
lval y: R|kotlin/String!| = R|<local>/x|.R|/Base.plus|(vararg(String()))
|
||||
R|<local>/y|.R|kotlin/String.length|
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// ISSUE: KT-56875
|
||||
// FILE: Base.java
|
||||
public class Base {
|
||||
public String plus(String... strings) { // (1)
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
operator fun Base.plus(s: String): Int = 0 // (2)
|
||||
|
||||
class Derived : Base() {
|
||||
fun test_1(x: Base) {
|
||||
val y = x + "" // should resolve to (2)
|
||||
y.inc() // should be ok
|
||||
}
|
||||
|
||||
fun test_2(x: Base) {
|
||||
val y = x.plus("") // should resolve to (1)
|
||||
y.length // should be ok
|
||||
}
|
||||
}
|
||||
+6
@@ -1083,6 +1083,12 @@ public class FirLightTreeDiagnosticsTestGenerated extends AbstractFirLightTreeDi
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/extensionInvokeAfterSafeCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectPlusOperatorFromJava.kt")
|
||||
public void testIncorrectPlusOperatorFromJava() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/incorrectPlusOperatorFromJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("invokeAmbiguity.kt")
|
||||
public void testInvokeAmbiguity() throws Exception {
|
||||
|
||||
+6
@@ -1083,6 +1083,12 @@ public class FirPsiDiagnosticTestGenerated extends AbstractFirPsiDiagnosticTest
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/extensionInvokeAfterSafeCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectPlusOperatorFromJava.kt")
|
||||
public void testIncorrectPlusOperatorFromJava() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/incorrectPlusOperatorFromJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("invokeAmbiguity.kt")
|
||||
public void testInvokeAmbiguity() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user