mllg / checkmate

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

assert(combine = "and") gives wrong variable name #182

Closed mb706 closed 4 years ago

mb706 commented 4 years ago
> f <- function(a, b) assert(checkFunction(a), checkNumeric(b), combine = "and")
> f(identity, "a")
Error: Assertion on 'a' failed. Must be of type 'numeric', not 'character'.

The expected error message would refer to variable b.

tdeenes commented 4 years ago

@mllg This seems to be indeed a bug: .var.name = as.character(dots[[1L]])[2L] should be .var.name = as.character(dots[[i]])[2L] here

mllg commented 4 years ago

Indeed, thanks for reporting, and thanks for confirming!