Skip to content

Negative numbers are not syntactic literals #1799

@moodymudskipper

Description

@moodymudskipper

Since they use -.

We dismiss complex numbers with a real part, presumably because of the +, so it would make sense to return FALSE for negative integer, double, and imaginary numbers.

x <- quote((-1))
y <- substitute((X), list(X = -1))
x
#> (-1)
y
#> (-1)
typeof(x[[2]])
#> [1] "language"
typeof(y[[2]])
#> [1] "double"
rlang::is_expression(x) # correct
#> [1] TRUE
rlang::is_expression(y) # incorrect
#> [1] TRUE

Related: rlang::is_syntactic_literal(NA + 1i) is currently TRUE, to be a syntactic literal a complex number must have a real part of 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    tidy-dev-day 🤓Tidyverse Developer Day rstd.io/tidy-dev-day

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions