Parameters of function types are always considered local
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2016 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -782,6 +782,11 @@ public class KtPsiUtil {
|
|||||||
declaration = PsiTreeUtil.getParentOfType(declaration, KtNamedDeclaration.class);
|
declaration = PsiTreeUtil.getParentOfType(declaration, KtNamedDeclaration.class);
|
||||||
}
|
}
|
||||||
else if (declaration instanceof KtParameter) {
|
else if (declaration instanceof KtParameter) {
|
||||||
|
KtFunctionType functionType = PsiTreeUtil.getParentOfType(declaration, KtFunctionType.class);
|
||||||
|
if (functionType != null) {
|
||||||
|
return functionType;
|
||||||
|
}
|
||||||
|
|
||||||
PsiElement parent = declaration.getParent();
|
PsiElement parent = declaration.getParent();
|
||||||
|
|
||||||
// val/var parameter of primary constructor should be considered as local according to containing class
|
// val/var parameter of primary constructor should be considered as local according to containing class
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
fun <K, V> intercept(<warning>block</warning>: (key: K, next: (K) -> V, K) -> V) {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T : (Int) -> String> f() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> g() where T: (unit: Unit) -> Unit {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class C<T : (Int) -> String>() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class CC<T>() where T : (Int) -> String {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
interface I<T>
|
||||||
|
|
||||||
|
val c = object : I<(String) -> String> {}
|
||||||
|
|
||||||
|
class CCC() : I<(Int) -> Int>
|
||||||
@@ -496,6 +496,12 @@ public class PsiCheckerTestGenerated extends AbstractPsiCheckerTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("FunctionTypes.kt")
|
||||||
|
public void testFunctionTypes() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/checker/regression/FunctionTypes.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InterfaceDeclarationAsExpression.kt")
|
@TestMetadata("InterfaceDeclarationAsExpression.kt")
|
||||||
public void testInterfaceDeclarationAsExpression() throws Exception {
|
public void testInterfaceDeclarationAsExpression() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/checker/regression/InterfaceDeclarationAsExpression.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/checker/regression/InterfaceDeclarationAsExpression.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user