Repository navigation
[Validation] free function validation between puml and cpp - #518
Conversation
| error.build() | ||
| } | ||
|
|
||
| fn format_missing_free_function( |
There was a problem hiding this comment.
format_missing_free_function shows qualified_name() without the parameter list. With overloads Select(int) and Select(int, int) both missing
There was a problem hiding this comment.
update logic and the intergration test "negative_free_function_overloads_missing"
| design_function: &FreeFunctionDecl, | ||
| implementation_function: &FreeFunctionDecl, | ||
| ) { | ||
| let function_name = design_function.qualified_name(); |
There was a problem hiding this comment.
The reader stores enclosing_namespace_id with . separators (uid_utils::normalize), and qualified_name() then adds ::. Nested namespaces therefore show as vehicle.core::Dispatch, while the suggestion line shows vehicle::core::Dispatch()
(same for L 145, L605, L635)
There was a problem hiding this comment.
Thanks for pointing this out. I normalized free-function qualified names to use :: consistently in all affected diagnostic locations, including the ones mentioned above. I also added a regression test for nested namespaces to ensure diagnostics consistently render vehicle::core::Dispatch.
| .join(", ") | ||
| } | ||
|
|
||
| fn parameter_differences( |
There was a problem hiding this comment.
method error output changed. method "X" parameter list is now split into parameter variadic and parameter pack expansion, so one parameter can produce two errors that show the same full parameter list.
Any Suggestion how we can solve it differently? If too complicated, then lets keep it
There was a problem hiding this comment.
Thank you for the suggestion. I considered rendering only the affected parameter for these diagnostics.
I kept the full parameter list because it provides more useful context for variadic and pack-expansion mismatches. Rendering only the affected parameter can also lose information; for example, a C-style variadic parameter may be rendered as <unknown>.
For example:
// Puml file:
Dispatch(...)
// Cpp Implementation:
Dispatch(int argument)
// Diagnostic values:
Design value : (...)
Implementation value : (argument: int)
Similarly, showing the complete signatures makes a pack-expansion mismatch clear:
// Puml file:
Expand(id : int, , retry : bool, argument : int)
// Cpp Implementation:
Template <typename... Arguments>
Expand(int id, bool retry, Arguments... arguments)
// Diagnostic values:
Design value : (id : int, , retry : bool, argument : int)
Implementation value : (int id, bool retry, Arguments... arguments)
Also, C-style variadic parameters (...) and template pack expansions (T... args) are distinct C++ constructs, so the same parameter should not produce both errors. Therefore, we do not expect duplicated full-list output for a single parameter.
I updated the integration coverage to keep the complete parameter-list output for both cases.
| } | ||
| } | ||
|
|
||
| free_functions.extend(diagram.free_functions.iter().cloned()); |
There was a problem hiding this comment.
free functions are appended without checking for duplicates, while duplicate classes raise "defined more than once"
There was a problem hiding this comment.
Thank you for raising this. I considered duplicate handling for free functions while working on this change.
However, free functions support overloads, and the C++ parser already filters duplicate declarations. Adding validation here would therefore require a separate, signature-based definition of a duplicate and corresponding coverage for its edge cases. Given that scope and the limited benefit for the current change, I decided not to introduce it here.
| int Select(int mode, int force); | ||
|
|
||
| template <typename Payload> | ||
| Payload Convert(Payload payload){} |
There was a problem hiding this comment.
Payload Convert(Payload payload){} is a non-void function with an empty body -> undefined behaviour
There was a problem hiding this comment.
update the test example:)
ec1928a to
70cb47b
Compare
No description provided.