
incompatible type error validates `action`
==========================================

> stop_incompatible_type(1, 1, x_arg = "", y_arg = "", action = "conver")
Error: `action` must be one of "combine" or "convert".
Did you mean "convert"?

> stop_incompatible_type(1, 1, x_arg = "", y_arg = "", action = 1)
Error: `action` must be a character vector.


can override arg in OOB conditions
==================================

> with_subscript_data(vec_slice(set_names(letters), "foo"), NULL)
Error: Can't subset elements that don't exist.
x Element `foo` doesn't exist.

> with_subscript_data(vec_slice(set_names(letters), "foo"), "input")
Error: Can't subset elements that don't exist.
x Element `foo` doesn't exist.

> with_subscript_data(vec_slice(set_names(letters), "foo"), quote(input))
Error: Can't subset elements that don't exist.
x Element `foo` doesn't exist.

> with_subscript_data(vec_slice(set_names(letters), "foo"), quote(input[i]))
Error: Can't subset elements that don't exist.
x Element `foo` doesn't exist.


scalar type errors are informative
==================================

> vec_slice(foobar(list(1)), 1)
Error: Input must be a vector, not a `vctrs_foobar` object.

> stop_scalar_type(foobar(list(1)), arg = "foo")
Error: `foo` must be a vector, not a `vctrs_foobar` object.


empty names errors are informative
==================================

> vec_as_names(c("x", "", "y"), repair = "check_unique")
Error: Names can't be empty.
x Empty name found at location 2.

> vec_as_names(c("x", "", "y", ""), repair = "check_unique")
Error: Names can't be empty.
x Empty names found at locations 2 and 4.

> vec_as_names(rep("", 10), repair = "check_unique")
Error: Names can't be empty.
x Empty names found at locations 1, 2, 3, 4, 5, etc.


dot dot names errors are informative
====================================

> vec_as_names(c("..1", "..1", "..1", "...", "z"), repair = "check_unique")
Error: Names can't be of the form `...` or `..j`.
x These names are invalid:
  * "..1" at locations 1, 2, and 3.
  * "..." at location 4.

> vec_as_names(c(rep("..1", 20), rep(c("..2", "..3", "..4", "...", "..5"), 2)),
+ repair = "check_unique")
Error: Names can't be of the form `...` or `..j`.
x These names are invalid:
  * "..1" at locations 1, 2, 3, 4, 5, etc.
  * "..2" at locations 21 and 26.
  * "..3" at locations 22 and 27.
  * "..4" at locations 23 and 28.
  * "..." at locations 24 and 29.
  * ...


unique names errors are informative
===================================

> vec_as_names(c("x", "x", "x", "y", "y", "z"), repair = "check_unique")
Error: Names must be unique.
x These names are duplicated:
  * "x" at locations 1, 2, and 3.
  * "y" at locations 4 and 5.

> vec_as_names(c(rep("x", 20), rep(c("a", "b", "c", "d", "e"), 2)), repair = "check_unique")
Error: Names must be unique.
x These names are duplicated:
  * "x" at locations 1, 2, 3, 4, 5, etc.
  * "a" at locations 21 and 26.
  * "b" at locations 22 and 27.
  * "c" at locations 23 and 28.
  * "d" at locations 24 and 29.
  * ...


lossy cast from character to factor mentions loss of generality
===============================================================

> vec_cast("a", factor("b"))
Error: Can't convert from <character> to <factor<ddf10>> due to loss of generality.
* Locations: 1


ordered cast failures mention conversion
========================================

> vec_cast(ordered("x"), ordered("y"))
Error: Can't convert <ordered<5a425>> to <ordered<df698>>.


incompatible size errors
========================

> stop_incompatible_size(1:2, 3:5, 2L, 3L, x_arg = "", y_arg = "")
Error: Can't recycle input of size 2 to size 3.

> stop_incompatible_size(1:2, 3:5, 2L, 3L, x_arg = quote(foo), y_arg = "")
Error: Can't recycle `foo` (size 2) to size 3.

> stop_incompatible_size(1:2, 3:5, 2L, 3L, x_arg = "", y_arg = "bar")
Error: Can't recycle input of size 2 to match `bar` (size 3).

> stop_incompatible_size(1:2, 3:5, 2L, 3L, x_arg = quote(foo), y_arg = quote(bar))
Error: Can't recycle `foo` (size 2) to match `bar` (size 3).

