MemberMatching: drop usage of KotlinBuiltIns.getInstance()
This commit is contained in:
@@ -376,9 +376,19 @@ public class KotlinBuiltIns {
|
|||||||
return getBuiltInClassByName("Unit");
|
return getBuiltInClassByName("Unit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static String getFunctionName(int parameterCount) {
|
||||||
|
return "Function" + parameterCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static String getExtensionFunctionName(int parameterCount) {
|
||||||
|
return getFunctionName(parameterCount + 1);
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getFunction(int parameterCount) {
|
public ClassDescriptor getFunction(int parameterCount) {
|
||||||
return getBuiltInClassByName("Function" + parameterCount);
|
return getBuiltInClassByName(getFunctionName(parameterCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -388,7 +398,7 @@ public class KotlinBuiltIns {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getExtensionFunction(int parameterCount) {
|
public ClassDescriptor getExtensionFunction(int parameterCount) {
|
||||||
return getBuiltInClassByName("Function" + (parameterCount + 1));
|
return getBuiltInClassByName(getExtensionFunctionName((parameterCount)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
+6
-6
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.lexer.JetTokens;
|
|||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.psi.*;
|
import org.jetbrains.kotlin.psi.*;
|
||||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||||
|
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||||
import org.jetbrains.kotlin.types.JetType;
|
import org.jetbrains.kotlin.types.JetType;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -73,14 +74,12 @@ public class MemberMatching {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String visitFunctionType(@NotNull JetFunctionType type, Void data) {
|
public String visitFunctionType(@NotNull JetFunctionType type, Void data) {
|
||||||
KotlinBuiltIns builtIns = KotlinBuiltIns.getInstance();
|
|
||||||
int parameterCount = type.getParameters().size();
|
int parameterCount = type.getParameters().size();
|
||||||
|
if (type.getReceiverTypeReference() != null) {
|
||||||
if (type.getReceiverTypeReference() == null) {
|
return KotlinBuiltIns.getExtensionFunctionName(parameterCount);
|
||||||
return builtIns.getFunction(parameterCount).getName().asString();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return builtIns.getExtensionFunction(parameterCount).getName().asString();
|
return KotlinBuiltIns.getFunctionName(parameterCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,8 +228,9 @@ public class MemberMatching {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
KotlinBuiltIns builtIns = DescriptorUtilsKt.getBuiltIns(descriptor);
|
||||||
Set<String> decompiledUpperBounds = decompiledParameterToBounds.get(descriptor.getName()).isEmpty()
|
Set<String> decompiledUpperBounds = decompiledParameterToBounds.get(descriptor.getName()).isEmpty()
|
||||||
? Sets.newHashSet(DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(KotlinBuiltIns.getInstance().getDefaultBound()))
|
? Sets.newHashSet(DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(builtIns.getDefaultBound()))
|
||||||
: Sets.newHashSet(decompiledParameterToBounds.get(descriptor.getName()));
|
: Sets.newHashSet(decompiledParameterToBounds.get(descriptor.getName()));
|
||||||
if (!descriptorUpperBounds.equals(decompiledUpperBounds)) {
|
if (!descriptorUpperBounds.equals(decompiledUpperBounds)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user