Optimizations
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.calls;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import kotlin.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -52,6 +51,7 @@ import org.jetbrains.kotlin.types.expressions.*;
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -272,7 +272,7 @@ public class ArgumentTypeResolver {
|
||||
}
|
||||
|
||||
return FunctionTypeResolveUtilsKt.createFunctionType(
|
||||
builtIns, Annotations.Companion.getEMPTY(), null, Collections.<KotlinType>emptyList(), Collections.<Name>emptyList(), TypeUtils.DONT_CARE
|
||||
builtIns, Annotations.Companion.getEMPTY(), null, Collections.<KotlinType>emptyList(), null, TypeUtils.DONT_CARE
|
||||
);
|
||||
}
|
||||
|
||||
@@ -303,14 +303,14 @@ public class ArgumentTypeResolver {
|
||||
? functionPlaceholders
|
||||
.createFunctionPlaceholderType(Collections.<KotlinType>emptyList(), /* hasDeclaredArguments = */ false)
|
||||
: FunctionTypeResolveUtilsKt.createFunctionType(
|
||||
builtIns, Annotations.Companion.getEMPTY(), null, Collections.<KotlinType>emptyList(), Collections.<Name>emptyList(), DONT_CARE
|
||||
builtIns, Annotations.Companion.getEMPTY(), null, Collections.<KotlinType>emptyList(), null, DONT_CARE
|
||||
);
|
||||
}
|
||||
List<KtParameter> valueParameters = function.getValueParameters();
|
||||
TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(
|
||||
trace, "trace to resolve function literal parameter types");
|
||||
List<KotlinType> parameterTypes = Lists.newArrayList();
|
||||
List<Name> parameterNames = Lists.newArrayList();
|
||||
List<KotlinType> parameterTypes = new ArrayList<KotlinType>(valueParameters.size());
|
||||
List<Name> parameterNames = new ArrayList<Name>(valueParameters.size());
|
||||
for (KtParameter parameter : valueParameters) {
|
||||
parameterTypes.add(resolveTypeRefWithDefault(parameter.getTypeReference(), scope, temporaryTrace, DONT_CARE));
|
||||
Name name = parameter.getNameAsName();
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.config.LanguageVersionSettings;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.name.SpecialNames;
|
||||
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.*;
|
||||
@@ -291,13 +290,11 @@ public class CallResolver {
|
||||
if (calleeExpression instanceof KtLambdaExpression) {
|
||||
int parameterNumber = ((KtLambdaExpression) calleeExpression).getValueParameters().size();
|
||||
List<KotlinType> parameterTypes = new ArrayList<KotlinType>(parameterNumber);
|
||||
List<Name> parameterNames = new ArrayList<Name>(parameterNumber);
|
||||
for (int i = 0; i < parameterNumber; i++) {
|
||||
parameterTypes.add(NO_EXPECTED_TYPE);
|
||||
parameterNames.add(SpecialNames.NO_NAME_PROVIDED);
|
||||
}
|
||||
expectedType = FunctionTypeResolveUtilsKt.createFunctionType(
|
||||
builtIns, Annotations.Companion.getEMPTY(), null, parameterTypes, parameterNames, context.expectedType
|
||||
builtIns, Annotations.Companion.getEMPTY(), null, parameterTypes, null, context.expectedType
|
||||
);
|
||||
}
|
||||
KotlinType calleeType = expressionTypingServices.safeGetType(
|
||||
|
||||
+1
-3
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.resolve.calls.inference
|
||||
import org.jetbrains.kotlin.builtins.isExtensionFunctionType
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilderImpl.ConstraintKind.EQUAL
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilderImpl.ConstraintKind.SUB_TYPE
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.TypeBounds.Bound
|
||||
@@ -449,6 +448,5 @@ internal fun createTypeForFunctionPlaceholder(
|
||||
functionPlaceholderTypeConstructor.argumentTypes
|
||||
}
|
||||
val receiverType = if (isExtension) DONT_CARE else null
|
||||
val parameterNames = newArgumentTypes.map { SpecialNames.NO_NAME_PROVIDED }
|
||||
return createFunctionType(functionPlaceholder.builtIns, Annotations.EMPTY, receiverType, newArgumentTypes, parameterNames, DONT_CARE)
|
||||
return createFunctionType(functionPlaceholder.builtIns, Annotations.EMPTY, receiverType, newArgumentTypes, null, DONT_CARE)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user