protected Type getTypeWithProcType(Environment<Type> env, ProcedureType type)
			throws TypeIllegalException, TypeEnvironmentException {
		ASTArguments args = (ASTArguments) getChild(0);
		LinkedList<Type> types = args.getTypeList(env);
		Collection<Type> requiredTypes = type.getArgumentTypes();

		if (types.isEmpty() && !requiredTypes.isEmpty())
			throw new TypeIllegalException(null,
					"No arguments for procedure that requires arguments",
					getChild(0).jjtGetFirstToken());
		else if (requiredTypes.isEmpty() && !types.isEmpty())
			throw new TypeIllegalException(null,
					"Arguments were passed to procedure without arguments",
					getChild(0).jjtGetFirstToken());
		else {
			int i = 1;
			for (Type t : requiredTypes) {
				if (types.isEmpty())
					throw new TypeIllegalException(null,
							"Procedure expected argument of type " + t
									+ ", but got none", jjtGetLastToken());
				if (!types.getFirst().isAssignableTo(t))
					throw new TypeIllegalException(types.getFirst(),
							"Argument number " + i + " should have type " + t
									+ ", but is " + types.getFirst(), getChild(
									0).jjtGetFirstToken()); // ToDo: inexact
															// position
				types.pollFirst();
				i++;
			}
			if (!types.isEmpty())
				throw new TypeIllegalException(
						null,
						"More arguments than required were passed to procedure!",
						getChild(0).jjtGetFirstToken());
		}

		return type.getReturnType();
	}