[FE 1.0] Don't miss NO_SET_METHOD checks
^KT-28109 Fixed
This commit is contained in:
committed by
teamcity
parent
3aabc8d666
commit
8c1fcddea3
+6
@@ -25050,6 +25050,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/tests/resolve/inferenceInLinkedLambdasDependentOnExpectedType.kt");
|
runTest("compiler/testData/diagnostics/tests/resolve/inferenceInLinkedLambdasDependentOnExpectedType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt28109.kt")
|
||||||
|
public void testKt28109() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/resolve/kt28109.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("kt36264.kt")
|
@TestMetadata("kt36264.kt")
|
||||||
public void testKt36264() throws Exception {
|
public void testKt36264() throws Exception {
|
||||||
|
|||||||
+6
@@ -25050,6 +25050,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
runTest("compiler/testData/diagnostics/tests/resolve/inferenceInLinkedLambdasDependentOnExpectedType.kt");
|
runTest("compiler/testData/diagnostics/tests/resolve/inferenceInLinkedLambdasDependentOnExpectedType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt28109.kt")
|
||||||
|
public void testKt28109() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/resolve/kt28109.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("kt36264.kt")
|
@TestMetadata("kt36264.kt")
|
||||||
public void testKt36264() throws Exception {
|
public void testKt36264() throws Exception {
|
||||||
|
|||||||
+9
-2
@@ -760,15 +760,22 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
return typeInfo.clearType();
|
return typeInfo.clearType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KtExpression deparenthesizedBaseExpression = KtPsiUtil.deparenthesize(baseExpression);
|
||||||
|
|
||||||
// a[i]++/-- takes special treatment because it is actually let j = i, arr = a in arr.set(j, a.get(j).inc())
|
// a[i]++/-- takes special treatment because it is actually let j = i, arr = a in arr.set(j, a.get(j).inc())
|
||||||
if ((operationType == KtTokens.PLUSPLUS || operationType == KtTokens.MINUSMINUS) &&
|
if ((operationType == KtTokens.PLUSPLUS || operationType == KtTokens.MINUSMINUS) &&
|
||||||
baseExpression instanceof KtArrayAccessExpression) {
|
deparenthesizedBaseExpression instanceof KtArrayAccessExpression) {
|
||||||
KtExpression stubExpression = ExpressionTypingUtils.createFakeExpressionOfType(
|
KtExpression stubExpression = ExpressionTypingUtils.createFakeExpressionOfType(
|
||||||
baseExpression.getProject(), context.trace, "e", type);
|
baseExpression.getProject(), context.trace, "e", type);
|
||||||
TemporaryBindingTrace temporaryBindingTrace = TemporaryBindingTrace.create(
|
TemporaryBindingTrace temporaryBindingTrace = TemporaryBindingTrace.create(
|
||||||
context.trace, "trace to resolve array access set method for unary expression", expression);
|
context.trace, "trace to resolve array access set method for unary expression", expression);
|
||||||
ExpressionTypingContext newContext = context.replaceBindingTrace(temporaryBindingTrace);
|
ExpressionTypingContext newContext = context.replaceBindingTrace(temporaryBindingTrace);
|
||||||
resolveImplicitArrayAccessSetMethod((KtArrayAccessExpression) baseExpression, stubExpression, newContext, context.trace);
|
resolveImplicitArrayAccessSetMethod(
|
||||||
|
(KtArrayAccessExpression) deparenthesizedBaseExpression,
|
||||||
|
stubExpression,
|
||||||
|
newContext,
|
||||||
|
context.trace
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve the operation reference
|
// Resolve the operation reference
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
class Cell {
|
||||||
|
operator fun get(s: Int) = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val c = Cell()
|
||||||
|
(<!UNRESOLVED_REFERENCE!>c[0]<!>)++
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
class Cell {
|
||||||
|
operator fun get(s: Int) = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val c = Cell()
|
||||||
|
(c<!NO_SET_METHOD!>[0]<!>)++
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun box(): kotlin.String
|
||||||
|
|
||||||
|
public final class Cell {
|
||||||
|
public constructor Cell()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final operator fun get(/*0*/ s: kotlin.Int): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
Generated
+6
@@ -25062,6 +25062,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/resolve/inferenceInLinkedLambdasDependentOnExpectedType.kt");
|
runTest("compiler/testData/diagnostics/tests/resolve/inferenceInLinkedLambdasDependentOnExpectedType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt28109.kt")
|
||||||
|
public void testKt28109() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/resolve/kt28109.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("kt36264.kt")
|
@TestMetadata("kt36264.kt")
|
||||||
public void testKt36264() throws Exception {
|
public void testKt36264() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user