jbcoe / jbcoe/cc-protocol

Duplicated name computation and two naming schemes in `protocol_interface_function_infos`

Open Beginner friendly
#406 0 comments 0 reactions 0 assignees View on GitHub
Important
Dominant language
C++
Stars
11
Forks
4
Avg merge
16h 39m
Merged PRs (30d)
131

Description

In conformance.hh:196-228 (after #388):

- the `has_identifier(member) ? identifier_of(member) : display_string_of(member)` expression is written out twice (lines 202 and 210);
- `is_operator_function(member)` is tested in two consecutive `if`s and `operator_of(member)` is called three times;
- `operator_diagnostic_name` (line 176) hand-rolls a lowercase-first-character test over `symbol_of` to decide on a space, while the neighbouring ref-qualifier and explicit-object diagnostics use the identifier/display-string idiom, which already renders an operator correctly and names the exact overload.

So an interface with two rejected `operator==` overloads gets a message naming neither, while the adjacent diagnostic pinpoints its member, and a member that is both ref-qualified and a blocklisted operator prints its name two ways depending on which check fires first. The next rejection rule would copy the name computation a third time.

Hoisting `std::string name = ...` once and nesting the operator checks under a single `if (is_operator_function(member)) { auto op = operator_of(member); ... }` removes all of it. `parameters_of(member)` is also materialised for every member just to test `empty()`, on a path that runs for every (interface, candidate) pair.

Contributor guide

Open the contributing guide

Research direction

Start in conformance.hh:176-228, especially operator_diagnostic_name and protocol_interface_function_infos. Review the repeated name and operator checks, then confirm rejected overload diagnostics identify the exact member consistently and that parameter information is not materialised unnecessarily for the empty check.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.