fun4 <- function(x, y) vetr(x = stop("BOOM"), y = integer(3L))

Validation expression for argument `x` produced an error (see previous error).

Error: BOOM
Error in vetr(x = stop("BOOM"), y = integer(3L)) : 
  Validation expression for argument `x` produced an error (see previous error).

fun5 <- function(x, y) vetr(x = integer(3L), y = NULL || .(stop("hah")))

For argument `x`, `length(1:2)` should be 3 (is 2)

Error in fun5(x = 1:2, y = NULL) : 
  For argument `x`, `length(1:2)` should be 3 (is 2)

fun6 <- function(x, y) vetr(x = integer(3L), y = NULL && .(stop("hah")))

Validation expression for argument `y` produced an error (see previous error).

Error: hah
Error in vetr(x = integer(3L), y = NULL && .(stop("hah"))) : 
  Validation expression for argument `y` produced an error (see previous error).

fun7 <- function(x, y = z + 2) {
    z <- "boom"
    vetr(x = TRUE, y = 1L)
}

fun7a <- function(x, y = z + 2) {
    z <- 40
    vetr(x = TRUE, y = 1L)
}

Error in z + 2 : non-numeric argument to binary operator
Error in fun7(x = TRUE) : 
  Argument `y` produced error during evaluation; see previous error.

fun8 <- function(x, y = z + 2) {
    a <- b <- TRUE
    vetr(x = TRUE, y = 1L)
}

fun8a <- function(x, y = z + 2) {
    a <- b <- NULL
    vetr(x = TRUE, y = 1L)
}

Error in a && b : invalid 'x' type in 'x && y'
Error in fun8(x = a && b) : 
  Argument `x` produced error during evaluation; see previous error.

fun_make <- function() {
    a <- matrix(1:9, 3)
    tpl <- matrix(numeric(), 3)
    function(x) {
        vetr(tpl)
        TRUE
    }
}

# Make sure we can access defined templates in lexical parents

local({
    NULL
    a <- character()
    fun(a)
})

For argument `x`, `a` should be "matrix" (is "character")

Error in fun(x = a) : 
  For argument `x`, `a` should be "matrix" (is "character")

local({
    b <- character()
    fun(b)
})

For argument `x`, `b` should be "matrix" (is "character")

Error in fun(x = b) : 
  For argument `x`, `b` should be "matrix" (is "character")

fun8b <- function(x) vetr(x = length(.) > 0 && integer())