Changed behavior

This commit is contained in:
Valentin Kipyatkov
2015-11-03 21:39:29 +03:00
parent b73c574d19
commit 731f19ee36
3 changed files with 12 additions and 9 deletions
@@ -47,14 +47,17 @@ class InsertHandlerProvider(
0 -> KotlinFunctionInsertHandler.Normal(needTypeArguments, inputValueArguments = false)
1 -> {
val parameterType = parameters.single().getType()
if (KotlinBuiltIns.isExactFunctionOrExtensionFunctionType(parameterType)) {
val parameterCount = KotlinBuiltIns.getParameterTypeProjectionsFromFunctionType(parameterType).size()
if (parameterCount <= 1) {
// otherwise additional item with lambda template is to be added
return KotlinFunctionInsertHandler.Normal(needTypeArguments, inputValueArguments = false, lambdaInfo = GenerateLambdaInfo(parameterType, false))
if (callType != CallType.SUPER_MEMBERS) { // for super call we don't suggest to generate "super.foo { ... }" (seems to be non-typical use)
val parameterType = parameters.single().getType()
if (KotlinBuiltIns.isExactFunctionOrExtensionFunctionType(parameterType)) {
val parameterCount = KotlinBuiltIns.getParameterTypeProjectionsFromFunctionType(parameterType).size()
if (parameterCount <= 1) {
// otherwise additional item with lambda template is to be added
return KotlinFunctionInsertHandler.Normal(needTypeArguments, inputValueArguments = false, lambdaInfo = GenerateLambdaInfo(parameterType, false))
}
}
}
KotlinFunctionInsertHandler.Normal(needTypeArguments, inputValueArguments = true)
}
@@ -66,7 +66,7 @@ class LookupElementFactory(
result.add(lookupElement)
// add special item for function with one argument of function type with more than one parameter
if (descriptor is FunctionDescriptor && isNormalCall) {
if (descriptor is FunctionDescriptor && isNormalCall && callType != CallType.SUPER_MEMBERS) {
result.addSpecialFunctionCallElements(descriptor, useReceiverTypes)
}
+2 -2
View File
@@ -49,6 +49,6 @@ abstract class A : Base(), I {
// EXIST_JAVA_ONLY: { itemText: "getAbsolutePath", attributes: "" }
// ABSENT: absolutePath
// EXIST: { itemText: "onLambda1", tailText: " {...} (p: () -> Unit)", attributes: "" }
// EXIST: { itemText: "onLambda1", tailText: "(p: () -> Unit)", attributes: "" }
// EXIST: { itemText: "onLambda2", tailText: "(p: (Int, String) -> Unit)", attributes: "" }
// EXIST: { itemText: "onLambda2", tailText: " { Int, String -> ... } (p: (Int, String) -> Unit)", attributes: "" }
// ABSENT: { itemText: "onLambda2", tailText: " { Int, String -> ... } (p: (Int, String) -> Unit)" }