mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
correct type substitution for method-closures
This commit is contained in:
+1
-1
@@ -49,7 +49,7 @@ public class GrClosureParameterImpl implements GrClosureParameter {
|
||||
}
|
||||
|
||||
public static boolean isParameterOptional(PsiParameter parameter) {
|
||||
return parameter instanceof GrParameter ? ((GrParameter)parameter).isOptional() : false;
|
||||
return parameter instanceof GrParameter && ((GrParameter)parameter).isOptional();
|
||||
}
|
||||
|
||||
public static boolean isVararg(GrClosureParameter[] closureParams) {
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ public class GrClosureSignatureUtil {
|
||||
return new GrClosureSignatureImpl(method.getParameterList().getParameters(), null, substitutor) {
|
||||
@Override
|
||||
public PsiType getReturnType() {
|
||||
return PsiUtil.getSmartReturnType(method);
|
||||
return getSubstitutor().substitute(PsiUtil.getSmartReturnType(method));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -204,4 +204,8 @@ public class TypeInferenceTest extends GroovyResolveTestCase {
|
||||
public void testPreferMethodOverloader() {
|
||||
assertTypeEquals("java.lang.String", "A.groovy");
|
||||
}
|
||||
|
||||
public void testReturnTypeFromMethodClosure() {
|
||||
assertTypeEquals("java.lang.String","A.groovy");
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class Test<T> {
|
||||
T foo(T t) {t}
|
||||
}
|
||||
|
||||
def test=new Test<String>()
|
||||
def a = test.&foo
|
||||
def res = a("a")
|
||||
print re<ref>s
|
||||
Reference in New Issue
Block a user