Removed obsolete cache for object literals
This commit is contained in:
@@ -116,8 +116,6 @@ public interface BindingContext {
|
|||||||
WritableSlice<JetExpression, Collection<? extends DeclarationDescriptor>> AMBIGUOUS_REFERENCE_TARGET =
|
WritableSlice<JetExpression, Collection<? extends DeclarationDescriptor>> AMBIGUOUS_REFERENCE_TARGET =
|
||||||
new BasicWritableSlice<JetExpression, Collection<? extends DeclarationDescriptor>>(DO_NOTHING);
|
new BasicWritableSlice<JetExpression, Collection<? extends DeclarationDescriptor>>(DO_NOTHING);
|
||||||
|
|
||||||
WritableSlice<JetExpression, DelegatingBindingTrace> TRACE_DELTAS_CACHE = Slices.createSimpleSlice();
|
|
||||||
|
|
||||||
WritableSlice<JetExpression, ResolvedCall<FunctionDescriptor>> LOOP_RANGE_ITERATOR_RESOLVED_CALL = Slices.createSimpleSlice();
|
WritableSlice<JetExpression, ResolvedCall<FunctionDescriptor>> LOOP_RANGE_ITERATOR_RESOLVED_CALL = Slices.createSimpleSlice();
|
||||||
|
|
||||||
WritableSlice<JetExpression, ResolvedCall<FunctionDescriptor>> LOOP_RANGE_HAS_NEXT_RESOLVED_CALL = Slices.createSimpleSlice();
|
WritableSlice<JetExpression, ResolvedCall<FunctionDescriptor>> LOOP_RANGE_HAS_NEXT_RESOLVED_CALL = Slices.createSimpleSlice();
|
||||||
|
|||||||
-11
@@ -608,12 +608,6 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JetTypeInfo visitObjectLiteralExpression(@NotNull final JetObjectLiteralExpression expression, final ExpressionTypingContext context) {
|
public JetTypeInfo visitObjectLiteralExpression(@NotNull final JetObjectLiteralExpression expression, final ExpressionTypingContext context) {
|
||||||
DelegatingBindingTrace delegatingBindingTrace = context.trace.get(TRACE_DELTAS_CACHE, expression.getObjectDeclaration());
|
|
||||||
if (delegatingBindingTrace != null) {
|
|
||||||
delegatingBindingTrace.addAllMyDataTo(context.trace);
|
|
||||||
JetType type = context.trace.getType(expression);
|
|
||||||
return TypeInfoFactoryPackage.createCheckedTypeInfo(type, context, expression);
|
|
||||||
}
|
|
||||||
final JetType[] result = new JetType[1];
|
final JetType[] result = new JetType[1];
|
||||||
final TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(context.trace,
|
final TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(context.trace,
|
||||||
"trace to resolve object literal expression", expression);
|
"trace to resolve object literal expression", expression);
|
||||||
@@ -648,11 +642,6 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
expression.getObjectDeclaration(),
|
expression.getObjectDeclaration(),
|
||||||
components.additionalCheckerProvider,
|
components.additionalCheckerProvider,
|
||||||
components.dynamicTypesSettings);
|
components.dynamicTypesSettings);
|
||||||
|
|
||||||
DelegatingBindingTrace cloneDelta = new DelegatingBindingTrace(
|
|
||||||
new BindingTraceContext().getBindingContext(), "cached delta trace for object literal expression resolve", expression);
|
|
||||||
temporaryTrace.addAllMyDataTo(cloneDelta);
|
|
||||||
context.trace.record(TRACE_DELTAS_CACHE, expression.getObjectDeclaration(), cloneDelta);
|
|
||||||
temporaryTrace.commit();
|
temporaryTrace.commit();
|
||||||
return TypeInfoFactoryPackage.createCheckedTypeInfo(result[0], context, expression);
|
return TypeInfoFactoryPackage.createCheckedTypeInfo(result[0], context, expression);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// !DIAGNOSTICS: -PARAMETER_NAME_CHANGED_ON_OVERRIDE
|
||||||
|
|
||||||
|
//If this test hangs, it means something is broken.
|
||||||
|
object A {
|
||||||
|
val iii = 42
|
||||||
|
}
|
||||||
|
|
||||||
|
//inappropriate but participating in resolve functions
|
||||||
|
fun foo(s: String, a: Any) = s + a
|
||||||
|
|
||||||
|
fun foo(a: Any, s: String) = s + a
|
||||||
|
fun foo(i: Int, j: Int) = i + j
|
||||||
|
fun foo(a: Any, i: Int) = "$a$i"
|
||||||
|
fun foo(f: (Int) -> Int, i: Int) = f(i)
|
||||||
|
fun foo(f: (String) -> Int, s: String) = f(s)
|
||||||
|
fun foo(f: (Any) -> Int, a: Any) = f(a)
|
||||||
|
fun foo(s: String, f: (String) -> Int) = f(s)
|
||||||
|
fun foo(a: Any, f: (Any) -> Int) = f(a)
|
||||||
|
//appropriate function
|
||||||
|
fun foo(i: Int, f: (Int) -> Int) = f(i)
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
foo(1, object : (Int) -> Int {
|
||||||
|
override fun invoke(x1: Int) = foo(
|
||||||
|
2, object : (Int) -> Int {
|
||||||
|
override fun invoke(x2: Int) = foo(
|
||||||
|
3, object : (Int) -> Int {
|
||||||
|
override fun invoke(x3: Int): Int = foo(
|
||||||
|
4, object : (Int) -> Int {
|
||||||
|
override fun invoke(x4: Int): Int = foo(
|
||||||
|
5, object : (Int) -> Int {
|
||||||
|
override fun invoke(x5: Int): Int = x1 + x2 + x3 + x4 + x5 + A.iii
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
internal fun foo(/*0*/ f: (kotlin.Any) -> kotlin.Int, /*1*/ a: kotlin.Any): kotlin.Int
|
||||||
|
internal fun foo(/*0*/ f: (kotlin.Int) -> kotlin.Int, /*1*/ i: kotlin.Int): kotlin.Int
|
||||||
|
internal fun foo(/*0*/ f: (kotlin.String) -> kotlin.Int, /*1*/ s: kotlin.String): kotlin.Int
|
||||||
|
internal fun foo(/*0*/ a: kotlin.Any, /*1*/ f: (kotlin.Any) -> kotlin.Int): kotlin.Int
|
||||||
|
internal fun foo(/*0*/ a: kotlin.Any, /*1*/ i: kotlin.Int): kotlin.String
|
||||||
|
internal fun foo(/*0*/ a: kotlin.Any, /*1*/ s: kotlin.String): kotlin.String
|
||||||
|
internal fun foo(/*0*/ i: kotlin.Int, /*1*/ f: (kotlin.Int) -> kotlin.Int): kotlin.Int
|
||||||
|
internal fun foo(/*0*/ i: kotlin.Int, /*1*/ j: kotlin.Int): kotlin.Int
|
||||||
|
internal fun foo(/*0*/ s: kotlin.String, /*1*/ f: (kotlin.String) -> kotlin.Int): kotlin.Int
|
||||||
|
internal fun foo(/*0*/ s: kotlin.String, /*1*/ a: kotlin.Any): kotlin.String
|
||||||
|
internal fun test(): kotlin.Unit
|
||||||
|
|
||||||
|
internal object A {
|
||||||
|
private constructor A()
|
||||||
|
internal final val iii: kotlin.Int = 42
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -10014,6 +10014,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("objectLiteralAsArgument.kt")
|
||||||
|
public void testObjectLiteralAsArgument() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/objectLiteralAsArgument.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("resolveWithFunctionLiteralWithId.kt")
|
@TestMetadata("resolveWithFunctionLiteralWithId.kt")
|
||||||
public void testResolveWithFunctionLiteralWithId() throws Exception {
|
public void testResolveWithFunctionLiteralWithId() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user