use of org.jetbrains.plugins.groovy.findUsages.LiteralConstructorReference in project intellij-community by JetBrains.
the class GppTypeConverter method isConvertible.
@Override
public Boolean isConvertible(@NotNull PsiType lType, @NotNull PsiType rType, @NotNull GroovyPsiElement context) {
if (context instanceof GrListOrMap && context.getReference() instanceof LiteralConstructorReference && ((LiteralConstructorReference) context.getReference()).getConstructedClassType() != null)
return null;
if (rType instanceof GrTupleType) {
final GrTupleType tupleType = (GrTupleType) rType;
final PsiType expectedComponent = PsiUtil.extractIterableTypeParameter(lType, false);
if (expectedComponent != null && isMethodCallConversion(context)) {
PsiType[] parameters = tupleType.getParameters();
if (parameters.length == 1) {
PsiType tupleComponent = parameters[0];
if (tupleComponent != null && TypesUtil.isAssignable(expectedComponent, tupleComponent, context) && hasDefaultConstructor(lType)) {
return true;
}
}
}
}
return null;
}
Aggregations