You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More of a footgun then anything else, but if one mistakenly passes two parameters to Optional, the
resultant error message contains both, which can confuse the end user:
perl -MTypes::Standard=-all -e 'Optional([Str,CodeRef])->assert_valid(sub{})'
Reference sub { "DUMMY" } did not pass type constraint "Optional[Str,CodeRef]" at -e line 1
Reference sub { "DUMMY" } did not pass type constraint "Optional[Str,CodeRef]"
$_ exists
"Optional[Str,CodeRef]" constrains $_ with "Str" if it exists
"Str" is a subtype of "Value"
Reference sub { "DUMMY" } did not pass type constraint "Value"
"Value" is defined as: (defined($_) and not ref($_))
The text was updated successfully, but these errors were encountered:
djerius
changed the title
Optional accepts multiple parameters, only uses the first, but refers to both in error messages
Optional accepts multiple parameters, only uses the first, but refers to all of them in error messages
Jan 26, 2024
More of a footgun then anything else, but if one mistakenly passes two parameters to Optional, the
resultant error message contains both, which can confuse the end user:
The text was updated successfully, but these errors were encountered: