From fc23728b9c0fdad3fde200a2b49360ad73d3e61e Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 1 Apr 2023 07:48:47 +0200 Subject: [PATCH] Bump minimum needed R version to `3.6` R 4.3 is scheduled for release on April 21. Follow-up on https://github.com/r-lib/styler/pull/985/ --- DESCRIPTION | 2 +- R/environments.R | 8 +- R/parse.R | 1 - R/relevel.R | 146 +----------------- R/style-guides.R | 4 - man/add_line_col_to_wrapped_expr.Rd | 15 -- man/combine_children.Rd | 4 +- man/find_block_id.Rd | 21 --- man/relocate_eq_assign.Rd | 44 ------ man/relocate_eq_assign_nest.Rd | 33 ---- man/relocate_eq_assign_one.Rd | 17 -- tests/testthat/curly-curly/mixed-in_tree | 107 +++++++++---- .../eq_formals_complex_indention-in_tree | 121 +++++++++++---- tests/testthat/test-transformers-drop.R | 5 +- 14 files changed, 174 insertions(+), 354 deletions(-) delete mode 100644 man/add_line_col_to_wrapped_expr.Rd delete mode 100644 man/find_block_id.Rd delete mode 100644 man/relocate_eq_assign.Rd delete mode 100644 man/relocate_eq_assign_nest.Rd delete mode 100644 man/relocate_eq_assign_one.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 50cf87f17..38f6679f3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,7 +23,7 @@ License: MIT + file LICENSE URL: https://github.com/r-lib/styler, https://styler.r-lib.org BugReports: https://github.com/r-lib/styler/issues Depends: - R (>= 3.5.0) + R (>= 3.6.0) Imports: cli (>= 3.1.1), magrittr (>= 2.0.0), diff --git a/R/environments.R b/R/environments.R index c6b8987e4..83863ce31 100755 --- a/R/environments.R +++ b/R/environments.R @@ -43,13 +43,7 @@ parser_version_get <- function() { #' @rdname parser_version_set parser_version_find <- function(pd) { - ifelse(any(pd$token == "equal_assign"), - 2L, - ifelse(any(pd$token == "expr_or_assign_or_help"), - 3L, - 1L - ) - ) + if (any(pd$token == "equal_assign")) 2L else 3L } diff --git a/R/parse.R b/R/parse.R index 5ac004047..29237bb65 100644 --- a/R/parse.R +++ b/R/parse.R @@ -105,7 +105,6 @@ get_parse_data <- function(text, include_text = TRUE, ...) { pd <- pd %>% add_id_and_short() - parser_version_set(parser_version_find(pd)) pd } diff --git a/R/relevel.R b/R/relevel.R index 8d6a0ebff..e39df04a5 100644 --- a/R/relevel.R +++ b/R/relevel.R @@ -25,11 +25,7 @@ flatten_operators <- function(pd_nested) { #' @keywords internal flatten_operators_one <- function(pd_nested) { pd_token_left <- c(special_token, "PIPE", math_token, "'$'") - pd_token_right <- c( - special_token, "PIPE", "LEFT_ASSIGN", - if (parser_version_get() > 1L) "EQ_ASSIGN", - "'+'", "'-'", "'~'" - ) + pd_token_right <- c(special_token, "PIPE", "LEFT_ASSIGN", "EQ_ASSIGN", "'+'", "'-'", "'~'") pd_nested %>% flatten_pd(pd_token_left, left = TRUE) %>% flatten_pd(pd_token_right, left = FALSE) @@ -106,143 +102,3 @@ wrap_expr_in_expr <- function(pd) { indents = pd$indent[1L] ) } - - -# ____________________________________________________________________________ -# Relocate EQ_ASSIGN #### - -#' Relocate the expressions containing the token `EQ_ASSIGN` within the nested -#' parse table -#' -#' Although syntactically identical, [utils::getParseData()] does not produce -#' the same hierarchy of the parse table (parent and id relationship) for `<-` -#' and `=` (See 'Examples'). -#' This is considered to be a bug and causes problems because the -#' nested parse table constructed with [compute_parse_data_nested()] is not -#' consistent if `EQ_ASSIGN` occurs in the expression to style. In particular, -#' `EQ_ASSIGN` and the tokens to its left and right are located too high up in -#' the hierarchy of the nested parse data. Hence, this function wraps the -#' sub-expression into an expression, similar to [wrap_expr_in_curly()]. -#' Since `wrap_expr_in_curly()` is called from within a visitor -#' (and `relocate_eq_assign()` not), we need to -#' wrap the the implementation [relocate_eq_assign_nest()] that operates on -#' *nests* into a visitor call. -#' @param pd A parse table. -#' @examples -#' styler:::get_parse_data("a <- b <- 3") -#' styler:::get_parse_data("a = b = 3") -#' styler:::get_parse_data( -#' "x = 5 -#' if(x >= 5) -#' y = TRUE else -#' y = FALSE", -#' ) -#' styler:::get_parse_data( -#' "x <- 5 -#' if(x >= 5) -#' y <- TRUE else -#' y <- FALSE", -#' ) -#' @keywords internal -relocate_eq_assign <- function(pd) { - if (parser_version_get() < 2L) { - post_visit_one(pd, relocate_eq_assign_nest) - } else { - pd - } -} - - -#' Relocate all assignment expressions that contain `EQ_ASSIGN` within a *nest* -#' -#' Implements the relocation of an `EQ_ASSIGN` and associated tokens -#' within a *nest* (nested parse table at one level of nesting). -#' Note that one assignment expression (such as "a = b = c") can include -#' multiple assignment operators, an assignment involves just one assignment -#' operator. -#' For the relocation of assignment expressions that contain `EQ_ASSIGN` within -#' a *nest*, we need to first find the expressions that contain `=` and then -#' split the *nest* into parse tables each containing one such assignment -#' expression and then relocate each of them separately. -#' We can't do all of them together because: -#' -#' * An assignment can contain more than just three tokens, e.g. (a <- b <- c). -#' * Two assignments can be in the same nest although they don't belong to the -#' same assignment (if-else statement). -#' -#' Please refer to the section 'Examples' in [relocate_eq_assign()] for details. -#' @param pd A parse table. -#' -#' @keywords internal -relocate_eq_assign_nest <- function(pd) { - idx_eq_assign <- which(pd$token == "EQ_ASSIGN") - if (length(idx_eq_assign) > 0L) { - block_id <- find_block_id(pd) - blocks <- split(pd, block_id) - pd <- map_dfr(blocks, relocate_eq_assign_one) - } - pd -} - -#' Find the block to which a token belongs -#' -#' Two assignment tokens `EQ_ASSIGN` belong to the same block if they are not -#' separated by more than one token. Token between `EQ_ASSIGN` tokens belong -#' to the `EQ_ASSIGN` token occurring before them, except the token right before -#' `EQ_ASSING` already belongs to the `EQ_ASSING` after it. Note that this -#' notion is unrelated to the column *block* in the parse table, which is used -#' to [parse_transform_serialize_r()] code blocks and leave out the ones that -#' are cached. -#' @param pd A parse table. -#' @keywords internal -find_block_id <- function(pd) { - idx_eq_assign <- which(pd$token == "EQ_ASSIGN") - eq_belongs_to_block <- c(0L, diff(idx_eq_assign) > 2L) - - empty_seq <- rep(0L, nrow(pd)) - empty_seq[idx_eq_assign - 1L] <- eq_belongs_to_block - block_id <- cumsum(empty_seq) - block_id -} - -#' Relocate an assignment expression -#' -#' Relocates an assignment expression within a parse table containing one -#' assignment expression. Note that one assignment can include multiple -#' assignment operators such as "a = b = c". -#' @param pd A parse table with one assignment expression to relocate. -#' @keywords internal -relocate_eq_assign_one <- function(pd) { - idx_eq_assign <- which(pd$token == "EQ_ASSIGN") - eq_ind <- seq2(idx_eq_assign[1L] - 1L, last(idx_eq_assign) + 1L) - # initialize because wrap_expr_in_expr -> create_tokens -> requires it - pd$indent <- 0L - eq_expr <- pd[eq_ind, ] %>% - wrap_expr_in_expr() %>% - add_line_col_to_wrapped_expr() %>% - remove_attributes(c( - "multi_line", "indention_ref_pos_id", - "newlines", "indent", "spaces", "lag_newlines" - )) - eq_expr$id <- NA - eq_expr$parent <- NA - pd$indent <- NULL - non_eq_expr <- pd[-eq_ind, ] - pd <- bind_rows(eq_expr, non_eq_expr) %>% - arrange_pos_id() - pd -} - -#' Adds line and col information to an expression from its child -#' -#' @param pd A parse table. - -#' @keywords internal -add_line_col_to_wrapped_expr <- function(pd) { - if (nrow(pd) > 1L) abort("pd must be a wrapped expression that has one row.") - pd$line1 <- pd$child[[1L]]$line1[1L] - pd$line2 <- last(pd$child[[1L]]$line2) - pd$col1 <- pd$child[[1L]]$col1[1L] - pd$col2 <- last(pd$child[[1L]]$col2) - pd -} diff --git a/R/style-guides.R b/R/style-guides.R index 247fd756d..e6a68ae7d 100644 --- a/R/style-guides.R +++ b/R/style-guides.R @@ -237,10 +237,6 @@ tidyverse_style <- function(scope = "tokens", ) ) - if (getRversion() < "3.6") { - transformers_drop$token$force_assignment_op <- NULL - } - style_guide_name <- "styler::tidyverse_style@https://github.com/r-lib" create_style_guide( # transformer functions diff --git a/man/add_line_col_to_wrapped_expr.Rd b/man/add_line_col_to_wrapped_expr.Rd deleted file mode 100644 index dc7b0d333..000000000 --- a/man/add_line_col_to_wrapped_expr.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{add_line_col_to_wrapped_expr} -\alias{add_line_col_to_wrapped_expr} -\title{Adds line and col information to an expression from its child} -\usage{ -add_line_col_to_wrapped_expr(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Adds line and col information to an expression from its child -} -\keyword{internal} diff --git a/man/combine_children.Rd b/man/combine_children.Rd index fef5d4a3a..f587b9aaf 100644 --- a/man/combine_children.Rd +++ b/man/combine_children.Rd @@ -16,8 +16,8 @@ Binds two parse tables together and arranges them so that the tokens are in the correct order. } \details{ -Essentially, this is a wrapper around \code{\link[dplyr:bind]{dplyr::bind_rows()}}, but -returns \code{NULL} if the result of \code{\link[dplyr:bind]{dplyr::bind_rows()}} is a data frame with +Essentially, this is a wrapper around \code{\link[dplyr:bind_rows]{dplyr::bind_rows()}}, but +returns \code{NULL} if the result of \code{\link[dplyr:bind_rows]{dplyr::bind_rows()}} is a data frame with zero rows. } \keyword{internal} diff --git a/man/find_block_id.Rd b/man/find_block_id.Rd deleted file mode 100644 index 2635a8420..000000000 --- a/man/find_block_id.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{find_block_id} -\alias{find_block_id} -\title{Find the block to which a token belongs} -\usage{ -find_block_id(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Two assignment tokens \code{EQ_ASSIGN} belong to the same block if they are not -separated by more than one token. Token between \code{EQ_ASSIGN} tokens belong -to the \code{EQ_ASSIGN} token occurring before them, except the token right before -\code{EQ_ASSING} already belongs to the \code{EQ_ASSING} after it. Note that this -notion is unrelated to the column \emph{block} in the parse table, which is used -to \code{\link[=parse_transform_serialize_r]{parse_transform_serialize_r()}} code blocks and leave out the ones that -are cached. -} -\keyword{internal} diff --git a/man/relocate_eq_assign.Rd b/man/relocate_eq_assign.Rd deleted file mode 100644 index 5faf42e35..000000000 --- a/man/relocate_eq_assign.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{relocate_eq_assign} -\alias{relocate_eq_assign} -\title{Relocate the expressions containing the token \code{EQ_ASSIGN} within the nested -parse table} -\usage{ -relocate_eq_assign(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Although syntactically identical, \code{\link[utils:getParseData]{utils::getParseData()}} does not produce -the same hierarchy of the parse table (parent and id relationship) for \verb{<-} -and \code{=} (See 'Examples'). -This is considered to be a bug and causes problems because the -nested parse table constructed with \code{\link[=compute_parse_data_nested]{compute_parse_data_nested()}} is not -consistent if \code{EQ_ASSIGN} occurs in the expression to style. In particular, -\code{EQ_ASSIGN} and the tokens to its left and right are located too high up in -the hierarchy of the nested parse data. Hence, this function wraps the -sub-expression into an expression, similar to \code{\link[=wrap_expr_in_curly]{wrap_expr_in_curly()}}. -Since \code{wrap_expr_in_curly()} is called from within a visitor -(and \code{relocate_eq_assign()} not), we need to -wrap the the implementation \code{\link[=relocate_eq_assign_nest]{relocate_eq_assign_nest()}} that operates on -\emph{nests} into a visitor call. -} -\examples{ -styler:::get_parse_data("a <- b <- 3") -styler:::get_parse_data("a = b = 3") -styler:::get_parse_data( - "x = 5 - if(x >= 5) - y = TRUE else - y = FALSE", -) -styler:::get_parse_data( - "x <- 5 - if(x >= 5) - y <- TRUE else - y <- FALSE", -) -} -\keyword{internal} diff --git a/man/relocate_eq_assign_nest.Rd b/man/relocate_eq_assign_nest.Rd deleted file mode 100644 index e66177d45..000000000 --- a/man/relocate_eq_assign_nest.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{relocate_eq_assign_nest} -\alias{relocate_eq_assign_nest} -\title{Relocate all assignment expressions that contain \code{EQ_ASSIGN} within a \emph{nest}} -\usage{ -relocate_eq_assign_nest(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Implements the relocation of an \code{EQ_ASSIGN} and associated tokens -within a \emph{nest} (nested parse table at one level of nesting). -Note that one assignment expression (such as "a = b = c") can include -multiple assignment operators, an assignment involves just one assignment -operator. -For the relocation of assignment expressions that contain \code{EQ_ASSIGN} within -a \emph{nest}, we need to first find the expressions that contain \code{=} and then -split the \emph{nest} into parse tables each containing one such assignment -expression and then relocate each of them separately. -We can't do all of them together because: -} -\details{ -\itemize{ -\item An assignment can contain more than just three tokens, e.g. (a <- b <- c). -\item Two assignments can be in the same nest although they don't belong to the -same assignment (if-else statement). -} - -Please refer to the section 'Examples' in \code{\link[=relocate_eq_assign]{relocate_eq_assign()}} for details. -} -\keyword{internal} diff --git a/man/relocate_eq_assign_one.Rd b/man/relocate_eq_assign_one.Rd deleted file mode 100644 index 90318565e..000000000 --- a/man/relocate_eq_assign_one.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{relocate_eq_assign_one} -\alias{relocate_eq_assign_one} -\title{Relocate an assignment expression} -\usage{ -relocate_eq_assign_one(pd) -} -\arguments{ -\item{pd}{A parse table with one assignment expression to relocate.} -} -\description{ -Relocates an assignment expression within a parse table containing one -assignment expression. Note that one assignment can include multiple -assignment operators such as "a = b = c". -} -\keyword{internal} diff --git a/tests/testthat/curly-curly/mixed-in_tree b/tests/testthat/curly-curly/mixed-in_tree index eb0ffc2e6..b7ab6ef5a 100644 --- a/tests/testthat/curly-curly/mixed-in_tree +++ b/tests/testthat/curly-curly/mixed-in_tree @@ -430,37 +430,76 @@ ROOT (token: short_text [lag_newlines/spaces] {pos_id}) ¦ ¦ ¦ °--'}': } [0/0] {414} ¦ ¦ °--'}': } [0/0] {415} ¦ °--')': ) [0/0] {416} - °--expr: call( [2/0] {417} - ¦--expr: call [0/0] {419} - ¦ °--SYMBOL_FUNCTION_CALL: call [0/0] {418} - ¦--'(': ( [0/2] {420} - ¦--expr: {{ x [1/0] {421} - ¦ ¦--'{': { [0/0] {422} - ¦ ¦--expr: { x } [0/0] {423} - ¦ ¦ ¦--'{': { [0/1] {424} - ¦ ¦ ¦--expr: x [0/1] {426} - ¦ ¦ ¦ °--SYMBOL: x [0/0] {425} - ¦ ¦ °--'}': } [0/0] {427} - ¦ °--'}': } [0/0] {428} - ¦--',': , [0/2] {429} - ¦--expr: {{ y} [1/0] {430} - ¦ ¦--expr: {{ y} [0/1] {431} - ¦ ¦ ¦--'{': { [0/0] {432} - ¦ ¦ ¦--expr: { y} [0/0] {433} - ¦ ¦ ¦ ¦--'{': { [0/1] {434} - ¦ ¦ ¦ ¦--expr: y [0/0] {436} - ¦ ¦ ¦ ¦ °--SYMBOL: y [0/0] {435} - ¦ ¦ ¦ °--'}': } [0/0] {437} - ¦ ¦ °--'}': } [0/0] {438} - ¦ ¦--LEFT_ASSIGN: := [0/1] {439} - ¦ °--expr: 3 [0/0] {441} - ¦ °--NUM_CONST: 3 [0/0] {440} - ¦--',': , [0/1] {442} - ¦--expr: f(bk) [0/0] {443} - ¦ ¦--expr: f [0/0] {445} - ¦ ¦ °--SYMBOL_FUNCTION_CALL: f [0/0] {444} - ¦ ¦--'(': ( [0/0] {446} - ¦ ¦--expr: bk [0/0] {448} - ¦ ¦ °--SYMBOL: bk [0/0] {447} - ¦ °--')': ) [0/0] {449} - °--')': ) [1/0] {450} + ¦--expr: call( [2/0] {417} + ¦ ¦--expr: call [0/0] {419} + ¦ ¦ °--SYMBOL_FUNCTION_CALL: call [0/0] {418} + ¦ ¦--'(': ( [0/2] {420} + ¦ ¦--expr: {{ x [1/0] {421} + ¦ ¦ ¦--'{': { [0/0] {422} + ¦ ¦ ¦--expr: { x } [0/0] {423} + ¦ ¦ ¦ ¦--'{': { [0/1] {424} + ¦ ¦ ¦ ¦--expr: x [0/1] {426} + ¦ ¦ ¦ ¦ °--SYMBOL: x [0/0] {425} + ¦ ¦ ¦ °--'}': } [0/0] {427} + ¦ ¦ °--'}': } [0/0] {428} + ¦ ¦--',': , [0/2] {429} + ¦ ¦--expr: {{ y} [1/0] {430} + ¦ ¦ ¦--expr: {{ y} [0/1] {431} + ¦ ¦ ¦ ¦--'{': { [0/0] {432} + ¦ ¦ ¦ ¦--expr: { y} [0/0] {433} + ¦ ¦ ¦ ¦ ¦--'{': { [0/1] {434} + ¦ ¦ ¦ ¦ ¦--expr: y [0/0] {436} + ¦ ¦ ¦ ¦ ¦ °--SYMBOL: y [0/0] {435} + ¦ ¦ ¦ ¦ °--'}': } [0/0] {437} + ¦ ¦ ¦ °--'}': } [0/0] {438} + ¦ ¦ ¦--LEFT_ASSIGN: := [0/1] {439} + ¦ ¦ °--expr: 3 [0/0] {441} + ¦ ¦ °--NUM_CONST: 3 [0/0] {440} + ¦ ¦--',': , [0/1] {442} + ¦ ¦--expr: f(bk) [0/0] {443} + ¦ ¦ ¦--expr: f [0/0] {445} + ¦ ¦ ¦ °--SYMBOL_FUNCTION_CALL: f [0/0] {444} + ¦ ¦ ¦--'(': ( [0/0] {446} + ¦ ¦ ¦--expr: bk [0/0] {448} + ¦ ¦ ¦ °--SYMBOL: bk [0/0] {447} + ¦ ¦ °--')': ) [0/0] {449} + ¦ °--')': ) [1/0] {450} + ¦--expr: call( [2/0] {451} + ¦ ¦--expr: call [0/0] {453} + ¦ ¦ °--SYMBOL_FUNCTION_CALL: call [0/0] {452} + ¦ ¦--'(': ( [0/0] {454} + ¦ ¦--expr: {{ + [0/0] {455} + ¦ ¦ ¦--'{': { [0/0] {456} + ¦ ¦ ¦--expr: { + # [0/0] {457} + ¦ ¦ ¦ ¦--'{': { [0/2] {458} + ¦ ¦ ¦ ¦--COMMENT: # [1/2] {459} + ¦ ¦ ¦ ¦--expr: 1 [1/0] {461} + ¦ ¦ ¦ ¦ °--NUM_CONST: 1 [0/0] {460} + ¦ ¦ ¦ °--'}': } [1/0] {462} + ¦ ¦ °--'}': } [0/0] {463} + ¦ °--')': ) [0/0] {464} + ¦--expr: call( [2/0] {465} + ¦ ¦--expr: call [0/0] {467} + ¦ ¦ °--SYMBOL_FUNCTION_CALL: call [0/0] {466} + ¦ ¦--'(': ( [0/0] {468} + ¦ ¦--expr: {{ + [0/0] {469} + ¦ ¦ ¦--'{': { [0/0] {470} + ¦ ¦ ¦--expr: { + # [0/0] {471} + ¦ ¦ ¦ ¦--'{': { [0/2] {472} + ¦ ¦ ¦ ¦--COMMENT: # [1/0] {473} + ¦ ¦ ¦ °--'}': } [1/0] {474} + ¦ ¦ °--'}': } [0/0] {475} + ¦ °--')': ) [0/0] {476} + °--expr: {{ + [3/0] {477} + ¦--'{': { [0/0] {478} + ¦--expr: { + # [0/0] {479} + ¦ ¦--'{': { [0/2] {480} + ¦ ¦--COMMENT: # [1/0] {481} + ¦ °--'}': } [1/0] {482} + °--'}': } [0/0] {483} diff --git a/tests/testthat/indention_operators/eq_formals_complex_indention-in_tree b/tests/testthat/indention_operators/eq_formals_complex_indention-in_tree index dde5f33df..210e47a12 100644 --- a/tests/testthat/indention_operators/eq_formals_complex_indention-in_tree +++ b/tests/testthat/indention_operators/eq_formals_complex_indention-in_tree @@ -67,31 +67,100 @@ ROOT (token: short_text [lag_newlines/spaces] {pos_id}) ¦ °--expr: {} [0/0] {66} ¦ ¦--'{': { [0/0] {67} ¦ °--'}': } [0/0] {68} - °--expr: funct [2/0] {69} - ¦--FUNCTION: funct [0/0] {70} - ¦--'(': ( [0/0] {71} - ¦--SYMBOL_FORMALS: a [0/1] {72} - ¦--EQ_FORMALS: = [0/11] {73} - ¦--expr: b [1/0] {75} - ¦ °--SYMBOL: b [0/0] {74} - ¦--',': , [0/9] {76} - ¦--SYMBOL_FORMALS: f [1/1] {77} - ¦--EQ_FORMALS: = [0/11] {78} - ¦--expr: d [1/0] {80} - ¦ °--SYMBOL: d [0/0] {79} - ¦--',': , [0/1] {81} - ¦--SYMBOL_FORMALS: c [0/1] {82} - ¦--EQ_FORMALS: = [0/11] {83} - ¦--expr: 3 [1/0] {85} - ¦ °--NUM_CONST: 3 [0/0] {84} - ¦--',': , [0/1] {86} - ¦--SYMBOL_FORMALS: d [0/1] {87} - ¦--EQ_FORMALS: = [0/11] {88} - ¦--expr: 4 [1/0] {90} - ¦ °--NUM_CONST: 4 [0/0] {89} - ¦--')': ) [0/1] {91} - °--expr: { + ¦--expr: funct [2/0] {69} + ¦ ¦--FUNCTION: funct [0/0] {70} + ¦ ¦--'(': ( [0/0] {71} + ¦ ¦--SYMBOL_FORMALS: a [0/1] {72} + ¦ ¦--EQ_FORMALS: = [0/11] {73} + ¦ ¦--expr: b [1/0] {75} + ¦ ¦ °--SYMBOL: b [0/0] {74} + ¦ ¦--',': , [0/9] {76} + ¦ ¦--SYMBOL_FORMALS: f [1/1] {77} + ¦ ¦--EQ_FORMALS: = [0/11] {78} + ¦ ¦--expr: d [1/0] {80} + ¦ ¦ °--SYMBOL: d [0/0] {79} + ¦ ¦--',': , [0/1] {81} + ¦ ¦--SYMBOL_FORMALS: c [0/1] {82} + ¦ ¦--EQ_FORMALS: = [0/11] {83} + ¦ ¦--expr: 3 [1/0] {85} + ¦ ¦ °--NUM_CONST: 3 [0/0] {84} + ¦ ¦--',': , [0/1] {86} + ¦ ¦--SYMBOL_FORMALS: d [0/1] {87} + ¦ ¦--EQ_FORMALS: = [0/11] {88} + ¦ ¦--expr: 4 [1/0] {90} + ¦ ¦ °--NUM_CONST: 4 [0/0] {89} + ¦ ¦--')': ) [0/1] {91} + ¦ °--expr: { } [0/0] {92} - ¦--'{': { [0/0] {93} - °--'}': } [2/0] {94} + ¦ ¦--'{': { [0/0] {93} + ¦ °--'}': } [2/0] {94} + ¦--COMMENT: # cla [3/0] {95} + ¦--expr: funct [1/0] {96} + ¦ ¦--FUNCTION: funct [0/0] {97} + ¦ ¦--'(': ( [0/0] {98} + ¦ ¦--SYMBOL_FORMALS: a [0/1] {99} + ¦ ¦--EQ_FORMALS: = [0/13] {100} + ¦ ¦--expr: 33 [1/0] {102} + ¦ ¦ °--NUM_CONST: 33 [0/0] {101} + ¦ ¦--',': , [0/9] {103} + ¦ ¦--SYMBOL_FORMALS: b [1/0] {104} + ¦ ¦--')': ) [1/1] {105} + ¦ °--expr: {} [0/0] {106} + ¦ ¦--'{': { [0/0] {107} + ¦ °--'}': } [0/0] {108} + ¦--expr: funct [2/0] {109} + ¦ ¦--FUNCTION: funct [0/0] {110} + ¦ ¦--'(': ( [0/0] {111} + ¦ ¦--SYMBOL_FORMALS: a [0/1] {112} + ¦ ¦--EQ_FORMALS: = [0/11] {113} + ¦ ¦--expr: 33 [1/0] {115} + ¦ ¦ °--NUM_CONST: 33 [0/0] {114} + ¦ ¦--',': , [0/12] {116} + ¦ ¦--SYMBOL_FORMALS: b [1/2] {117} + ¦ ¦--')': ) [0/1] {118} + ¦ °--expr: {} [0/0] {119} + ¦ ¦--'{': { [0/0] {120} + ¦ °--'}': } [0/0] {121} + ¦--expr: funct [2/0] {122} + ¦ ¦--FUNCTION: funct [0/0] {123} + ¦ ¦--'(': ( [0/0] {124} + ¦ ¦--SYMBOL_FORMALS: a [0/1] {125} + ¦ ¦--',': , [0/9] {126} + ¦ ¦--SYMBOL_FORMALS: b [1/0] {127} + ¦ ¦--',': , [0/0] {128} + ¦ ¦--SYMBOL_FORMALS: c [1/0] {129} + ¦ ¦--')': ) [1/1] {130} + ¦ °--expr: {} [0/0] {131} + ¦ ¦--'{': { [0/0] {132} + ¦ °--'}': } [0/0] {133} + ¦--expr: funct [2/0] {134} + ¦ ¦--FUNCTION: funct [0/0] {135} + ¦ ¦--'(': ( [0/0] {136} + ¦ ¦--SYMBOL_FORMALS: a [0/0] {137} + ¦ ¦--',': , [0/12] {138} + ¦ ¦--SYMBOL_FORMALS: b [1/0] {139} + ¦ ¦--',': , [0/9] {140} + ¦ ¦--SYMBOL_FORMALS: c [1/0] {141} + ¦ ¦--')': ) [0/1] {142} + ¦ °--expr: {} [0/0] {143} + ¦ ¦--'{': { [0/0] {144} + ¦ °--'}': } [0/0] {145} + °--expr: funct [2/0] {146} + ¦--FUNCTION: funct [0/0] {147} + ¦--'(': ( [0/0] {148} + ¦--SYMBOL_FORMALS: ss [0/0] {149} + ¦--',': , [0/11] {150} + ¦--SYMBOL_FORMALS: a [1/1] {151} + ¦--EQ_FORMALS: = [0/13] {152} + ¦--expr: 3 [1/0] {154} + ¦ °--NUM_CONST: 3 [0/0] {153} + ¦--',': , [0/9] {155} + ¦--SYMBOL_FORMALS: er [1/1] {156} + ¦--EQ_FORMALS: = [0/11] {157} + ¦--expr: 4 [1/0] {159} + ¦ °--NUM_CONST: 4 [0/0] {158} + ¦--')': ) [1/1] {160} + °--expr: {} [0/0] {161} + ¦--'{': { [0/0] {162} + °--'}': } [0/0] {163} diff --git a/tests/testthat/test-transformers-drop.R b/tests/testthat/test-transformers-drop.R index 2691da757..f3d5731fe 100644 --- a/tests/testthat/test-transformers-drop.R +++ b/tests/testthat/test-transformers-drop.R @@ -94,10 +94,7 @@ test_that("tidyverse transformers are correctly dropped", { names_indention <- c("indent_braces", "indent_op", "indent_without_paren") expect_setequal(names(t_fun$indention), names_indention) - names_tokens <- c( - "fix_quotes", - if (getRversion() < "3.6") "force_assignment_op" - ) + names_tokens <- "fix_quotes" expect_setequal(names(t_fun$token), names_tokens) })