Skip to contents

Lists the pairs of registered impls of a generic or trait that are each more specific in one dispatched position, with no impl at their meet, the tuple whose impl disambiguates them. A package's tests call it to check that its impls, with those of the packages it uses, leave no call ambiguous.

Usage

r8ambiguities(x)

Arguments

x

A generic of class r8_generic, or a trait object.

Value

A data frame with one row per pair: first and second, the two impls' tuples, meet, the tuple to implement, each written as "(ns::A, ns::B)", and namespaces, the namespaces that declare them. Zero rows when no call is ambiguous.

Examples

op <- options(r8.namespace = "demo")
A <- new_struct("A", fields = list(a = type_double()))
A1 <- new_struct("A1", fields = list(a1 = type_double()), extends = A)
combine <- generic("combine", params(x, y), dispatch = c("x", "y"))
implement(combine, A1, A) <- function(x, y) "A1, A"
implement(combine, A, A1) <- function(x, y) "A, A1"
r8ambiguities(combine)
#>                 first              second                 meet namespaces
#> 1 (demo::A1, demo::A) (demo::A, demo::A1) (demo::A1, demo::A1)       demo
options(op)