[NI] Propagate class to extend inference through resolution context

This commit is contained in:
Mikhail Zarechenskiy
2018-02-20 16:06:23 +03:00
parent 887a69b72e
commit 8c44d44e78
11 changed files with 161 additions and 171 deletions
@@ -1,17 +1,6 @@
/* /*
* Copyright 2010-2017 JetBrains s.r.o. * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* * that can be found in the license/LICENSE.txt file.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.kotlin.resolve package org.jetbrains.kotlin.resolve
@@ -32,6 +21,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getCall
import org.jetbrains.kotlin.resolve.calls.callUtil.getCalleeExpressionIfAny import org.jetbrains.kotlin.resolve.calls.callUtil.getCalleeExpressionIfAny
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.calls.checkers.OperatorCallChecker import org.jetbrains.kotlin.resolve.calls.checkers.OperatorCallChecker
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency import org.jetbrains.kotlin.resolve.calls.context.ContextDependency
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemCompleter import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemCompleter
@@ -575,7 +565,7 @@ class DelegatedPropertyResolver(
val contextForProvideDelegate = ExpressionTypingContext.newContext( val contextForProvideDelegate = ExpressionTypingContext.newContext(
traceToResolveConventionMethods, scopeForDelegate, delegateTypeInfo.dataFlowInfo, traceToResolveConventionMethods, scopeForDelegate, delegateTypeInfo.dataFlowInfo,
NO_EXPECTED_TYPE, ContextDependency.DEPENDENT, StatementFilter.NONE, NO_EXPECTED_TYPE, ContextDependency.DEPENDENT, StatementFilter.NONE,
languageVersionSettings, dataFlowValueFactory languageVersionSettings, dataFlowValueFactory, InferenceSession.default
) )
val delegateTypeConstructor = delegateTypeInfo.type?.constructor val delegateTypeConstructor = delegateTypeInfo.type?.constructor
@@ -1,17 +1,6 @@
/* /*
* Copyright 2010-2017 JetBrains s.r.o. * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* * that can be found in the license/LICENSE.txt file.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.kotlin.resolve.calls; package org.jetbrains.kotlin.resolve.calls;
@@ -35,6 +24,7 @@ import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt; import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode; import org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt; import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession;
import org.jetbrains.kotlin.resolve.calls.context.*; import org.jetbrains.kotlin.resolve.calls.context.*;
import org.jetbrains.kotlin.resolve.calls.inference.CoroutineInferenceUtilKt; import org.jetbrains.kotlin.resolve.calls.inference.CoroutineInferenceUtilKt;
import org.jetbrains.kotlin.resolve.calls.model.KotlinCallKind; import org.jetbrains.kotlin.resolve.calls.model.KotlinCallKind;
@@ -307,7 +297,7 @@ public class CallResolver {
return resolveFunctionCall( return resolveFunctionCall(
BasicCallResolutionContext.create( BasicCallResolutionContext.create(
trace, scope, call, expectedType, dataFlowInfo, ContextDependency.INDEPENDENT, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS, trace, scope, call, expectedType, dataFlowInfo, ContextDependency.INDEPENDENT, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS,
isAnnotationContext, languageVersionSettings, dataFlowValueFactory isAnnotationContext, languageVersionSettings, dataFlowValueFactory, InferenceSession.Companion.getDefault()
) )
); );
} }
@@ -435,7 +425,8 @@ public class CallResolver {
dataFlowInfo, ContextDependency.INDEPENDENT, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS, dataFlowInfo, ContextDependency.INDEPENDENT, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS,
false, false,
languageVersionSettings, languageVersionSettings,
dataFlowValueFactory); dataFlowValueFactory,
InferenceSession.Companion.getDefault());
if (call.getCalleeExpression() == null) return checkArgumentTypesAndFail(context); if (call.getCalleeExpression() == null) return checkArgumentTypesAndFail(context);
@@ -1,17 +1,6 @@
/* /*
* Copyright 2010-2017 JetBrains s.r.o. * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* * that can be found in the license/LICENSE.txt file.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.kotlin.resolve.calls.context; package org.jetbrains.kotlin.resolve.calls.context;
@@ -24,6 +13,7 @@ import org.jetbrains.kotlin.psi.Call;
import org.jetbrains.kotlin.psi.KtExpression; import org.jetbrains.kotlin.psi.KtExpression;
import org.jetbrains.kotlin.resolve.BindingTrace; import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.StatementFilter; import org.jetbrains.kotlin.resolve.StatementFilter;
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession;
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments; import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory;
@@ -48,11 +38,33 @@ public class BasicCallResolutionContext extends CallResolutionContext<BasicCallR
@NotNull CallPosition callPosition, @NotNull CallPosition callPosition,
@NotNull Function1<KtExpression, KtExpression> expressionContextProvider, @NotNull Function1<KtExpression, KtExpression> expressionContextProvider,
@NotNull LanguageVersionSettings languageVersionSettings, @NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory @NotNull DataFlowValueFactory dataFlowValueFactory,
@NotNull InferenceSession inferenceSession
) { ) {
super(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache, super(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
dataFlowInfoForArguments, statementFilter, isAnnotationContext, isDebuggerContext, collectAllCandidates, dataFlowInfoForArguments, statementFilter, isAnnotationContext, isDebuggerContext, collectAllCandidates,
callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory, inferenceSession);
}
@NotNull
public static BasicCallResolutionContext create(
@NotNull BindingTrace trace,
@NotNull LexicalScope scope,
@NotNull Call call,
@NotNull KotlinType expectedType,
@NotNull DataFlowInfo dataFlowInfo,
@NotNull ContextDependency contextDependency,
@NotNull CheckArgumentTypesMode checkArguments,
boolean isAnnotationContext,
@NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory,
@NotNull InferenceSession inferenceSession
) {
return new BasicCallResolutionContext(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments,
new ResolutionResultsCacheImpl(), null,
StatementFilter.NONE, isAnnotationContext, false, false,
CallPosition.Unknown.INSTANCE, DEFAULT_EXPRESSION_CONTEXT_PROVIDER, languageVersionSettings,
dataFlowValueFactory, inferenceSession);
} }
@NotNull @NotNull
@@ -72,7 +84,7 @@ public class BasicCallResolutionContext extends CallResolutionContext<BasicCallR
new ResolutionResultsCacheImpl(), null, new ResolutionResultsCacheImpl(), null,
StatementFilter.NONE, isAnnotationContext, false, false, StatementFilter.NONE, isAnnotationContext, false, false,
CallPosition.Unknown.INSTANCE, DEFAULT_EXPRESSION_CONTEXT_PROVIDER, languageVersionSettings, CallPosition.Unknown.INSTANCE, DEFAULT_EXPRESSION_CONTEXT_PROVIDER, languageVersionSettings,
dataFlowValueFactory); dataFlowValueFactory, InferenceSession.Companion.getDefault());
} }
@NotNull @NotNull
@@ -84,7 +96,8 @@ public class BasicCallResolutionContext extends CallResolutionContext<BasicCallR
context.trace, context.scope, call, context.expectedType, context.dataFlowInfo, context.contextDependency, checkArguments, context.trace, context.scope, call, context.expectedType, context.dataFlowInfo, context.contextDependency, checkArguments,
context.resolutionResultsCache, dataFlowInfoForArguments, context.resolutionResultsCache, dataFlowInfoForArguments,
context.statementFilter, context.isAnnotationContext, context.isDebuggerContext, context.collectAllCandidates, context.statementFilter, context.isAnnotationContext, context.isDebuggerContext, context.collectAllCandidates,
context.callPosition, context.expressionContextProvider, context.languageVersionSettings, context.dataFlowValueFactory); context.callPosition, context.expressionContextProvider, context.languageVersionSettings, context.dataFlowValueFactory,
context.inferenceSession);
} }
@NotNull @NotNull
@@ -107,12 +120,13 @@ public class BasicCallResolutionContext extends CallResolutionContext<BasicCallR
@NotNull CallPosition callPosition, @NotNull CallPosition callPosition,
@NotNull Function1<KtExpression, KtExpression> expressionContextProvider, @NotNull Function1<KtExpression, KtExpression> expressionContextProvider,
@NotNull LanguageVersionSettings languageVersionSettings, @NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory @NotNull DataFlowValueFactory dataFlowValueFactory,
@NotNull InferenceSession inferenceSession
) { ) {
return new BasicCallResolutionContext( return new BasicCallResolutionContext(
trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache, trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
dataFlowInfoForArguments, statementFilter, isAnnotationContext, isDebuggerContext, collectAllCandidates, dataFlowInfoForArguments, statementFilter, isAnnotationContext, isDebuggerContext, collectAllCandidates,
callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory, inferenceSession);
} }
@NotNull @NotNull
@@ -120,6 +134,6 @@ public class BasicCallResolutionContext extends CallResolutionContext<BasicCallR
return new BasicCallResolutionContext( return new BasicCallResolutionContext(
trace, scope, newCall, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache, trace, scope, newCall, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
dataFlowInfoForArguments, statementFilter, isAnnotationContext, isDebuggerContext, collectAllCandidates, dataFlowInfoForArguments, statementFilter, isAnnotationContext, isDebuggerContext, collectAllCandidates,
callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory, inferenceSession);
} }
} }
@@ -1,17 +1,6 @@
/* /*
* Copyright 2010-2017 JetBrains s.r.o. * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* * that can be found in the license/LICENSE.txt file.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.kotlin.resolve.calls.context; package org.jetbrains.kotlin.resolve.calls.context;
@@ -25,6 +14,7 @@ import org.jetbrains.kotlin.psi.Call;
import org.jetbrains.kotlin.psi.KtExpression; import org.jetbrains.kotlin.psi.KtExpression;
import org.jetbrains.kotlin.resolve.BindingTrace; import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.StatementFilter; import org.jetbrains.kotlin.resolve.StatementFilter;
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession;
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments; import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
import org.jetbrains.kotlin.resolve.calls.model.MutableResolvedCall; import org.jetbrains.kotlin.resolve.calls.model.MutableResolvedCall;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
@@ -61,11 +51,13 @@ public final class CallCandidateResolutionContext<D extends CallableDescriptor>
@NotNull CallPosition callPosition, @NotNull CallPosition callPosition,
@NotNull Function1<KtExpression, KtExpression> expressionContextProvider, @NotNull Function1<KtExpression, KtExpression> expressionContextProvider,
@NotNull LanguageVersionSettings languageVersionSettings, @NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory @NotNull DataFlowValueFactory dataFlowValueFactory,
@NotNull InferenceSession inferenceSession
) { ) {
super(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache, super(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
dataFlowInfoForArguments, statementFilter, isAnnotationContext, isDebuggerContext, dataFlowInfoForArguments, statementFilter, isAnnotationContext, isDebuggerContext,
collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
this.candidateCall = candidateCall; this.candidateCall = candidateCall;
this.tracing = tracing; this.tracing = tracing;
this.candidateResolveMode = candidateResolveMode; this.candidateResolveMode = candidateResolveMode;
@@ -82,7 +74,8 @@ public final class CallCandidateResolutionContext<D extends CallableDescriptor>
context.resolutionResultsCache, context.dataFlowInfoForArguments, context.resolutionResultsCache, context.dataFlowInfoForArguments,
context.statementFilter, context.statementFilter,
candidateResolveMode, context.isAnnotationContext, context.isDebuggerContext, context.collectAllCandidates, candidateResolveMode, context.isAnnotationContext, context.isDebuggerContext, context.collectAllCandidates,
context.callPosition, context.expressionContextProvider, context.languageVersionSettings, context.dataFlowValueFactory); context.callPosition, context.expressionContextProvider, context.languageVersionSettings, context.dataFlowValueFactory,
context.inferenceSession);
} }
@NotNull @NotNull
@@ -94,7 +87,8 @@ public final class CallCandidateResolutionContext<D extends CallableDescriptor>
context.dataFlowInfo, context.contextDependency, context.checkArguments, context.resolutionResultsCache, context.dataFlowInfo, context.contextDependency, context.checkArguments, context.resolutionResultsCache,
context.dataFlowInfoForArguments, context.statementFilter, context.dataFlowInfoForArguments, context.statementFilter,
CandidateResolveMode.FULLY, context.isAnnotationContext, context.isDebuggerContext, context.collectAllCandidates, CandidateResolveMode.FULLY, context.isAnnotationContext, context.isDebuggerContext, context.collectAllCandidates,
context.callPosition, context.expressionContextProvider, context.languageVersionSettings, context.dataFlowValueFactory); context.callPosition, context.expressionContextProvider, context.languageVersionSettings, context.dataFlowValueFactory,
context.inferenceSession);
} }
@Override @Override
@@ -110,12 +104,13 @@ public final class CallCandidateResolutionContext<D extends CallableDescriptor>
@NotNull CallPosition callPosition, @NotNull CallPosition callPosition,
@NotNull Function1<KtExpression, KtExpression> expressionContextProvider, @NotNull Function1<KtExpression, KtExpression> expressionContextProvider,
@NotNull LanguageVersionSettings languageVersionSettings, @NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory @NotNull DataFlowValueFactory dataFlowValueFactory,
@NotNull InferenceSession inferenceSession
) { ) {
return new CallCandidateResolutionContext<>( return new CallCandidateResolutionContext<>(
candidateCall, tracing, trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, candidateCall, tracing, trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments,
resolutionResultsCache, dataFlowInfoForArguments, statementFilter, resolutionResultsCache, dataFlowInfoForArguments, statementFilter,
candidateResolveMode, isAnnotationContext, isDebuggerContext, collectAllCandidates, callPosition, expressionContextProvider, candidateResolveMode, isAnnotationContext, isDebuggerContext, collectAllCandidates, callPosition, expressionContextProvider,
languageVersionSettings, dataFlowValueFactory); languageVersionSettings, dataFlowValueFactory, inferenceSession);
} }
} }
@@ -1,17 +1,6 @@
/* /*
* Copyright 2010-2017 JetBrains s.r.o. * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* * that can be found in the license/LICENSE.txt file.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.kotlin.resolve.calls.context; package org.jetbrains.kotlin.resolve.calls.context;
@@ -24,6 +13,7 @@ import org.jetbrains.kotlin.psi.Call;
import org.jetbrains.kotlin.psi.KtExpression; import org.jetbrains.kotlin.psi.KtExpression;
import org.jetbrains.kotlin.resolve.BindingTrace; import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.StatementFilter; import org.jetbrains.kotlin.resolve.StatementFilter;
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession;
import org.jetbrains.kotlin.resolve.calls.model.DataFlowInfoForArgumentsImpl; import org.jetbrains.kotlin.resolve.calls.model.DataFlowInfoForArgumentsImpl;
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments; import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
@@ -57,11 +47,12 @@ public abstract class CallResolutionContext<Context extends CallResolutionContex
@NotNull CallPosition callPosition, @NotNull CallPosition callPosition,
@NotNull Function1<KtExpression, KtExpression> expressionContextProvider, @NotNull Function1<KtExpression, KtExpression> expressionContextProvider,
@NotNull LanguageVersionSettings languageVersionSettings, @NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory @NotNull DataFlowValueFactory dataFlowValueFactory,
@NotNull InferenceSession inferenceSession
) { ) {
super(trace, scope, expectedType, dataFlowInfo, contextDependency, resolutionResultsCache, super(trace, scope, expectedType, dataFlowInfo, contextDependency, resolutionResultsCache,
statementFilter, isAnnotationContext, isDebuggerContext, collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, statementFilter, isAnnotationContext, isDebuggerContext, collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings,
dataFlowValueFactory); dataFlowValueFactory, inferenceSession);
this.call = call; this.call = call;
this.checkArguments = checkArguments; this.checkArguments = checkArguments;
if (dataFlowInfoForArguments != null) { if (dataFlowInfoForArguments != null) {
@@ -1,17 +1,6 @@
/* /*
* Copyright 2010-2017 JetBrains s.r.o. * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* * that can be found in the license/LICENSE.txt file.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.kotlin.resolve.calls.context; package org.jetbrains.kotlin.resolve.calls.context;
@@ -25,6 +14,7 @@ import org.jetbrains.kotlin.config.LanguageVersionSettings;
import org.jetbrains.kotlin.psi.KtExpression; import org.jetbrains.kotlin.psi.KtExpression;
import org.jetbrains.kotlin.resolve.BindingTrace; import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.StatementFilter; import org.jetbrains.kotlin.resolve.StatementFilter;
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory;
import org.jetbrains.kotlin.resolve.scopes.LexicalScope; import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
@@ -68,6 +58,9 @@ public abstract class ResolutionContext<Context extends ResolutionContext<Contex
@NotNull @NotNull
public final DataFlowValueFactory dataFlowValueFactory; public final DataFlowValueFactory dataFlowValueFactory;
@NotNull
public final InferenceSession inferenceSession;
/** /**
* Used for analyzing expression in the given context. * Used for analyzing expression in the given context.
* Should be used for going through parents to find containing function, loop etc. * Should be used for going through parents to find containing function, loop etc.
@@ -94,7 +87,8 @@ public abstract class ResolutionContext<Context extends ResolutionContext<Contex
@NotNull CallPosition callPosition, @NotNull CallPosition callPosition,
@NotNull Function1<KtExpression, KtExpression> expressionContextProvider, @NotNull Function1<KtExpression, KtExpression> expressionContextProvider,
@NotNull LanguageVersionSettings languageVersionSettings, @NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory factory @NotNull DataFlowValueFactory factory,
@NotNull InferenceSession inferenceSession
) { ) {
this.trace = trace; this.trace = trace;
this.scope = scope; this.scope = scope;
@@ -110,6 +104,7 @@ public abstract class ResolutionContext<Context extends ResolutionContext<Contex
this.expressionContextProvider = expressionContextProvider; this.expressionContextProvider = expressionContextProvider;
this.languageVersionSettings = languageVersionSettings; this.languageVersionSettings = languageVersionSettings;
this.dataFlowValueFactory = factory; this.dataFlowValueFactory = factory;
this.inferenceSession = inferenceSession;
} }
protected abstract Context create( protected abstract Context create(
@@ -124,7 +119,8 @@ public abstract class ResolutionContext<Context extends ResolutionContext<Contex
@NotNull CallPosition callPosition, @NotNull CallPosition callPosition,
@NotNull Function1<KtExpression, KtExpression> expressionContextProvider, @NotNull Function1<KtExpression, KtExpression> expressionContextProvider,
@NotNull LanguageVersionSettings languageVersionSettings, @NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory @NotNull DataFlowValueFactory dataFlowValueFactory,
@NotNull InferenceSession inferenceSession
); );
@NotNull @NotNull
@@ -137,14 +133,16 @@ public abstract class ResolutionContext<Context extends ResolutionContext<Contex
public Context replaceBindingTrace(@NotNull BindingTrace trace) { public Context replaceBindingTrace(@NotNull BindingTrace trace) {
if (this.trace == trace) return self(); if (this.trace == trace) return self();
return create(trace, scope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter, return create(trace, scope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter,
collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
} }
@NotNull @NotNull
public Context replaceDataFlowInfo(@NotNull DataFlowInfo newDataFlowInfo) { public Context replaceDataFlowInfo(@NotNull DataFlowInfo newDataFlowInfo) {
if (newDataFlowInfo == dataFlowInfo) return self(); if (newDataFlowInfo == dataFlowInfo) return self();
return create(trace, scope, newDataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter, return create(trace, scope, newDataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter,
collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
} }
@NotNull @NotNull
@@ -152,28 +150,32 @@ public abstract class ResolutionContext<Context extends ResolutionContext<Contex
if (newExpectedType == null) return replaceExpectedType(TypeUtils.NO_EXPECTED_TYPE); if (newExpectedType == null) return replaceExpectedType(TypeUtils.NO_EXPECTED_TYPE);
if (expectedType == newExpectedType) return self(); if (expectedType == newExpectedType) return self();
return create(trace, scope, dataFlowInfo, newExpectedType, contextDependency, resolutionResultsCache, statementFilter, return create(trace, scope, dataFlowInfo, newExpectedType, contextDependency, resolutionResultsCache, statementFilter,
collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
} }
@NotNull @NotNull
public Context replaceScope(@NotNull LexicalScope newScope) { public Context replaceScope(@NotNull LexicalScope newScope) {
if (newScope == scope) return self(); if (newScope == scope) return self();
return create(trace, newScope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter, return create(trace, newScope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter,
collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
} }
@NotNull @NotNull
public Context replaceContextDependency(@NotNull ContextDependency newContextDependency) { public Context replaceContextDependency(@NotNull ContextDependency newContextDependency) {
if (newContextDependency == contextDependency) return self(); if (newContextDependency == contextDependency) return self();
return create(trace, scope, dataFlowInfo, expectedType, newContextDependency, resolutionResultsCache, statementFilter, return create(trace, scope, dataFlowInfo, expectedType, newContextDependency, resolutionResultsCache, statementFilter,
collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
} }
@NotNull @NotNull
public Context replaceResolutionResultsCache(@NotNull ResolutionResultsCache newResolutionResultsCache) { public Context replaceResolutionResultsCache(@NotNull ResolutionResultsCache newResolutionResultsCache) {
if (newResolutionResultsCache == resolutionResultsCache) return self(); if (newResolutionResultsCache == resolutionResultsCache) return self();
return create(trace, scope, dataFlowInfo, expectedType, contextDependency, newResolutionResultsCache, statementFilter, return create(trace, scope, dataFlowInfo, expectedType, contextDependency, newResolutionResultsCache, statementFilter,
collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
} }
@NotNull @NotNull
@@ -184,25 +186,29 @@ public abstract class ResolutionContext<Context extends ResolutionContext<Contex
@NotNull @NotNull
public Context replaceCollectAllCandidates(boolean newCollectAllCandidates) { public Context replaceCollectAllCandidates(boolean newCollectAllCandidates) {
return create(trace, scope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter, return create(trace, scope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter,
newCollectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); newCollectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
} }
@NotNull @NotNull
public Context replaceStatementFilter(@NotNull StatementFilter statementFilter) { public Context replaceStatementFilter(@NotNull StatementFilter statementFilter) {
return create(trace, scope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter, return create(trace, scope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter,
collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
} }
@NotNull @NotNull
public Context replaceCallPosition(@NotNull CallPosition callPosition) { public Context replaceCallPosition(@NotNull CallPosition callPosition) {
return create(trace, scope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter, return create(trace, scope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter,
collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
} }
@NotNull @NotNull
public Context replaceExpressionContextProvider(@NotNull Function1<KtExpression, KtExpression> expressionContextProvider) { public Context replaceExpressionContextProvider(@NotNull Function1<KtExpression, KtExpression> expressionContextProvider) {
return create(trace, scope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter, return create(trace, scope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, statementFilter,
collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory); collectAllCandidates, callPosition, expressionContextProvider, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
} }
@Nullable @Nullable
@@ -1,17 +1,6 @@
/* /*
* Copyright 2010-2017 JetBrains s.r.o. * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* * that can be found in the license/LICENSE.txt file.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.kotlin.resolve.calls.tower package org.jetbrains.kotlin.resolve.calls.tower
@@ -193,6 +182,8 @@ class KotlinResolutionCallbacksImpl(
return constantExpressionEvaluator.evaluateExpression(expression, temporaryBindingTrace, expectedType) != null return constantExpressionEvaluator.evaluateExpression(expression, temporaryBindingTrace, expectedType) != null
} }
override val inferenceSession = topLevelCallContext.inferenceSession
private fun findCommonParent(callElement: KtExpression, receiver: ReceiverKotlinCallArgument?): KtExpression { private fun findCommonParent(callElement: KtExpression, receiver: ReceiverKotlinCallArgument?): KtExpression {
if (receiver == null) return callElement if (receiver == null) return callElement
return PsiTreeUtil.findCommonParent(callElement, receiver.psiExpression)?.safeAs() ?: callElement return PsiTreeUtil.findCommonParent(callElement, receiver.psiExpression)?.safeAs() ?: callElement
@@ -1,17 +1,6 @@
/* /*
* Copyright 2010-2017 JetBrains s.r.o. * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* * that can be found in the license/LICENSE.txt file.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.kotlin.types.expressions; package org.jetbrains.kotlin.types.expressions;
@@ -1,17 +1,6 @@
/* /*
* Copyright 2010-2017 JetBrains s.r.o. * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* * that can be found in the license/LICENSE.txt file.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.kotlin.types.expressions; package org.jetbrains.kotlin.types.expressions;
@@ -22,6 +11,7 @@ import org.jetbrains.kotlin.config.LanguageVersionSettings;
import org.jetbrains.kotlin.psi.KtExpression; import org.jetbrains.kotlin.psi.KtExpression;
import org.jetbrains.kotlin.resolve.BindingTrace; import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.StatementFilter; import org.jetbrains.kotlin.resolve.StatementFilter;
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession;
import org.jetbrains.kotlin.resolve.calls.context.*; import org.jetbrains.kotlin.resolve.calls.context.*;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory;
@@ -39,7 +29,22 @@ public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingC
@NotNull LanguageVersionSettings languageVersionSettings, @NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory @NotNull DataFlowValueFactory dataFlowValueFactory
) { ) {
return newContext(trace, scope, dataFlowInfo, expectedType, ContextDependency.INDEPENDENT, StatementFilter.NONE, languageVersionSettings, dataFlowValueFactory); return newContext(trace, scope, dataFlowInfo, expectedType, ContextDependency.INDEPENDENT, StatementFilter.NONE,
languageVersionSettings, dataFlowValueFactory, InferenceSession.Companion.getDefault());
}
@NotNull
public static ExpressionTypingContext newContext(
@NotNull BindingTrace trace,
@NotNull LexicalScope scope,
@NotNull DataFlowInfo dataFlowInfo,
@NotNull KotlinType expectedType,
@NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory,
@NotNull InferenceSession inferenceSession
) {
return newContext(trace, scope, dataFlowInfo, expectedType, ContextDependency.INDEPENDENT, StatementFilter.NONE,
languageVersionSettings, dataFlowValueFactory, inferenceSession);
} }
@NotNull @NotNull
@@ -51,10 +56,27 @@ public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingC
@NotNull ContextDependency contextDependency, @NotNull ContextDependency contextDependency,
@NotNull StatementFilter statementFilter, @NotNull StatementFilter statementFilter,
@NotNull LanguageVersionSettings languageVersionSettings, @NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory @NotNull DataFlowValueFactory dataFlowValueFactory) {
return newContext(trace, scope, dataFlowInfo, expectedType, contextDependency,
new ResolutionResultsCacheImpl(), statementFilter, false, languageVersionSettings, dataFlowValueFactory,
InferenceSession.Companion.getDefault());
}
@NotNull
public static ExpressionTypingContext newContext(
@NotNull BindingTrace trace,
@NotNull LexicalScope scope,
@NotNull DataFlowInfo dataFlowInfo,
@NotNull KotlinType expectedType,
@NotNull ContextDependency contextDependency,
@NotNull StatementFilter statementFilter,
@NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory,
@NotNull InferenceSession inferenceSession
) { ) {
return newContext(trace, scope, dataFlowInfo, expectedType, contextDependency, return newContext(trace, scope, dataFlowInfo, expectedType, contextDependency,
new ResolutionResultsCacheImpl(), statementFilter, false, languageVersionSettings, dataFlowValueFactory); new ResolutionResultsCacheImpl(), statementFilter, false, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
} }
@NotNull @NotNull
@@ -65,7 +87,7 @@ public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingC
context.statementFilter, context.statementFilter,
context.isAnnotationContext, context.isDebuggerContext, context.collectAllCandidates, context.isAnnotationContext, context.isDebuggerContext, context.collectAllCandidates,
context.callPosition, context.expressionContextProvider, context.languageVersionSettings, context.callPosition, context.expressionContextProvider, context.languageVersionSettings,
context.dataFlowValueFactory); context.dataFlowValueFactory, context.inferenceSession);
} }
@NotNull @NotNull
@@ -77,7 +99,7 @@ public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingC
context.isAnnotationContext, isDebuggerContext, context.collectAllCandidates, context.isAnnotationContext, isDebuggerContext, context.collectAllCandidates,
context.callPosition, context.expressionContextProvider, context.callPosition, context.expressionContextProvider,
context.languageVersionSettings, context.languageVersionSettings,
context.dataFlowValueFactory); context.dataFlowValueFactory, context.inferenceSession);
} }
@NotNull @NotNull
@@ -91,12 +113,14 @@ public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingC
@NotNull StatementFilter statementFilter, @NotNull StatementFilter statementFilter,
boolean isAnnotationContext, boolean isAnnotationContext,
@NotNull LanguageVersionSettings languageVersionSettings, @NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory @NotNull DataFlowValueFactory dataFlowValueFactory,
@NotNull InferenceSession inferenceSession
) { ) {
return new ExpressionTypingContext( return new ExpressionTypingContext(
trace, scope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache, trace, scope, dataFlowInfo, expectedType, contextDependency, resolutionResultsCache,
statementFilter, isAnnotationContext, false, false, statementFilter, isAnnotationContext, false, false,
CallPosition.Unknown.INSTANCE, DEFAULT_EXPRESSION_CONTEXT_PROVIDER, languageVersionSettings, dataFlowValueFactory); CallPosition.Unknown.INSTANCE, DEFAULT_EXPRESSION_CONTEXT_PROVIDER, languageVersionSettings, dataFlowValueFactory,
inferenceSession);
} }
private ExpressionTypingContext( private ExpressionTypingContext(
@@ -113,11 +137,12 @@ public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingC
@NotNull CallPosition callPosition, @NotNull CallPosition callPosition,
@NotNull Function1<KtExpression, KtExpression> expressionContextProvider, @NotNull Function1<KtExpression, KtExpression> expressionContextProvider,
@NotNull LanguageVersionSettings languageVersionSettings, @NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory @NotNull DataFlowValueFactory dataFlowValueFactory,
@NotNull InferenceSession inferenceSession
) { ) {
super(trace, scope, expectedType, dataFlowInfo, contextDependency, resolutionResultsCache, super(trace, scope, expectedType, dataFlowInfo, contextDependency, resolutionResultsCache,
statementFilter, isAnnotationContext, isDebuggerContext, collectAllCandidates, callPosition, expressionContextProvider, statementFilter, isAnnotationContext, isDebuggerContext, collectAllCandidates, callPosition, expressionContextProvider,
languageVersionSettings, dataFlowValueFactory); languageVersionSettings, dataFlowValueFactory, inferenceSession);
} }
@Override @Override
@@ -133,12 +158,13 @@ public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingC
@NotNull CallPosition callPosition, @NotNull CallPosition callPosition,
@NotNull Function1<KtExpression, KtExpression> expressionContextProvider, @NotNull Function1<KtExpression, KtExpression> expressionContextProvider,
@NotNull LanguageVersionSettings languageVersionSettings, @NotNull LanguageVersionSettings languageVersionSettings,
@NotNull DataFlowValueFactory dataFlowValueFactory @NotNull DataFlowValueFactory dataFlowValueFactory,
@NotNull InferenceSession inferenceSession
) { ) {
return new ExpressionTypingContext(trace, scope, dataFlowInfo, return new ExpressionTypingContext(trace, scope, dataFlowInfo,
expectedType, contextDependency, resolutionResultsCache, expectedType, contextDependency, resolutionResultsCache,
statementFilter, isAnnotationContext, isDebuggerContext, statementFilter, isAnnotationContext, isDebuggerContext,
collectAllCandidates, callPosition, expressionContextProvider, collectAllCandidates, callPosition, expressionContextProvider,
languageVersionSettings, dataFlowValueFactory); languageVersionSettings, dataFlowValueFactory, inferenceSession);
} }
} }
@@ -1,17 +1,6 @@
/* /*
* Copyright 2010-2017 JetBrains s.r.o. * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* * that can be found in the license/LICENSE.txt file.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.kotlin.resolve.calls.components package org.jetbrains.kotlin.resolve.calls.components
@@ -50,4 +39,6 @@ interface KotlinResolutionCallbacks {
fun createReceiverWithSmartCastInfo(resolvedAtom: ResolvedCallAtom): ReceiverValueWithSmartCastInfo? fun createReceiverWithSmartCastInfo(resolvedAtom: ResolvedCallAtom): ReceiverValueWithSmartCastInfo?
fun isCompileTimeConstant(resolvedAtom: ResolvedCallAtom, expectedType: UnwrappedType): Boolean fun isCompileTimeConstant(resolvedAtom: ResolvedCallAtom, expectedType: UnwrappedType): Boolean
val inferenceSession: InferenceSession
} }
@@ -163,4 +163,10 @@ class KotlinCallCompleter(
systemStorage systemStorage
) )
} }
}
interface InferenceSession {
companion object {
val default = object : InferenceSession {}
}
} }