Skip to content

all(x)/any(x) error path itself crashes ({.Generic} parsed as cli style) #247

Description

@fabian-s

R/summarize.R:240-243. cli::cli_abort("{.Generic} not defined for {.cls tf} objects.") — cli parses {.Generic} as a (malformed) inline style, not as variable interpolation. Confirmed: all(x) produces Invalid cli literal: '{.Generic}' starts with a dot instead of the intended message.

Reproduce

library(tf)
all(tf_rgp(3))
# Error: Invalid cli literal: '{.Generic}' starts with a dot

Fix

Use parenthesized interpolation: "{(.Generic)} not defined for {.cls tf} objects." (or "{.fn {(.Generic)}} not defined for {.cls tf} objects.").

Regression test

test_that("all()/any() abort with informative message, not cli parse error", {
  x <- tf_rgp(3)
  expect_error(all(x), "not defined")
  expect_error(any(x), "not defined")
  expect_error(prod(x), "not defined")
})

Trivial fix. Found in the June-2026 ground-up review; the broader lesson is that every cli_abort path needs an expect_error(..., regexp = ...) test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions