diff --git a/R/get_source_expressions.R b/R/get_source_expressions.R index 5ebcf3c47..42cfb80e7 100644 --- a/R/get_source_expressions.R +++ b/R/get_source_expressions.R @@ -68,8 +68,7 @@ get_source_expressions <- function(filename, lines = NULL) { } # Only regard explicit attribute terminal_newline=FALSE as FALSE and all other cases (e.g. NULL or TRUE) as TRUE. - # We don't use isFALSE since it is introduced in R 3.5.0. - terminal_newline <- !identical(attr(source_expression$lines, "terminal_newline", exact = TRUE), FALSE) + terminal_newline <- !isFALSE(attr(source_expression$lines, "terminal_newline", exact = TRUE)) e <- NULL source_expression$lines <- extract_r_source( @@ -493,19 +492,6 @@ get_source_expression <- function(source_expression, error = identity) { error = error ) - # TODO: Remove when minimum R version is bumped to > 3.5 - # - # This needs to be done twice to avoid a bug fixed in R 3.4.4 - # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16041 - parsed_content <- tryCatch( - parse( - text = source_expression$content, - srcfile = source_expression, - keep.source = TRUE - ), - error = error - ) - if (inherits(parsed_content, c("error", "lint"))) { assign("e", parsed_content, envir = parent.frame()) parse_error <- TRUE diff --git a/R/namespace.R b/R/namespace.R index 68379381f..a3fba3146 100644 --- a/R/namespace.R +++ b/R/namespace.R @@ -85,13 +85,7 @@ is_s3_generic <- function(fun) { .base_s3_generics <- unique(c( names(.knownS3Generics), - if (getRversion() >= "3.5.0") { - .S3_methods_table[, 1L] - } else { - # R < 3.5.0 doesn't provide .S3_methods_table - # fallback: search baseenv() for generic methods - imported_s3_generics(data.frame(pkg = "base", fun = ls(baseenv()), stringsAsFactors = FALSE))$fun - }, + .S3_methods_table[, 1L], # Contains S3 generic groups, see ?base::groupGeneric and src/library/base/R/zzz.R ls(.GenericArgsEnv) )) diff --git a/tests/testthat/test-unreachable_code_linter.R b/tests/testthat/test-unreachable_code_linter.R index b1f434968..dfd57dffc 100644 --- a/tests/testthat/test-unreachable_code_linter.R +++ b/tests/testthat/test-unreachable_code_linter.R @@ -394,10 +394,10 @@ test_that("unreachable_code_linter ignores terminal nolint end comments", { trim_some(" foo <- function() { do_something - # nolint start: one_linter. + # TestNoLintStart: one_linter. a = 42 next - # nolint end + # TestNoLintEnd } "), NULL,