protected boolean isCompatibleArgument( JvmTypeReference declaredType, JvmTypeReference actualType) { if (actualType == null) return true; if (actualType.getType() instanceof JvmTypeParameter) { JvmTypeParameter type = (JvmTypeParameter) actualType.getType(); if (type.getConstraints().isEmpty()) return true; for (JvmTypeConstraint constraint : type.getConstraints()) { if (isCompatibleArgument(declaredType, constraint.getTypeReference())) return true; } return false; } return conformance.isConformant(declaredType, actualType, true); }
protected String _case( JvmOperation input, XUnaryOperation context, EReference reference, JvmFeatureDescription jvmFeatureDescription) { if (input.getParameters().size() != 1) return INVALID_NUMBER_OF_ARGUMENTS; if (context.getOperand() != null) { JvmTypeReference operandType = getTypeProvider().getType(context.getOperand(), true); final JvmFormalParameter param = input.getParameters().get(0); if (!conformance.isConformant(param.getParameterType(), operandType, true)) return INVALID_ARGUMENT_TYPES; } return null; }
protected String _case( JvmOperation input, XBinaryOperation context, EReference ref, JvmFeatureDescription jvmFeatureDescription) { final int irrelevantArguments = jvmFeatureDescription.getNumberOfIrrelevantArguments(); if (input.getParameters().size() - irrelevantArguments != 1) return INVALID_NUMBER_OF_ARGUMENTS; if (context.getRightOperand() != null && context.getLeftOperand() != null) { JvmTypeReference rightOperandType = getTypeProvider().getType(context.getRightOperand(), true); if (rightOperandType == null) return INVALID_ARGUMENT_TYPES; final JvmFormalParameter rightParam = input.getParameters().get(0 + irrelevantArguments); if (!conformance.isConformant(rightParam.getParameterType(), rightOperandType, true)) return INVALID_ARGUMENT_TYPES; } return null; }