void (@NotNull GrReturnStatement returnStatement) { GrParameterListOwner parent = PsiTreeUtil.getParentOfType(returnStatement, GrParameterListOwner.class); if (parent instanceof GrMethod) { GrTypeElement typeElement = ((GrMethod)parent).getReturnTypeElementGroovy(); if (typeElement != null) { PsiType type = typeElement.getType(); myResult = new TypeConstraint[]{SubtypeConstraint.create(type)}; } } }