Skip to content

Cascading assignment with "=" causes unclear error and can't convert to "<-" #327

Closed

Description

@aaronrudkin

This is valid R code:

j = k = l = NULL

Running styler's current CRAN version on it will cause it to error:

Error in if (any(pd_flat$spaces < 0L)) { :
missing value where TRUE/FALSE needed

I assume the cascading assignment tricks the parser into thinking one or more of these is a function argument, but I'm not certain.

Activity

  1. lorenzwalthert commented on Jan 23, 2018

    @lorenzwalthert
    Collaborator

    Thanks @aaronrudkin for reaching out. Indeed that's a bug. I think I found the root of the problem and opened #328, which I will merge as soon as all CI checks pass.

  2. lorenzwalthert commented on Jan 23, 2018

    @lorenzwalthert
    Collaborator

    If you want to try yourself now, you can install this patch with

    remotes::install_github("r-lib/styler#328")

    Or once it's merged into master via

    remotes::install_github("r-lib/styler")
  3. lorenzwalthert commented on Jan 23, 2018

    @lorenzwalthert
    Collaborator

    The problem was actually detected in #276 but for some reason I forgot to fix it there before we merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions