Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-80409

[CQF] Improve compile-time error messages of PolyValue, algebra::transport

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization

      When you call a template function with the wrong arguments, the default error message points to the implementation of the template, and buries the true problem in a list of "required from here" / "included from here" notes.

      In C++20 we can use concepts and 'requires' clauses to improve these error messages. For example, if we add this clause:

          template <typename T, typename... Args>
          requires(std::constructible_from<T, Args...>)
          static PolyValue make(Args&&... args) {
              return PolyValue{ControlBlockVTable<T, Ts...>::make(std::forward<Args>(args)...)};
          }
      

      then a misuse like ABT::make<Variable>(5) would be caught at the call site, instead of in polyvalue.h.

      Another good candidate is algebra::transport. Specifying its requirements is probably harder because its interface has many different options. But that complex interface is also why improving its error messages would be so useful.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            david.percy@mongodb.com David Percy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: