R/defer-exit.R
frame_loc typed any: envir no call in domain
((envir: any, frames: <@"[[", ...>) -> (DBL | INT)<difftime> | DBL1<~@"+", ...> | LGL<> | dbl<Date, ...> | <POSIXt, ...>)<>
timing: 0.579 s
fuzzing: 0 inside (none) · 0 outside (none)
source
frame_loc <- function(envir, frames) {
n <- length(frames)
if (!n) {
return(0)
}
for (i in seq_along(frames)) {
if (identical(frames[[n - i + 1]], envir)) {
return(n - i + 1)
}
}
0
}
R/defer-exit.R:63
knitr_exit_frame untypeable
untypeable application (line 5)
error detail
function: (envir: any, frames: <@"[[", ...>) --> (DBL | INT)<difftime> | DBL1<~@"+", ...> | LGL<> | dbl<Date, ...> | <POSIXt, ...>
argument: @('envir, list<>)
argument (not in the domain) may be: (new.env(), list())timing: 0.063 s
source
knitr_exit_frame <- function(envir) {
frames <- as.list(sys.frames())
frame_loc <- frame_loc(envir, frames)
if (!frame_loc) {
return(envir)
}
knitr_ns <- asNamespace("knitr")
# This doesn't handle correctly the recursive case (knitr called
# within a chunk). Handling this would be a little fiddly for an
# uncommon edge case.
for (i in seq(1, frame_loc)) {
if (identical(topenv(frames[[i]]), knitr_ns)) {
return(frames[[i]])
}
}
NULL
}
R/defer-exit.R:2
source_exit_frame_option untypeable
unbound variable (line 31)
unbound: sys.calls — a name the prelude does not declare
error detail
name: sys.calls
timing: 0.163 s
source
source_exit_frame_option <- function(envir, frames = as.list(sys.frames())) {
calls <- as.list(sys.calls())
i <- frame_loc(envir, frames)
if (!i) {
return(NULL)
}
if (i < 4) {
return(NULL)
}
is_call <- function(x, fn) {
is.call(x) && identical(x[[1]], fn)
}
calls <- as.list(calls)
if (!is_call(calls[[i - 3]], quote(source))) {
return(NULL)
}
if (!is_call(calls[[i - 2]], quote(withVisible))) {
return(NULL)
}
if (!is_call(calls[[i - 1]], quote(eval))) {
return(NULL)
}
if (!is_call(calls[[i - 0]], quote(eval))) {
return(NULL)
}
frames[[i - 3]]
}
R/defer-exit.R:30
source_exit_frame untypeabletyped
unbound variable (line 25)
unbound: source_exit_frame_option — one of the package’s own names, itself untyped
error detail
name: source_exit_frame_option
gradual mode: typed
((envir: any) -> any)<>
timing: 0.003 s
source
source_exit_frame <- function(envir) {
source_exit_frame_option(envir) %||% envir
}
R/defer-exit.R:24
knitr_in_progress typed fuzz ok
(() -> ff<>)<>
timing: 0.013 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
knitr_in_progress <- function() {
isTRUE(getOption("knitr.in.progress"))
}
R/defer-exit.R:81
in_knitr typed any: envir accepts outside
((envir: any) -> ff<>)<>
timing: 0.016 s
fuzzing: 7 inside (7 ok) · 8 outside (7 rejected, 1 accepted)
Accepted outside the domain envir: 1
| parameter | change | call | returned |
|---|
| envir | drop | in_knitr() | ff<> with { } |
source
in_knitr <- function(envir) {
knitr_in_progress() && identical(knitr::knit_global(), envir)
}
R/defer-exit.R:78
R/utils.R
make_call untypeabletyped
unbound variable (line 2)
unbound: as.call — a name the prelude does not declare
error detail
name: as.call
gradual mode: typed
((...: any) -> any)<>
timing: 0.009 s
source
make_call <- function(...) {
as.call(list(...))
}
R/utils.R:1
vlapply skipped
error detail
Failure("Unsupported argument after an ellipsis.")timing: 0.000 s
source
vlapply <- function(X, FUN, ..., FUN.VALUE = logical(1)) {
vapply(X, FUN, ..., FUN.VALUE = FUN.VALUE)
}
R/utils.R:5
names2 typed any: x fuzz ok
((x: any) -> CHR)<>
timing: 0.053 s
fuzzing: 8 inside (8 ok) · 2 outside (2 rejected)
source
names2 <- function(x) {
nms <- names(x)
if (is.null(nms)) {
rep("", length(x))
} else {
nms[is.na(nms)] <- ""
nms
}
}
R/utils.R:9
makevars_user untypeabletyped
unbound variable (line 23)
unbound: getRversion — a name the prelude does not declare
error detail
name: getRversion
gradual mode: typed
(() -> any)<>
timing: 0.182 s
source
makevars_user <- function() {
if (getRversion() >= "3.3") {
return(tools::makevars_user())
}
# Below is tools::makevars_user() from R 3.6.2
m <- character()
if (.Platform$OS.type == "windows") {
if (!is.na(f <- Sys.getenv("R_MAKEVARS_USER", NA_character_))) {
if (file.exists(f)) {
m <- f
}
} else if (
(Sys.getenv("R_ARCH") == "/x64") &&
file.exists(f <- path.expand("~/.R/Makevars.win64"))
) {
m <- f
} else if (file.exists(f <- path.expand("~/.R/Makevars.win"))) {
m <- f
} else if (file.exists(f <- path.expand("~/.R/Makevars"))) {
m <- f
}
} else {
if (!is.na(f <- Sys.getenv("R_MAKEVARS_USER", NA_character_))) {
if (file.exists(f)) {
m <- f
}
} else if (
file.exists(
f <- path.expand(paste0("~/.R/Makevars-", Sys.getenv("R_PLATFORM")))
)
) {
m <- f
} else if (file.exists(f <- path.expand("~/.R/Makevars"))) {
m <- f
}
}
m
}
R/utils.R:22
as_character typed accepts outside
(((x: vec | null) -> CHR<>)&((x: vec1) -> CHR1<>))<>
timing: 0.054 s
fuzzing: 8 inside (8 ok) · 7 outside (3 rejected, 4 accepted)
Accepted outside the domain x: 4
| parameter | change | call | returned |
|---|
| x | kind:list | as_character("x" = list()) | (CHR & ~vec1)<> with { } |
| x | wrap | as_character(list(NA_complex_)) | "NA"<> with { } |
| x | wrap | as_character(list(as.raw(c(255)))) | "as.raw(0xff)"<> with { } |
| x | wrap | as_character("x" = list(TRUE)) | "TRUE"<> with { } |
source
as_character <- function(x) {
nms <- names(x)
res <- as.character(x)
names(res) <- nms
res
}
R/utils.R:61
list_combine untypeable
untypeable application (line 69)
error detail
function: (v('I916) --> v1('I916)) & ({ 'I917 } --> 'I917)
argument: CHR<> | null
argument (not in the domain) may be: NULLtiming: 0.028 s
source
list_combine <- function(rhs, lhs) {
for (nme in names(lhs)) {
rhs[nme] <- lhs[nme]
}
rhs
}
R/utils.R:68
auto_splice typed accepts outside
∀'a,'b,'c. (((x: 'a & <@"[[", ...>) -> any) & ((x: 'a & v('c)<~@"[[", ...>) -> v1('c)<> | v('c)<~@"[[", ...> & 'a) & ((x: 'a & { }<~@"[[", ...>) -> { }<~@"[[", ...> & 'a) & ((x: 'a & { 'b }<~@"[[", ...>) -> 'b | { 'b }<~@"[[", ...> & 'a) & ((x: 'a & { 'b & list }<~@"[[", ...>) -> 'b | { 'b & list }<~@"[[", ...> & 'a))<>
timing: 0.928 s
fuzzing: 16 inside (16 ok) · 8 outside (7 rejected, 1 accepted)
type drawn from: (((x: 'x & <@"[[", ...>) -> any) & ((x: 'x & v('I1034)<~@"[[", ...>) -> v1('I1034)<> | v('I1034)<~@"[[", ...> & 'x) & ((x: 'x & { }<~@"[[", ...>) -> { }<~@"[[", ...> & 'x) & ((x: 'x & { 'I997 }<~@"[[", ...>) -> 'I997 | { 'I997 }<~@"[[", ...> & 'x) & ((x: 'x & { 'I997 & list }<~@"[[", ...>) -> 'I997 | { 'I997 & list }<~@"[[", ...> & 'x))<>
Accepted outside the domain x: 1
| parameter | change | call | returned |
|---|
| x | kind:null | auto_splice(NULL) | null |
source
auto_splice <- function(x) {
if (length(x) == 1 && is.null(names(x)) && is.list(x[[1]])) {
x[[1]]
} else {
x
}
}
R/utils.R:76
setNames typed unsound
∀'a. ((x: 'a?, nm: 'a & (vec | null)) -> 'a)<>
timing: 0.035 s
fuzzing: 20 inside (1 ok, 14 unsound, 5 error type) · 8 outside (6 rejected, 2 accepted)
type drawn from: ((x: 'nm?, nm: 'nm & (vec | null)) -> 'nm)<>
Counterexamples
| call | predicted | returned |
|---|
| setNames(c(FALSE, FALSE), FALSE) | LGL<> with { } | (LGL & ~vec1)<> with { names: (CHR & ~vec1)<> with { } } |
| setNames(integer(0), integer(0)) | INT<> with { } | (INT & ~vec1)<> with { names: (CHR & ~vec1)<> with { } } |
| setNames("x" = c(NA_real_, 1000000, Inf, 0, 0.5), "nm" = c(-2147483647, Inf, -2.5, NA_real_, 1)) | DBL<> with { } | (DBL & ~vec1)<> with { names: (CHR & ~vec1)<> with { } } |
| setNames("x" = c("a", "x y", "é", NA_character_, ""), "nm" = "x y") | CHR<> with { } | (CHR & ~vec1)<> with { names: (CHR & ~vec1)<> with { } } |
| setNames(as.raw(c(255, 255)), "nm" = as.raw(c(255))) | raw<> with { } | (raw & ~vec1)<> with { names: (CHR & ~vec1)<> with { } } |
| setNames("x" = 2, "nm" = 1) | ^DBL1<> with { } | 2.<> with { names: "1"<> with { } } |
and 8 more
Accepted outside the domain nm: 2
| parameter | change | call | returned |
|---|
| nm | wrap | setNames("x" = c(NA_real_, 1000000, Inf, 0, 0.5), "nm" = list(c(-2147483647, Inf, -2.5, NA_real_, 1))) | (DBL & ~vec1)<> with { names: (CHR & ~vec1)<> with { } } |
| nm | wrap | setNames("x" = 2, "nm" = list(1)) | 2.<> with { names: "1"<> with { } } |
Other calls inside the domain
| call | verdict | error |
|---|
| setNames(complex(0), "nm" = c(complex(real = 1, imaginary = -2), complex(real = 0, imaginary = 0), complex(real = 0, imaginary = 0), complex(real = 1, imaginary = -2), complex(real = 0, imaginary = 0))) | error_type | base::<-: 'names' attribute [5] must be the same length as the vector [0] |
| setNames(logical(0), "nm" = c(NA, NA, NA, NA, TRUE)) | error_type | base::<-: 'names' attribute [5] must be the same length as the vector [0] |
| setNames(structure(-2147483647L, "levels" = c("a", "a"), class = "factor"), structure(c(0L, 42L, NA_integer_, 2147483647L, 2L), "levels" = "", class = "factor")) | error_type | base::as.character.factor: malformed factor |
| setNames("x" = character(0), "nm" = c("é", "")) | error_type | base::<-: 'names' attribute [2] must be the same length as the vector [0] |
| setNames(numeric(0), "nm" = 2) | error_type | base::<-: 'names' attribute [1] must be the same length as the vector [0] |
source
setNames <- function(x = nm, nm) {
names(x) <- nm
x
}
R/utils.R:84
is_interactive typed fuzz ok
(() -> LGL1<>)<>
timing: 0.054 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
is_interactive <- function() {
opt <- getOption("rlang_interactive")
if (!is.null(opt)) {
return(opt)
}
if (knitr_in_progress()) {
return(FALSE)
}
if (identical(Sys.getenv("TESTTHAT"), "true")) {
return(FALSE)
}
interactive()
}
R/utils.R:90
%||% typed accepts outside
∀'a,'b. (((x: 'b & null, y: 'a) -> 'a)&((x: 'b \ null, y: 'a) -> 'b \ null))<>
timing: 0.043 s
fuzzing: 20 inside (20 ok) · 8 outside (5 rejected, 3 accepted)
type drawn from: (((x: 'x & null, y: 'y) -> 'y) & ((x: 'x \ null, y: 'y) -> 'x \ null))<>
Accepted outside the domain x: 2, y: 1
| parameter | change | call | returned |
|---|
| x | drop | %||%(as.raw(c(0, 255, 255, 255, 255))) | (raw & ~vec1)<> with { } |
| x | drop | %||%(as.raw(c(0, 0, 0, 255, 0))) | (raw & ~vec1)<> with { } |
| y | drop | %||%(NA_integer_) | (INT1 \ ^INT1)<> with { } |
source
`%||%` <- function(x, y) {
if (is.null(x)) y else x
}
R/utils.R:104
R/env.R
as_envvars untypeabletyped
unbound variable (line 48)
unbound: vlapply — one of the package’s own names, itself untyped
error detail
name: vlapply
gradual mode: typed
((envs: any) -> any)<>
timing: 0.042 s
source
as_envvars <- function(envs) {
if (length(envs) == 0) {
return(envs)
}
stopifnot(is.named(envs))
# if any envs are null make them NA instead
envs[vlapply(envs, is.null)] <- NA
# if there are duplicated entries keep only the last one
envs <- envs[!duplicated(names(envs), fromLast = TRUE)]
envs
}
R/env.R:40
get_envvar untypeable
unbound variable (line 4)
unbound: as_envvars — one of the package’s own names, itself untyped
error detail
name: as_envvars
timing: 0.008 s
source
get_envvar <- function(envs, action = "replace") {
envs <- as_envvars(envs)
Sys.getenv(names(envs), names = TRUE, unset = NA)
}
R/env.R:3
set_envvar skipped
error detail
File "Rsem/lang/PAst.ml", line 210, characters 14-20: Assertion failed
timing: 0.000 s
source
set_envvar <- function(envs, action = "replace") {
envs <- as_envvars(envs)
stopifnot(is.character(action), length(action) == 1)
action <- match.arg(action, c("replace", "prefix", "suffix"))
if (length(envs) == 0) {
return()
}
old <- Sys.getenv(names(envs), names = TRUE, unset = NA)
set <- !is.na(envs)
both_set <- set & !is.na(old)
if (any(both_set)) {
if (action == "prefix") {
envs[both_set] <- paste(envs[both_set], old[both_set])
} else if (action == "suffix") {
envs[both_set] <- paste(old[both_set], envs[both_set])
}
}
if (any(set)) {
do.call("Sys.setenv", as.list(envs[set]))
}
if (any(!set)) {
Sys.unsetenv(names(envs)[!set])
}
invisible(old)
}
R/env.R:8
with_envvar untypeabletyped
unbound variable (line 77)
unbound: set_envvar — one of the package’s own names, itself untyped
error detail
name: set_envvar
gradual mode: typed
any
timing: 0.000 s
source
with_envvar <- with_(set_envvar, get = get_envvar)
R/env.R:77
local_envvar untypeabletyped
unbound variable (line 81)
unbound: set_envvar — one of the package’s own names, itself untyped
error detail
name: set_envvar
gradual mode: typed
any
timing: 0.000 s
source
local_envvar <- local_(set_envvar, get = get_envvar, dots = TRUE)
R/env.R:81
R/locale.R
as_locale_cats typed fuzz ok
(((cats: vec | null) -> CHR<>)&((cats: vec1) -> CHR1<>))<>
timing: 0.069 s
fuzzing: 7 inside (7 error pkg) · 8 outside (8 rejected)
Other calls inside the domain
| call | verdict | error |
|---|
| as_locale_cats(NULL) | error_pkg | withr::as_locale_cats: is.named(cats) is not TRUE |
| as_locale_cats("cats" = as.raw(c(255))) | error_pkg | withr::as_locale_cats: is.named(cats) is not TRUE |
| as_locale_cats("cats" = 1L) | error_pkg | withr::as_locale_cats: is.named(cats) is not TRUE |
| as_locale_cats("cats" = complex(real = 0, imaginary = 0)) | error_pkg | withr::as_locale_cats: is.named(cats) is not TRUE |
| as_locale_cats("cats" = complex(real = 1, imaginary = -2)) | error_pkg | withr::as_locale_cats: is.named(cats) is not TRUE |
| as_locale_cats("cats" = c(42L, -1L)) | error_pkg | withr::as_locale_cats: is.named(cats) is not TRUE |
and 1 more
source
as_locale_cats <- function(cats) {
cats <- as_character(cats)
stopifnot(is.named(cats))
if ("LC_ALL" %in% names(cats)) {
stop("Setting LC_ALL category not implemented.", call. = FALSE)
}
cats
}
R/locale.R:73
get_locale untypeable
untypeable application of base::vapply (line 69)
error detail
argument: @(CHR<> | null, (category: vec1?) -> CHR1<>, CHR1<>)
failing call: base::vapply(NA_character_, function(...) NULL, NA_character_)
timing: 0.146 s
source
get_locale <- function(cats) {
vapply(names(cats), Sys.getlocale, character(1))
}
R/locale.R:69
set_locale untypeabletyped
unbound variable (line 67)
unbound: mapply — a name the prelude does not declare
error detail
name: mapply
gradual mode: typed
((cats: any) -> any)<>
timing: 0.015 s
source
set_locale <- function(cats) {
mapply(Sys.setlocale, names(cats), cats)
}
R/locale.R:66
local_locale untypeable
unbound variable (line 46)
unbound: list_combine — one of the package’s own names, itself untyped
error detail
name: list_combine
timing: 0.065 s
source
local_locale <- function(.new = list(), ..., .local_envir = parent.frame()) {
new <- list_combine(as.list(.new), list(...))
cats <- as_locale_cats(new)
# <https://github.com/r-lib/withr/issues/179>
# R supports setting LC_COLLATE to C via envvar. When that is the
# case, it takes precedence over the currently set locale. We need
# to set both the envvar and the locale for collate to fully take
# effect.
if ("LC_COLLATE" %in% names(cats)) {
collate <- cats["LC_COLLATE"]
local_envvar(collate, .local_envir = .local_envir)
}
old <- get_locale(cats)
defer(set_locale(old), envir = .local_envir)
set_locale(cats)
invisible(old)
}
R/locale.R:45
with_locale untypeabletyped
unbound variable (line 39)
unbound: local_locale — one of the package’s own names, itself untyped
error detail
name: local_locale
gradual mode: typed
∀'a. ((new: any, code: 'a) -> 'a)<>
timing: 0.003 s
source
with_locale <- function(new, code) {
local_locale(new)
code
}
R/locale.R:38
R/options.R
get_options typed any: new_options fuzz ok
((new_options: any) -> any)<>
timing: 0.020 s
fuzzing: 6 inside (6 ok) · 7 outside (7 rejected)
source
get_options <- function(new_options) {
do.call(options, as.list(names(new_options)))
}
R/options.R:5
set_options typed any: new_options fuzz ok
((new_options: any) -> any)<>
timing: 0.045 s
fuzzing: 7 inside (4 ok, 1 error pkg, 2 error type) · 8 outside (8 rejected)
Other calls inside the domain
| call | verdict | error |
|---|
| set_options("new_options" = as.name("x")) | error_pkg | withr::set_options: object 'x' not found |
| set_options(function(...) list(as.name("x"))) | error_type | base::function (...) .Internal(options(...)): argument is missing, with no default |
| set_options("new_options" = local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p })) | error_type | ::as.vector: cannot coerce type 'externalptr' to vector of type 'list' |
source
set_options <- function(new_options) {
do.call(options, as.list(new_options))
}
R/options.R:8
reset_options typed any: old_options fuzz ok
((old_options: any) -> list<>)<>
timing: 0.008 s
fuzzing: 6 inside (1 ok, 5 error type) · 7 outside (7 rejected)
Other calls inside the domain
| call | verdict | error |
|---|
| reset_options(function(...) as.name("x")) | error_type | base::options: invalid argument |
| reset_options(function(...) NULL) | error_type | base::options: invalid argument |
| reset_options(function(...) quote(f(x))) | error_type | base::options: invalid argument |
| reset_options(new.env()) | error_type | base::options: invalid argument |
| reset_options("old_options" = as.name("x")) | error_type | base::options: invalid argument |
source
reset_options <- function(old_options) {
options(old_options)
}
R/options.R:11
with_options untypeabletyped
unbound variable (line 52)
unbound: with_ — one of the package’s own names, itself untyped
error detail
name: with_
gradual mode: typed
any
timing: 0.002 s
source
with_options <- with_(
set_options,
reset_options
)
R/options.R:52
local_options untypeabletyped
unbound variable (line 59)
unbound: local_ — one of the package’s own names, itself untyped
error detail
name: local_
gradual mode: typed
any
timing: 0.001 s
source
local_options <- local_(
set_options,
reset_options,
get = get_options,
dots = TRUE
)
R/options.R:59
R/defer.R
<statement> typed
timing: 0.000 s
source
NULL
R/defer.R:3
knitr_handlers typed accepts outside
∀'a. (((envir: any with { withr_knitr_handlers: 'a \ null, any }) -> 'a \ null)&((envir: any with { withr_knitr_handlers: 'a, any }) -> { }<> | 'a \ null))<>
timing: 0.074 s
fuzzing: 20 inside (20 ok) · 8 outside (3 rejected, 5 accepted)
type drawn from: (((envir: any with { withr_knitr_handlers: 'I1422 \ null, any }) -> 'I1422 \ null) & ((envir: any with { withr_knitr_handlers: 'I1422, any }) -> { }<> | 'I1422 \ null))<>
Accepted outside the domain envir: 5
| parameter | change | call | returned |
|---|
| envir | attr:drop:withr_knitr_handlers | knitr_handlers(quote(f(x))) | { }<> with { } |
| envir | kind:chr | knitr_handlers("envir" = "fuzz") | { }<> with { } |
| envir | kind:null | knitr_handlers(NULL) | { }<> with { } |
| envir | kind:sym | knitr_handlers("envir" = as.name("x")) | { }<> with { } |
| envir | wrap | knitr_handlers("envir" = list(structure(local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), "withr_knitr_handlers" = 2147483647))) | { }<> with { } |
source
knitr_handlers <- function(envir) {
attr(envir, "withr_knitr_handlers") %||% list()
}
R/defer.R:272
defer_knitr_run skipped
error detail
Failure("Unsupported positional argument after a named one.")timing: 0.000 s
source
defer_knitr_run <- function(
envir,
handlers = knitr_handlers(envir)
) {
defer(envir = envir, {
for (expr in handlers) {
eval(expr, envir)
}
})
}
R/defer.R:277
defer_knitr untypeabletyped
unbound variable (line 252)
unbound: knitr_exit_frame — one of the package’s own names, itself untyped
error detail
name: knitr_exit_frame
gradual mode: typed
((expr: any, envir: any, priority: (vec | null)?) -> null)<>
timing: 0.110 s
source
defer_knitr <- function(expr, envir, priority = c("first", "last")) {
priority <- match.arg(priority, choices = c("first", "last"))
envir <- knitr_exit_frame(envir)
handler <- as.call(list(function() expr))
handlers <- knitr_handlers(envir)
# Add `on.exit` hook if run for first time
if (!length(handlers)) {
defer_knitr_run(envir)
}
if (priority == "first") {
handlers <- c(list(handler), handlers)
} else {
handlers <- c(handlers, list(handler))
}
attr(envir, "withr_knitr_handlers") <- handlers
invisible(NULL)
}
R/defer.R:249
frame_clear_exits untypeabletyped
unbound variable (line 176)
unbound: on.exit — a name the prelude does not declare
error detail
name: on.exit
gradual mode: typed
((frame: any?) -> any)<>
timing: 0.003 s
source
frame_clear_exits <- function(frame = parent.frame()) {
do.call(on.exit, list(), envir = frame)
}
R/defer.R:175
is_top_level_global_env untypeable
untypeable application of base::vapply (line 240)
error detail
argument: @({ env }<> | null | 'frames, (x: any, y: any, ...: any) -> LGL1<>, (LGL1 & ~^LGL1)<>, env)
failing call: base::vapply(list(), function(...) NULL, NA, new.env())timing: 0.115 s
source
is_top_level_global_env <- function(envir, frames = sys.frames()) {
if (!identical(envir, globalenv())) {
return(FALSE)
}
# Check if another global environment is on the stack
!any(vapply(frames, identical, NA, globalenv()))
}
R/defer.R:234
deferred_clear skipped
error detail
Invalid_argument("Cannot assign to an immutable variable.")timing: 0.001 s
source
deferred_clear <- function(envir = parent.frame()) {
if (is_top_level_global_env(envir)) {
the$global_exits <- list()
} else {
frame_clear_exits(envir)
}
invisible()
}
R/defer.R:181
frame_exits untypeabletyped
unbound variable (line 161)
unbound: sys.on.exit — a name the prelude does not declare
error detail
name: sys.on.exit
gradual mode: typed
((frame: any?) -> any)<>
timing: 0.016 s
source
frame_exits <- function(frame = parent.frame()) {
exits <- do.call(sys.on.exit, list(), envir = frame)
# The exit expressions are stored in a single object that is
# evaluated on exit. This can be NULL, an expression, or multiple
# expressions wrapped in {. We convert this data structure to a list
# of expressions.
if (is.null(exits)) {
list()
} else if (identical(exits[[1]], quote(`{`))) {
as.list(exits[-1])
} else {
list(exits)
}
}
R/defer.R:160
deferred_run untypeable
unbound variable (line 134)
unbound: is_top_level_global_env — one of the package’s own names, itself untyped
error detail
name: is_top_level_global_env
timing: 0.056 s
source
deferred_run <- function(envir = parent.frame()) {
if (knitr_in_progress() && identical(envir, knitr::knit_global())) {
# The handlers are thunks so we don't need to clear them.
# They will only be run once.
frame <- knitr_exit_frame(envir)
handlers <- knitr_handlers(frame)
} else {
if (is_top_level_global_env(envir)) {
handlers <- the$global_exits
} else {
handlers <- frame_exits(envir)
}
deferred_clear(envir)
}
n <- length(handlers)
i <- 0L
if (!n) {
message("No deferred expressions to run")
return(invisible(NULL))
}
defer(message(
sprintf("Ran %s/%s deferred expressions", i, n)
))
for (expr in handlers) {
eval(expr, envir)
i <- i + 1L
}
}
R/defer.R:127
global_defer skipped
error detail
Invalid_argument("Cannot assign to an immutable variable.")timing: 0.017 s
source
global_defer <- function(expr, priority = c("first", "last")) {
priority <- match.arg(priority, choices = c("first", "last"))
env <- globalenv()
handlers <- the$global_exits
if (!length(handlers)) {
# For session scopes we use reg.finalizer()
if (is_interactive()) {
message(
sprintf("Setting global deferred event(s).\n"),
"i These will be run:\n",
" * Automatically, when the R session ends.\n",
" * On demand, if you call `withr::deferred_run()`.\n",
"i Use `withr::deferred_clear()` to clear them without executing."
)
}
reg.finalizer(env, function(env) deferred_run(env), onexit = TRUE)
}
handler <- as.call(list(function() expr))
if (priority == "first") {
the$global_exits <- c(list(handler), handlers)
} else {
the$global_exits <- c(handlers, list(handler))
}
invisible(NULL)
}
R/defer.R:199
defer untypeable
unbound variable (line 77)
unbound: source_exit_frame_option — one of the package’s own names, itself untyped
error detail
name: source_exit_frame_option
timing: 0.216 s
source
defer <- function(expr, envir = parent.frame(), priority = c("first", "last")) {
if (identical(envir, globalenv())) {
source_frame <- source_exit_frame_option(envir)
if (!is.null(source_frame)) {
# Automatically enable `source()` special-casing for the global
# environment. This is the default for `source()` and the normal
# case when users run scripts. This also happens in R CMD check
# when withr is used inside an example because an R example is
# run inside `withAutoprint()` which uses `source()`.
local_options(withr.hook_source = TRUE)
# And fallthrough to the default `defer()` handling. Within
# `source()` we don't require manual calling of
# `deferred_run()`.
} else if (is_top_level_global_env(envir)) {
global_defer(expr, priority = priority)
return(invisible(NULL))
}
}
priority <- match.arg(priority, choices = c("first", "last"))
if (knitr_in_progress() && identical(envir, knitr::knit_global())) {
return(defer_knitr(expr, envir, priority = priority))
}
# Don't handle `source()` by default to avoid a performance hit
if (!is.null(getOption("withr.hook_source"))) {
envir <- source_exit_frame(envir)
}
thunk <- as.call(list(function() expr))
after <- priority == "last"
do.call(
base::on.exit,
list(thunk, TRUE, after),
envir = envir
)
}
R/defer.R:75
<statement> typed
timing: 0.003 s
source
formals(defer)[["priority"]] <- eval(formals(defer)[["priority"]])
R/defer.R:116
defer_parent untypeable
unbound variable (line 122)
unbound: defer — one of the package’s own names, itself untyped
error detail
name: defer
timing: 0.024 s
source
defer_parent <- function(expr, priority = c("first", "last")) {
defer(expr, parent.frame(2), priority = priority)
}
R/defer.R:121
<statement> typed
timing: 0.013 s
source
the$global_exits <- list()
R/defer.R:230
R/devices.R
<statement> typed
timing: 0.000 s
source
NULL
R/devices.R:34
dev_close untypeabletyped
unbound variable (line 186)
unbound: grDevices::dev.prev — a name the prelude does not declare
error detail
name: grDevices::dev.prev
gradual mode: typed
((which: any) -> any)<>
timing: 0.004 s
source
dev_close <- function(which) {
prev <- grDevices::dev.prev(which)
grDevices::dev.off(which)
# No devices active
if (prev != which) {
grDevices::dev.set(prev)
}
prev
}
R/devices.R:185
defer_dev_close untypeable
unbound variable (line 177)
unbound: grDevices::dev.cur — a name the prelude does not declare
error detail
name: grDevices::dev.cur
timing: 0.002 s
source
defer_dev_close <- function(frame) {
cur <- grDevices::dev.cur()
defer(dev_close(cur), envir = frame)
# Note that unlike typical `local_` functions we return the current device
# rather than the old one
invisible(cur)
}
R/devices.R:176
local_bmp untypeabletyped
unbound variable (line 46)
unbound: grDevices::bmp — a name the prelude does not declare
error detail
name: grDevices::bmp
gradual mode: typed
((new: any, ...: any, .local_envir: any?) -> any)<>
timing: 0.008 s
source
local_bmp <- function(new, ..., .local_envir = parent.frame()) {
grDevices::bmp(new, ...)
defer_dev_close(.local_envir)
}
R/devices.R:45
with_bmp untypeabletyped
unbound variable (line 39)
unbound: local_bmp — one of the package’s own names, itself untyped
error detail
name: local_bmp
gradual mode: typed
∀'a. ((new: any, code: 'a, ...: any) -> 'a)<>
timing: 0.008 s
source
with_bmp <- function(new, code, ...) {
local_bmp(new, ...)
code
}
R/devices.R:38
local_cairo_pdf untypeabletyped
unbound variable (line 60)
unbound: grDevices::cairo_pdf — a name the prelude does not declare
error detail
name: grDevices::cairo_pdf
gradual mode: typed
((new: any, ...: any, .local_envir: any?) -> any)<>
timing: 0.008 s
source
local_cairo_pdf <- function(new, ..., .local_envir = parent.frame()) {
grDevices::cairo_pdf(new, ...)
defer_dev_close(.local_envir)
}
R/devices.R:59
with_cairo_pdf untypeabletyped
unbound variable (line 53)
unbound: local_cairo_pdf — one of the package’s own names, itself untyped
error detail
name: local_cairo_pdf
gradual mode: typed
∀'a. ((new: any, code: 'a, ...: any) -> 'a)<>
timing: 0.007 s
source
with_cairo_pdf <- function(new, code, ...) {
local_cairo_pdf(new, ...)
code
}
R/devices.R:52
local_cairo_ps untypeabletyped
unbound variable (line 74)
unbound: grDevices::cairo_ps — a name the prelude does not declare
error detail
name: grDevices::cairo_ps
gradual mode: typed
((new: any, ...: any, .local_envir: any?) -> any)<>
timing: 0.008 s
source
local_cairo_ps <- function(new, ..., .local_envir = parent.frame()) {
grDevices::cairo_ps(new, ...)
defer_dev_close(.local_envir)
}
R/devices.R:73
with_cairo_ps untypeabletyped
unbound variable (line 67)
unbound: local_cairo_ps — one of the package’s own names, itself untyped
error detail
name: local_cairo_ps
gradual mode: typed
∀'a. ((new: any, code: 'a, ...: any) -> 'a)<>
timing: 0.007 s
source
with_cairo_ps <- function(new, code, ...) {
local_cairo_ps(new, ...)
code
}
R/devices.R:66
local_pdf untypeabletyped
unbound variable (line 88)
unbound: grDevices::pdf — a name the prelude does not declare
error detail
name: grDevices::pdf
gradual mode: typed
((new: any, ...: any, .local_envir: any?) -> any)<>
timing: 0.008 s
source
local_pdf <- function(new, ..., .local_envir = parent.frame()) {
grDevices::pdf(new, ...)
defer_dev_close(.local_envir)
}
R/devices.R:87
with_pdf untypeabletyped
unbound variable (line 81)
unbound: local_pdf — one of the package’s own names, itself untyped
error detail
name: local_pdf
gradual mode: typed
∀'a. ((new: any, code: 'a, ...: any) -> 'a)<>
timing: 0.007 s
source
with_pdf <- function(new, code, ...) {
local_pdf(new, ...)
code
}
R/devices.R:80
local_postscript untypeabletyped
unbound variable (line 102)
unbound: grDevices::postscript — a name the prelude does not declare
error detail
name: grDevices::postscript
gradual mode: typed
((new: any, ...: any, .local_envir: any?) -> any)<>
timing: 0.008 s
source
local_postscript <- function(new, ..., .local_envir = parent.frame()) {
grDevices::postscript(new, ...)
defer_dev_close(.local_envir)
}
R/devices.R:101
with_postscript untypeabletyped
unbound variable (line 95)
unbound: local_postscript — one of the package’s own names, itself untyped
error detail
name: local_postscript
gradual mode: typed
∀'a. ((new: any, code: 'a, ...: any) -> 'a)<>
timing: 0.007 s
source
with_postscript <- function(new, code, ...) {
local_postscript(new, ...)
code
}
R/devices.R:94
local_svg untypeabletyped
unbound variable (line 116)
unbound: grDevices::svg — a name the prelude does not declare
error detail
name: grDevices::svg
gradual mode: typed
((new: any, ...: any, .local_envir: any?) -> any)<>
timing: 0.008 s
source
local_svg <- function(new, ..., .local_envir = parent.frame()) {
grDevices::svg(new, ...)
defer_dev_close(.local_envir)
}
R/devices.R:115
with_svg untypeabletyped
unbound variable (line 109)
unbound: local_svg — one of the package’s own names, itself untyped
error detail
name: local_svg
gradual mode: typed
∀'a. ((new: any, code: 'a, ...: any) -> 'a)<>
timing: 0.007 s
source
with_svg <- function(new, code, ...) {
local_svg(new, ...)
code
}
R/devices.R:108
local_tiff untypeabletyped
unbound variable (line 130)
unbound: grDevices::tiff — a name the prelude does not declare
error detail
name: grDevices::tiff
gradual mode: typed
((new: any, ...: any, .local_envir: any?) -> any)<>
timing: 0.008 s
source
local_tiff <- function(new, ..., .local_envir = parent.frame()) {
grDevices::tiff(new, ...)
defer_dev_close(.local_envir)
}
R/devices.R:129
with_tiff untypeabletyped
unbound variable (line 123)
unbound: local_tiff — one of the package’s own names, itself untyped
error detail
name: local_tiff
gradual mode: typed
∀'a. ((new: any, code: 'a, ...: any) -> 'a)<>
timing: 0.007 s
source
with_tiff <- function(new, code, ...) {
local_tiff(new, ...)
code
}
R/devices.R:122
local_xfig untypeabletyped
unbound variable (line 144)
unbound: grDevices::xfig — a name the prelude does not declare
error detail
name: grDevices::xfig
gradual mode: typed
((new: any, ...: any, .local_envir: any?) -> any)<>
timing: 0.008 s
source
local_xfig <- function(new, ..., .local_envir = parent.frame()) {
grDevices::xfig(new, ...)
defer_dev_close(.local_envir)
}
R/devices.R:143
with_xfig untypeabletyped
unbound variable (line 137)
unbound: local_xfig — one of the package’s own names, itself untyped
error detail
name: local_xfig
gradual mode: typed
∀'a. ((new: any, code: 'a, ...: any) -> 'a)<>
timing: 0.007 s
source
with_xfig <- function(new, code, ...) {
local_xfig(new, ...)
code
}
R/devices.R:136
local_png untypeabletyped
unbound variable (line 158)
unbound: grDevices::png — a name the prelude does not declare
error detail
name: grDevices::png
gradual mode: typed
((new: any, ...: any, .local_envir: any?) -> any)<>
timing: 0.008 s
source
local_png <- function(new, ..., .local_envir = parent.frame()) {
grDevices::png(new, ...)
defer_dev_close(.local_envir)
}
R/devices.R:157
with_png untypeabletyped
unbound variable (line 151)
unbound: local_png — one of the package’s own names, itself untyped
error detail
name: local_png
gradual mode: typed
∀'a. ((new: any, code: 'a, ...: any) -> 'a)<>
timing: 0.007 s
source
with_png <- function(new, code, ...) {
local_png(new, ...)
code
}
R/devices.R:150
local_jpeg untypeabletyped
unbound variable (line 172)
unbound: grDevices::jpeg — a name the prelude does not declare
error detail
name: grDevices::jpeg
gradual mode: typed
((new: any, ...: any, .local_envir: any?) -> any)<>
timing: 0.008 s
source
local_jpeg <- function(new, ..., .local_envir = parent.frame()) {
grDevices::jpeg(new, ...)
defer_dev_close(.local_envir)
}
R/devices.R:171
with_jpeg untypeabletyped
unbound variable (line 165)
unbound: local_jpeg — one of the package’s own names, itself untyped
error detail
name: local_jpeg
gradual mode: typed
∀'a. ((new: any, code: 'a, ...: any) -> 'a)<>
timing: 0.007 s
source
with_jpeg <- function(new, code, ...) {
local_jpeg(new, ...)
code
}
R/devices.R:164
R/tempfile.R
with_tempfile untypeabletyped
unbound variable (line 43)
unbound: .Deprecated — a name the prelude does not declare
error detail
name: .Deprecated
gradual mode: typed
((new: list | vec, code: any, envir: env?, .local_envir: env?, pattern: vec?, tmpdir: vec?, fileext: vec?) -> any)<>
timing: 0.126 s
source
with_tempfile <- function(
new,
code,
envir = parent.frame(),
.local_envir = parent.frame(),
pattern = "file",
tmpdir = tempdir(),
fileext = ""
) {
if (!missing(envir)) {
.Deprecated(
msg = "`envir` argument of with_tempfile() is deprecated.\n Use `with_tempfile(.local_envir=)` instead."
)
.local_envir <- envir
}
env <- new.env(parent = .local_envir)
for (f in new) {
assign(
f,
tempfile(pattern = pattern, tmpdir = tmpdir, fileext = fileext),
envir = env
)
}
on.exit(unlink(mget(new, envir = env), recursive = TRUE))
eval(substitute(code), envir = env)
}
R/tempfile.R:33
local_tempfile untypeable
unbound variable (line 75)
unbound: .Deprecated — a name the prelude does not declare
error detail
name: .Deprecated
timing: 0.162 s
source
local_tempfile <- function(
new = NULL,
lines = NULL,
envir = parent.frame(),
.local_envir = parent.frame(),
pattern = "file",
tmpdir = tempdir(),
fileext = ""
) {
if (!missing(envir)) {
.Deprecated(
msg = "`envir` argument of local_tempfile() is deprecated.\n Use `local_tempfile(.local_envir=)` instead."
)
.local_envir <- envir
}
if (is.null(new)) {
path <- tempfile(pattern = pattern, tmpdir = tmpdir, fileext = fileext)
if (!is.null(lines)) {
con <- file(path, open = "wb", encoding = "native.enc")
defer(close(con))
writeLines(enc2utf8(lines), con, useBytes = TRUE)
}
defer(unlink(path, recursive = TRUE), envir = .local_envir)
return(path)
}
.Deprecated(
msg = "`new` argument of local_tempfile() is deprecated.\n Use `path <- local_tempfile()` instead."
)
for (f in new) {
assign(
f,
tempfile(pattern = pattern, tmpdir = tmpdir, fileext = fileext),
envir = .local_envir
)
}
defer(
unlink(mget(new, envir = .local_envir), recursive = TRUE),
envir = .local_envir
)
}
R/tempfile.R:65
with_tempdir untypeabletyped
unbound variable (line 126)
unbound: dir.create — a name the prelude does not declare
error detail
name: dir.create
gradual mode: typed
((code: any, clean: LGL?, pattern: vec?, tmpdir: vec?, fileext: vec?) -> any)<>
timing: 0.184 s
source
with_tempdir <- function(
code,
clean = TRUE,
pattern = "file",
tmpdir = tempdir(),
fileext = ""
) {
if (length(clean) > 1 || !is.logical(clean)) {
stop("`clean` must be a single TRUE or FALSE", call. = FALSE)
}
tmp <- tempfile(pattern = pattern, tmpdir = tmpdir, fileext = fileext)
dir.create(tmp)
if (clean) {
on.exit(unlink(tmp, recursive = TRUE), add = TRUE)
}
withr::with_dir(tmp, code)
}
R/tempfile.R:113
local_tempdir untypeable
unbound variable (line 148)
unbound: dir.create — a name the prelude does not declare
error detail
name: dir.create
timing: 0.198 s
source
local_tempdir <- function(
pattern = "file",
tmpdir = tempdir(),
fileext = "",
.local_envir = parent.frame(),
clean = TRUE
) {
if (length(clean) > 1 || !is.logical(clean)) {
stop("`clean` must be a single TRUE or FALSE", call. = FALSE)
}
path <- tempfile(pattern = pattern, tmpdir = tmpdir, fileext = fileext)
dir.create(path, recursive = TRUE)
if (isTRUE(clean)) {
defer(unlink(path, recursive = TRUE), envir = .local_envir)
}
path
}
R/tempfile.R:135
R/libpaths.R
set_libpaths untypeabletyped
unbound variable (line 10)
unbound: merge_new — one of the package’s own names, itself untyped
error detail
name: merge_new
gradual mode: typed
((paths: vec | null, action: any?) -> CHR<>)<>
timing: 0.057 s
source
set_libpaths <- function(paths, action = "replace") {
paths <- as_character(paths)
paths <- normalizePath(paths, mustWork = TRUE)
old <- .libPaths()
paths <- merge_new(old, paths, action)
.libPaths(paths)
invisible(old)
}
R/libpaths.R:5
get_libpaths typed fuzz ok
((...: any) -> CHR<>)<>
timing: 0.007 s
fuzzing: 8 inside (8 ok) · 0 outside (none)
source
get_libpaths <- function(...) {
.libPaths()
}
R/libpaths.R:16
set_temp_libpath untypeabletyped
unbound variable (line 22)
unbound: dir.create — a name the prelude does not declare
error detail
name: dir.create
gradual mode: typed
((action: any?) -> CHR<>)<>
timing: 0.006 s
source
set_temp_libpath <- function(action = "prefix") {
paths <- tempfile("temp_libpath")
dir.create(paths)
set_libpaths(paths, action = action)
}
R/libpaths.R:20
with_libpaths untypeabletyped
unbound variable (line 44)
unbound: set_libpaths — one of the package’s own names, itself untyped
error detail
name: set_libpaths
gradual mode: typed
any
timing: 0.008 s
source
with_libpaths <- with_(set_libpaths, .libPaths, get = get_libpaths)
R/libpaths.R:44
local_libpaths untypeabletyped
unbound variable (line 48)
unbound: set_libpaths — one of the package’s own names, itself untyped
error detail
name: set_libpaths
gradual mode: typed
any
timing: 0.001 s
source
local_libpaths <- local_(set_libpaths, .libPaths, get = get_libpaths)
R/libpaths.R:48
with_temp_libpaths untypeabletyped
unbound variable (line 60)
unbound: set_temp_libpath — one of the package’s own names, itself untyped
error detail
name: set_temp_libpath
gradual mode: typed
any
timing: 0.001 s
source
with_temp_libpaths <- with_(
set_temp_libpath,
.libPaths,
get = get_libpaths,
new = FALSE
)
R/libpaths.R:59
local_temp_libpaths untypeabletyped
unbound variable (line 69)
unbound: set_temp_libpath — one of the package’s own names, itself untyped
error detail
name: set_temp_libpath
gradual mode: typed
any
timing: 0.001 s
source
local_temp_libpaths <- local_(
set_temp_libpath,
.libPaths,
get = get_libpaths,
new = FALSE
)
R/libpaths.R:68
R/namespace.R
with_package untypeable
unbound variable (line 33)
unbound: .packages — a name the prelude does not declare
error detail
name: .packages
timing: 0.202 s
source
with_package <- function(
package,
code,
pos = 2,
lib.loc = NULL,
character.only = TRUE,
logical.return = FALSE,
warn.conflicts = FALSE,
quietly = TRUE,
verbose = getOption("verbose")
) {
# Only try to attach (and detach) the package if it is not already attached.
if (!(package %in% .packages())) {
suppressPackageStartupMessages(
(get("library"))(
package,
pos = pos,
lib.loc = lib.loc,
character.only = character.only,
logical.return = logical.return,
warn.conflicts = warn.conflicts,
quietly = quietly,
verbose = verbose
)
)
on.exit(detach(paste0("package:", package), character.only = TRUE))
}
force(code)
}
R/namespace.R:21
local_package untypeable
untypeable projection (line 67)
error detail
argument: any
argument may be: new.env()
timing: 0.204 s
source
local_package <- function(
package,
pos = 2,
lib.loc = NULL,
character.only = TRUE,
logical.return = FALSE,
warn.conflicts = FALSE,
quietly = TRUE,
verbose = getOption("verbose"),
.local_envir = parent.frame()
) {
suppressPackageStartupMessages(
(get("library"))(
package,
pos = pos,
lib.loc = lib.loc,
character.only = character.only,
logical.return = logical.return,
warn.conflicts = warn.conflicts,
quietly = quietly,
verbose = verbose
)
)
defer(
detach(paste0("package:", package), character.only = TRUE),
envir = .local_envir
)
}
R/namespace.R:55
with_namespace untypeable
untypeable projection (line 90)
error detail
argument: any
argument may be: new.env()
timing: 0.032 s
source
with_namespace <- function(package, code, warn.conflicts = FALSE) {
ns <- asNamespace(package)
name <- format(ns)
(get("attach"))(ns, name = name, warn.conflicts = warn.conflicts)
on.exit(detach(name, character.only = TRUE))
force(code)
}
R/namespace.R:87
local_namespace untypeable
untypeable projection (line 104)
error detail
argument: any
argument may be: new.env()
timing: 0.035 s
source
local_namespace <- function(
package,
.local_envir = parent.frame(),
warn.conflicts = FALSE
) {
ns <- asNamespace(package)
name <- format(ns)
(get("attach"))(ns, name = name, warn.conflicts = warn.conflicts)
defer(detach(name, character.only = TRUE), envir = .local_envir)
}
R/namespace.R:97
with_environment untypeable
untypeable projection (line 118)
error detail
argument: any
argument may be: new.env()
timing: 0.112 s
source
with_environment <- function(
env,
code,
pos = 2L,
name = format(env),
warn.conflicts = FALSE
) {
(get("attach"))(env, name = name, pos = pos, warn.conflicts = warn.conflicts)
on.exit(detach(name, character.only = TRUE))
force(code)
}
R/namespace.R:111
local_environment untypeable
untypeable projection (line 132)
error detail
argument: any
argument may be: new.env()
timing: 0.117 s
source
local_environment <- function(
env,
pos = 2L,
name = format(env),
warn.conflicts = FALSE,
.local_envir = parent.frame()
) {
(get("attach"))(env, name = name, pos = pos, warn.conflicts = warn.conflicts)
defer(detach(name, character.only = TRUE), envir = .local_envir)
}
R/namespace.R:125
R/path.R
get_path typed fuzz ok
((...: any) -> CHR<>)<>
timing: 0.036 s
fuzzing: 7 inside (7 ok) · 0 outside (none)
source
get_path <- function(...) {
strsplit(Sys.getenv("PATH"), .Platform$path.sep)[[1]]
}
R/path.R:3
set_path untypeabletyped
unbound variable (line 14)
unbound: merge_new — one of the package’s own names, itself untyped
error detail
name: merge_new
gradual mode: typed
((path: vec | null, action: (vec | null)?) -> CHR<>)<>
timing: 0.084 s
source
set_path <- function(path, action = c("prefix", "suffix", "replace")) {
action <- match.arg(action)
path <- as_character(path)
path <- normalizePath(path, mustWork = FALSE)
old <- get_path()
path <- merge_new(old, path, action)
path <- paste(path, collapse = .Platform$path.sep)
Sys.setenv(PATH = path)
invisible(old)
}
R/path.R:7
with_path untypeabletyped
unbound variable (line 39)
unbound: set_path — one of the package’s own names, itself untyped
error detail
name: set_path
gradual mode: typed
any
timing: 0.001 s
source
with_path <- with_(
set_path,
reset = function(old) set_path(old, "replace"),
get = get_path
)
R/path.R:38
local_path untypeabletyped
unbound variable (line 47)
unbound: set_path — one of the package’s own names, itself untyped
error detail
name: set_path
gradual mode: typed
any
timing: 0.001 s
source
local_path <- local_(
set_path,
reset = function(old) set_path(old, "replace"),
get = get_path
)
R/path.R:46
R/seed.R
set_seed untypeabletyped
unbound variable (line 121)
unbound: restore_rng_kind — one of the package’s own names, itself untyped
error detail
name: restore_rng_kind
gradual mode: typed
(((seed: { rng_kind: { }<~@"[[", ...>, any }) -> empty) & ((seed: { seed: null, rng_kind: list<~@"[[", ...> | vec<~@"[[", ...> | <@"[[", ...>, random_seed: any, any }) | (seed: { seed: ~null, rng_kind: list<~@"[[", ...> | vec<~@"[[", ...> | <@"[[", ...>, any }) -> any))<>
timing: 0.036 s
source
set_seed <- function(seed) {
restore_rng_kind(seed$rng_kind)
if (is.null(seed$seed)) {
assign(".Random.seed", seed$random_seed, globalenv())
} else {
set.seed(seed$seed)
}
}
R/seed.R:120
has_seed untypeabletyped
unbound variable (line 99)
unbound: exists — a name the prelude does not declare
error detail
name: exists
gradual mode: typed
(() -> any)<>
timing: 0.002 s
source
has_seed <- function() {
exists(".Random.seed", globalenv(), mode = "integer", inherits = FALSE)
}
R/seed.R:98
get_seed untypeable
unbound variable (line 106)
unbound: has_seed — one of the package’s own names, itself untyped
error detail
name: has_seed
timing: 0.012 s
source
get_seed <- function() {
# Return `NULL` (rather than a list with `random_seed = NULL`) when no
# seed exists. Callers branch on `is.null()` to decide whether to remove
# `.Random.seed` on exit instead of assigning `NULL` to it.
if (!has_seed()) {
return(NULL)
}
list(
random_seed = get0(
".Random.seed",
globalenv(),
mode = "integer",
inherits = FALSE
),
rng_kind = RNGkind()
)
}
R/seed.R:102
rm_seed untypeable
unbound variable (line 131)
unbound: has_seed — one of the package’s own names, itself untyped
error detail
name: has_seed
timing: 0.011 s
source
rm_seed <- function() {
if (!has_seed()) {
return(NULL)
}
set.seed(seed = NULL) # also reset Normal RNG state (cf. #162)
rm(".Random.seed", envir = globalenv())
}
R/seed.R:130
with_preserve_seed untypeabletyped
unbound variable (line 71)
unbound: get_seed — one of the package’s own names, itself untyped
error detail
name: get_seed
gradual mode: typed
∀'a. ((code: 'a) -> 'a)<>
timing: 0.008 s
source
with_preserve_seed <- function(code) {
old_seed <- get_seed()
if (is.null(old_seed)) {
on.exit(rm_seed(), add = TRUE)
} else {
on.exit(set_seed(old_seed), add = TRUE)
}
code
}
R/seed.R:70
with_seed untypeabletyped
unbound variable (line 33)
unbound: set_seed — one of the package’s own names, itself untyped
error detail
name: set_seed
gradual mode: typed
∀'a. ((seed: ~null, code: 'a, .rng_kind: any?, .rng_normal_kind: any?, .rng_sample_kind: any?) -> 'a)<>
timing: 0.079 s
source
with_seed <- function(
seed,
code,
.rng_kind = NULL,
.rng_normal_kind = NULL,
.rng_sample_kind = NULL
) {
force(seed)
rng_kind <- list(.rng_kind, .rng_normal_kind, .rng_sample_kind)
with_preserve_seed({
set_seed(list(seed = seed, rng_kind = rng_kind))
code
})
}
R/seed.R:22
local_seed skipped
error detail
Failure("Unsupported positional argument after a named one.")timing: 0.000 s
source
local_seed <- function(
seed,
.local_envir = parent.frame(),
.rng_kind = NULL,
.rng_normal_kind = NULL,
.rng_sample_kind = NULL
) {
old_seed <- get_seed()
defer(envir = .local_envir, {
if (is.null(old_seed)) {
rm_seed()
} else {
set_seed(old_seed)
}
})
rng_kind <- list(.rng_kind, .rng_normal_kind, .rng_sample_kind)
set_seed(list(seed = seed, rng_kind = rng_kind))
# FIXME
invisible(seed)
}
R/seed.R:40
local_preserve_seed untypeable
unbound variable (line 84)
unbound: get_seed — one of the package’s own names, itself untyped
error detail
name: get_seed
timing: 0.011 s
source
local_preserve_seed <- function(.local_envir = parent.frame()) {
old_seed <- get_seed()
defer(
if (is.null(old_seed)) {
rm_seed()
} else {
set_seed(old_seed)
},
envir = .local_envir
)
invisible(old_seed)
}
R/seed.R:83
R/sink.R
output_sink typed any: file accepts outside
((file: any?, append: lgl1?, split: lgl1?) -> null)<>
timing: 0.064 s
fuzzing: 8 inside (3 ok, 5 error type) · 8 outside (5 rejected, 1 accepted, 2 not forced)
Accepted outside the domain split: 1
| parameter | change | call | returned |
|---|
| split | length:2 | output_sink("split" = as.raw(c(0, 0))) | null |
Other calls inside the domain
| call | verdict | error |
|---|
| output_sink(local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), "append" = NA) | error_type | base::sink: 'file' must be NULL, a connection or a character string |
| output_sink(local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), as.raw(c(255)), NA) | error_type | base::sink: 'file' must be NULL, a connection or a character string |
| output_sink("file" = quote(f(x)), "split" = as.raw(c(255))) | error_type | base::sink: 'file' must be NULL, a connection or a character string |
| output_sink(list(local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), quote(f(x))), as.raw(c(0))) | error_type | base::sink: 'file' must be NULL, a connection or a character string |
| output_sink("file" = local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), "split" = NA) | error_type | base::sink: 'file' must be NULL, a connection or a character string |
source
output_sink <- function(file = NULL, append = FALSE, split = FALSE) {
sink(file = file, append = append, type = "output", split = split)
}
R/sink.R:4
message_sink typed any: file fuzz ok
((file: any?, append: lgl1?) -> null)<>
timing: 0.037 s
fuzzing: 8 inside (4 ok, 4 error type) · 7 outside (4 rejected, 3 not forced)
Other calls inside the domain
| call | verdict | error |
|---|
| message_sink(as.name("x"), as.raw(c(255))) | error_type | base::sink: 'file' must be NULL or an already open connection |
| message_sink(c(Inf, -2.5, -Inf, -2147483647, 0), NA) | error_type | base::sink: 'file' must be NULL or an already open connection |
| message_sink(new.env(), "append" = TRUE) | error_type | base::sink: 'file' must be NULL or an already open connection |
| message_sink(as.name("x")) | error_type | base::sink: 'file' must be NULL or an already open connection |
source
message_sink <- function(file = NULL, append = FALSE) {
sink(file = file, append = append, type = "message", split = FALSE)
}
R/sink.R:8
set_output_sink untypeabletyped
unbound variable (line 15)
unbound: file — a name the prelude does not declare
error detail
name: file
gradual mode: typed
any
timing: 0.002 s
source
set_output_sink <- wrap(
output_sink,
if (is.null(file)) {
stop("file cannot be NULL", call. = FALSE)
},
list(n = sink.number())
)
R/sink.R:13
set_message_sink untypeabletyped
unbound variable (line 38)
unbound: sink.number — a name the prelude does not declare
error detail
name: sink.number
gradual mode: typed
empty
timing: 0.075 s
source
set_message_sink <- wrap(
message_sink,
{
if (is.null(file)) {
stop("file cannot be NULL,", call. = FALSE)
}
if (sink.number(type = "message") != 2L) {
stop(
"Cannot establish message sink when another sink is active.",
call. = FALSE
)
}
con <- if (is.character(file)) {
file <- file(file, if (append) "a" else "w")
}
},
{
list(n = sink.number(type = "message"), con = con)
}
)
R/sink.R:21
reset_output_sink skipped
error detail
File "Rsem/lang/PAst.ml", line 210, characters 14-20: Assertion failed
timing: 0.000 s
source
reset_output_sink <- function(sink_info) {
repeat {
n <- sink.number()
delta <- n - sink_info$n
if (delta >= 0L) {
sink()
if (delta > 0L) {
warning("Removing a different sink.", call. = FALSE)
} else {
return()
}
} else {
warning("Sink #", sink_info$n, " already removed.", call. = FALSE)
return()
}
}
}
R/sink.R:42
do_reset_message_sink untypeabletyped
unbound variable (line 71)
unbound: sink.number — a name the prelude does not declare
error detail
name: sink.number
gradual mode: typed
((sink_info: { n: any, any }) -> CHR1<> | null)<>
timing: 0.006 s
source
do_reset_message_sink <- function(sink_info) {
n <- sink.number(type = "message")
if (n == 2L) {
warning("No message sink to remove.", call. = FALSE)
} else if (n == sink_info$n) {
sink(type = "message")
} else {
warning("Not removing a different message sink.", call. = FALSE)
}
}
R/sink.R:70
reset_message_sink untypeabletyped
unbound variable (line 64)
unbound: on.exit — a name the prelude does not declare
error detail
name: on.exit
gradual mode: typed
((sink_info: { n: any, con: <connection, ...>, any }) | (sink_info: { n: any, con: null, any }) -> CHR1<> | null)<>
timing: 0.100 s
source
reset_message_sink <- function(sink_info) {
if (!is.null(sink_info$con)) {
on.exit(close(sink_info$con), add = TRUE)
}
do_reset_message_sink(sink_info)
}
R/sink.R:62
with_output_sink untypeabletyped
unbound variable (line 96)
unbound: set_output_sink — one of the package’s own names, itself untyped
error detail
name: set_output_sink
gradual mode: typed
any
timing: 0.000 s
source
with_output_sink <- with_(set_output_sink, reset_output_sink)
R/sink.R:96
local_output_sink untypeabletyped
unbound variable (line 100)
unbound: set_output_sink — one of the package’s own names, itself untyped
error detail
name: set_output_sink
gradual mode: typed
any
timing: 0.000 s
source
local_output_sink <- local_(set_output_sink, reset_output_sink)
R/sink.R:100
with_message_sink untypeabletyped
unbound variable (line 104)
unbound: set_message_sink — one of the package’s own names, itself untyped
error detail
name: set_message_sink
gradual mode: typed
empty
timing: 0.000 s
source
with_message_sink <- with_(set_message_sink, reset_message_sink)
R/sink.R:104
local_message_sink untypeabletyped
unbound variable (line 108)
unbound: set_message_sink — one of the package’s own names, itself untyped
error detail
name: set_message_sink
gradual mode: typed
empty
timing: 0.000 s
source
local_message_sink <- local_(set_message_sink, reset_message_sink)
R/sink.R:108
R/timezone.R
reset_timezone untypeable
unbound variable (line 50)
unbound: baseenv — a name the prelude does not declare
error detail
name: baseenv
timing: 0.008 s
source
reset_timezone <- function(envir = parent.frame()) {
base_env <- baseenv()
old <- get0(
".sys.timezone",
base_env,
mode = "character",
inherits = FALSE,
ifnotfound = NA_character_
)
is_locked <- bindingIsLocked(".sys.timezone", env = base_env)
if (is_locked) {
base_env$unlockBinding(".sys.timezone", env = base_env)
}
defer(
{
assign(".sys.timezone", old, envir = base_env)
if (is_locked) {
lockBinding(".sys.timezone", env = base_env)
}
},
envir = envir
)
assign(".sys.timezone", NA_character_, envir = base_env)
}
R/timezone.R:49
with_timezone untypeable
unbound variable (line 23)
unbound: reset_timezone — one of the package’s own names, itself untyped
error detail
name: reset_timezone
timing: 0.006 s
source
with_timezone <- function(tz, code) {
reset_timezone()
with_envvar(c(TZ = tz), code)
}
R/timezone.R:22
local_timezone untypeable
unbound variable (line 45)
unbound: reset_timezone — one of the package’s own names, itself untyped
error detail
name: reset_timezone
timing: 0.008 s
source
local_timezone <- function(tz, .local_envir = parent.frame()) {
reset_timezone(envir = .local_envir)
local_envvar(c(TZ = tz), .local_envir = .local_envir)
}
R/timezone.R:44