mllg / checkmate

Fast and versatile argument checks
https://mllg.github.io/checkmate/
Other
263 stars 30 forks source link

Unexpected result: `checkmate::check_numeric(list(NULL))` #219

Open vincentarelbundock opened 2 years ago

vincentarelbundock commented 2 years ago

Thanks for the great package! Two of my own packages depend on it and I use it all the time.

I am wondering if this behavior is intended:

checkmate::check_numeric(list(NULL))
#> [1] TRUE
checkmate::check_character(list(NULL))
#> [1] TRUE
checkmate::check_formula(list(NULL))
#> [1] "Must be a formula, not list"

It looks like the results are different – and more intuitive – in the devel version on Github.

What output should I expect when I write code that interacts with the output of this test?

Is there a CRAN release planned soon?

Thanks again!

salim-b commented 1 year ago

With checkmate 2.2.0:

checkmate::check_numeric(list(NULL))
#> [1] "Must be of type 'numeric', not 'list'"
checkmate::check_character(list(NULL))
#> [1] "Must be of type 'character', not 'list'"
checkmate::check_formula(list(NULL))
#> [1] "Must be a formula, not list"

Created on 2023-06-29 with reprex v2.0.2

So I guess this has been fixed meanwhile.