-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] don't hard-fail on concept check #1394
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1394 +/- ##
=======================================
Coverage 97.53% 97.53%
=======================================
Files 228 228
Lines 8731 8731
=======================================
Hits 8516 8516
Misses 215 215
Continue to review full report at Codecov.
|
{ | ||
typename std::remove_reference_t<validator_type>::value_type; | ||
|
||
{ validator(value) } -> void; | ||
{ validator(typename std::remove_reference_t<validator_type>::value_type{}) } -> void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use decval in case the value type is not default constructible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it doesn't wark because GCC7 and GCC8 at least trigger ODR-use of that statement (although they shouldn't) which results in the compiler telling you that you cannot use declval in an evaluated context. 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I've seen this as well, which is annoying.
(do not merge yet, still WIP) |
17a41ae
to
e8f1eca
Compare
Ok, a different "fix" was necessary, because the problem is that the concept check of GCC doesn't cope with something existing, but being private/protected. It will result in hard errors instead of failing the concept. But since |
@@ -293,7 +293,7 @@ class argument_parser | |||
template <typename option_type, validator validator_type = detail::default_validator<option_type>> | |||
//!\cond | |||
requires (argument_parser_compatible_option<option_type> || | |||
argument_parser_compatible_option<typename option_type::value_type>) && | |||
argument_parser_compatible_option<std::ranges::range_value_t<option_type>>) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is just a drive-by fix
fine with me. Good thing we are not stable yet... |
CI is failing though |
@@ -48,6 +48,8 @@ If possible, provide tooling that performs the changes, e.g. a shell-script. | |||
* **Changed class signature of input/output file validators:** | |||
Most user code will be unaffected; to fix possible compiler errors you need to add an empty template parameter list to | |||
the respective instances (e.g. change `input_file_validator` to `input_file_validator<>`). | |||
* The member type that denotes which arguments a `validator` can validate has been renamed from `value_type` to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a) why and b) what has this to do with the hard fails on concept checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
Ok, a different "fix" was necessary, because the problem is that the concept check of GCC doesn't cope with something existing, but being private/protected. It will result in hard errors instead of failing the concept.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(our ranges often have protected or private ::value_type
)
I know, I hope to have time for it tomorrow. |
e8f1eca
to
32f0e0c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest a different name. I also spotted some documentation issues, that could be fixed right along. Many thanks
@@ -97,7 +97,7 @@ SEQAN3_CONCEPT validator = std::copyable<remove_cvref_t<validator_type>> && | |||
* \ingroup argument_parser | |||
* \implements seqan3::validator | |||
* | |||
* \tparam option_value_type Must be a (container of) arithmetic type(s). | |||
* \tparam option_input_type Must be a (container of) arithmetic type(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but this class has no template parameter
@@ -176,12 +176,12 @@ class arithmetic_range_validator | |||
* | |||
* \include test/snippet/argument_parser/validators_2.cpp | |||
*/ | |||
template <typename option_value_type> | |||
template <typename option_input_type> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here tparam is not documented 🤕
CHANGELOG.md
Outdated
@@ -48,6 +48,8 @@ If possible, provide tooling that performs the changes, e.g. a shell-script. | |||
* **Changed class signature of input/output file validators:** | |||
Most user code will be unaffected; to fix possible compiler errors you need to add an empty template parameter list to | |||
the respective instances (e.g. change `input_file_validator` to `input_file_validator<>`). | |||
* The member type that denotes which arguments a `validator` can validate has been renamed from `value_type` to | |||
`input_type`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess calling it option_value_type
would be more fitting. At the end a validator validates the value of an option. Accordingly, we want to know the value type an option represents.
@@ -896,14 +896,14 @@ namespace detail | |||
* The default validator is needed to make the validator parameter of | |||
* argument_parser::add_option and argument_parser::add_option optional. | |||
*/ | |||
template <typename option_value_type> | |||
template <typename option_input_type> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tparam not documented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be then as well option_value_t
@@ -176,12 +176,12 @@ class arithmetic_range_validator | |||
* | |||
* \include test/snippet/argument_parser/validators_2.cpp | |||
*/ | |||
template <typename option_value_type> | |||
template <typename option_input_type> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would then be option_value_t
to not clash with the typedef inside.
32f0e0c
to
9572910
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
9572910
to
cde9729
Compare
You may not do the things you are doing in the signature of the requires expression, because their validity depends on the result of the requires expression.
This leads to hard-failure for types that would normally soft-fail. Since the concept is checked on globally defined
operator|
this can lead to all sorts of view-resolution failures to land here and hard-fail.@sarahet Please check if this removes the first error.