Search in sources :

Example 1 with SupertypeConstraint

use of org.jetbrains.plugins.groovy.lang.psi.expectedTypes.SupertypeConstraint in project intellij-community by JetBrains.

the class ChooseTypeExpression method createItems.

@NotNull
private static List<SmartTypePointer> createItems(@NotNull TypeConstraint[] constraints, @NotNull SmartTypePointerManager typePointerManager) {
    List<SmartTypePointer> result = ContainerUtil.newArrayList();
    for (TypeConstraint constraint : constraints) {
        if (constraint instanceof SubtypeConstraint) {
            PsiType type = constraint.getDefaultType();
            result.add(typePointerManager.createSmartTypePointer(type));
        } else if (constraint instanceof SupertypeConstraint) {
            processSuperTypes(constraint.getType(), result, typePointerManager);
        }
    }
    return result;
}
Also used : SubtypeConstraint(org.jetbrains.plugins.groovy.lang.psi.expectedTypes.SubtypeConstraint) SupertypeConstraint(org.jetbrains.plugins.groovy.lang.psi.expectedTypes.SupertypeConstraint) TypeConstraint(org.jetbrains.plugins.groovy.lang.psi.expectedTypes.TypeConstraint) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

NotNull (org.jetbrains.annotations.NotNull)1 SubtypeConstraint (org.jetbrains.plugins.groovy.lang.psi.expectedTypes.SubtypeConstraint)1 SupertypeConstraint (org.jetbrains.plugins.groovy.lang.psi.expectedTypes.SupertypeConstraint)1 TypeConstraint (org.jetbrains.plugins.groovy.lang.psi.expectedTypes.TypeConstraint)1