[med-svn] [r-cran-rlang] 03/05: New upstream version 0.1.4

Andreas Tille tille at debian.org
Thu Dec 21 14:45:46 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-rlang.

commit a77bb622e4973efba506585b3afacf2ddf08d265
Author: Andreas Tille <tille at debian.org>
Date:   Sat Nov 11 16:06:51 2017 +0100

    New upstream version 0.1.4
---
 DESCRIPTION                        |  6 ++---
 MD5                                | 20 ++++++++---------
 NEWS.md                            |  7 ++++++
 R/eval-tidy.R                      |  4 ----
 README.md                          |  1 +
 src/capture.c                      | 10 +++++----
 src/export.c                       | 14 +++++++-----
 src/splice.c                       |  6 +++--
 tests/testthat/test-dots.R         |  3 ++-
 tests/testthat/test-tidy-capture.R | 15 +++++++++----
 tests/testthat/test-tidy-unquote.R | 46 ++++++++++++++++++++++++++++----------
 11 files changed, 87 insertions(+), 45 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 9eb83c2..b9b7d15 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,5 +1,5 @@
 Package: rlang
-Version: 0.1.2
+Version: 0.1.4
 Title: Functions for Base Types and Core R and 'Tidyverse' Features
 Description: A toolbox for working with base types, core R features
   like the condition system, and core 'Tidyverse' features like tidy
@@ -18,10 +18,10 @@ RoxygenNote: 6.0.1
 URL: http://rlang.tidyverse.org, https://github.com/tidyverse/rlang
 BugReports: https://github.com/tidyverse/rlang/issues
 NeedsCompilation: yes
-Packaged: 2017-08-09 16:20:26 UTC; lionel
+Packaged: 2017-11-04 11:22:57 UTC; lionel
 Author: Lionel Henry [aut, cre],
   Hadley Wickham [aut],
   RStudio [cph]
 Maintainer: Lionel Henry <lionel at rstudio.com>
 Repository: CRAN
-Date/Publication: 2017-08-09 20:37:03 UTC
+Date/Publication: 2017-11-05 15:47:40 UTC
diff --git a/MD5 b/MD5
index 061ba00..be6d778 100644
--- a/MD5
+++ b/MD5
@@ -1,6 +1,6 @@
-25eea7a62ac382818e2404acaa118a06 *DESCRIPTION
+65d35856e178a8546fd03c7504d5bad0 *DESCRIPTION
 65e8be68e9c270cee089874f0a91d54b *NAMESPACE
-3dc858b904ccd682a399764432254f21 *NEWS.md
+848fcc63906d9ddf671293a4d945c8fb *NEWS.md
 5850c9a2547cc102760f6e7b31a0ab44 *R/arg.R
 b87c840684fbca7a060d0f26c50de634 *R/attr.R
 ebe43cd5909495eda412096fe8504082 *R/cnd-handlers.R
@@ -12,7 +12,7 @@ feaa904f11d6970ddbc1057a30cf6610 *R/compat-purrr.R
 1a08a8fbda2f47103500c2bf75e16b9a *R/dictionary.R
 5e40bec0fe1de4cdbee2e69b63e71edf *R/dots.R
 4994de628a91c8c0666ce64b9189fa63 *R/env.R
-a274f5a30b044f570f92afa22103ab61 *R/eval-tidy.R
+c9cf06cbb5a307af0d9ee7ec2ef6182f *R/eval-tidy.R
 c75b93394da034fba516f3e4de376d73 *R/eval.R
 388c0182395c9097dec25488f238a9f0 *R/expr-lang.R
 940d8b698ba48d98bb2d63eed74e63cc *R/expr-node.R
@@ -36,7 +36,7 @@ fc209d4253bdd65575665072492f8034 *R/vector-ctor.R
 bd7a7c1849b9e4fc6bd0a74d90600544 *R/vector-raw.R
 ba84d9a9590dcd2c00955efc33412060 *R/vector-squash.R
 b0806a2d025031a83d77602c2c10962d *R/vector-utils.R
-a30526960e3890f9f1005faf0a0461a5 *README.md
+79d46b8a5affc5231a428d98b7e47410 *README.md
 434467c5842f5c005d33976fca693fc1 *build/vignette.rds
 21c7dbbbe94c04ebc0079d1a6354a6c7 *inst/doc/tidy-evaluation.R
 2feb5d2bc3cdd936bedfc6fee3dbd6b3 *inst/doc/tidy-evaluation.Rmd
@@ -168,10 +168,10 @@ fc59656f3e428a760dc0495920c26c9d *man/vector-coercion.Rd
 ec96a4d180e97c582d48344245055fef *man/with_handlers.Rd
 6b11d3538b23bf99cd534c7c37d40a70 *man/with_restarts.Rd
 01b67f9a87ec275638ea7fda507a5bd2 *src/attrs.c
-a93282970e52e3588f17cdd94d708f4d *src/capture.c
+43d8f37ce17435241db5e0d780352334 *src/capture.c
 e70f730597da4fae90ec0d701207a200 *src/env.c
 3bb13c900498e3bc73f021b48e423fac *src/eval.c
-7180953c095a5d580b43cc8e578d8362 *src/export.c
+93502928dfe006912885ba9e24502eda *src/export.c
 a38b760fd28821b93e4784c32ae1f63b *src/export.h
 5a4831941c2148102ff05a5fd4b7d264 *src/formula.c
 513c2b96983ca4b454e046861589ffa8 *src/formula.h
@@ -180,7 +180,7 @@ ae15801957c56233dfc9f4351fc2b372 *src/lang.c
 b57df213d7db4146c41dece2ce716c0c *src/pairlist.c
 b69fa43716f95ae3fb4c6c359a45e4bf *src/replace-na.c
 a347f2ebd39fa6de52d69919d2bb071f *src/sexp.c
-dd2aa426091ee2e615a749985871df59 *src/splice.c
+df0700081acfb03e4ac09b2ff604f379 *src/splice.c
 eef080034ed3e85f5bd91674698d34aa *src/symbol.c
 7415abdd0bbee28ab86181e349a67a08 *src/unquote.c
 343e916983e85ff27f3330282545f3e8 *src/utils.c
@@ -195,7 +195,7 @@ f39aa969618c1abb58b4f3f0ca828969 *tests/testthat/test-arg.R
 401bef78b8d85991bf8eb2ef3a504b7a *tests/testthat/test-compat.R
 b2b0ce84a6a1a1958bdeb85ff6e32973 *tests/testthat/test-conditions.R
 f5cd5c0e09a4344d933cfb812b638b7d *tests/testthat/test-dictionary.R
-dbf409f79498787684f6573ee1d6a0ef *tests/testthat/test-dots.R
+46d5c6a85bcc6e31bb026a51327ca296 *tests/testthat/test-dots.R
 c8ef7ffbf320fa6712f1417208e197e9 *tests/testthat/test-encoding.R
 f539828c6b65165db8d14a37e32cd0f7 *tests/testthat/test-env.R
 23f0564b9101b2409f843a979b2e018b *tests/testthat/test-eval.R
@@ -209,9 +209,9 @@ be988bf66c3673ded7a9ba5ee474ce4a *tests/testthat/test-parse.R
 9aa5a7d3440162f931853e2d3118d77d *tests/testthat/test-quo-enquo.R
 21489a8fb3068bdd2d00f4d17fa41c6e *tests/testthat/test-quosure.R
 48befc498a6ee454bffd036a8bdf6071 *tests/testthat/test-stack.R
-7bb827063f12cdde9ee68cabb5a74d51 *tests/testthat/test-tidy-capture.R
+c4b7101f8d191f6633af905aab7caa39 *tests/testthat/test-tidy-capture.R
 a8171390c87680d0ad8737f3cc056fe8 *tests/testthat/test-tidy-eval.R
-b1f4b073912d27e34e65e6e4d22f45f1 *tests/testthat/test-tidy-unquote.R
+c8e7ee45247572338a97d04a8020aa93 *tests/testthat/test-tidy-unquote.R
 2bc782df7ad5fa0368bc31cffb412cca *tests/testthat/test-types-coercion.R
 c048b0fca9ca76d7eaa9c7942da5a612 *tests/testthat/test-types.R
 874c18cb5b85c2d779909b4ad8e3f5ff *tests/testthat/test-utils.R
diff --git a/NEWS.md b/NEWS.md
index db76322..ce5b746 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,4 +1,11 @@
 
+# rlang 0.1.4
+
+* `eval_tidy()` no longer maps over lists but returns them literally.
+  This behaviour is an overlook from past refactorings and was never
+  documented.
+
+
 # rlang 0.1.2
 
 This hotfix release makes rlang compatible with the R 3.1 branch.
diff --git a/R/eval-tidy.R b/R/eval-tidy.R
index 75d294d..8c31c42 100644
--- a/R/eval-tidy.R
+++ b/R/eval-tidy.R
@@ -91,10 +91,6 @@
 #' eval_tidy(quo(!! cyl), mtcars)
 #' @name eval_tidy
 eval_tidy <- function(expr, data = NULL, env = caller_env()) {
-  if (is_list(expr)) {
-    return(map(expr, eval_tidy, data = data))
-  }
-
   if (!inherits(expr, "quosure")) {
     expr <- new_quosure(expr, env)
   }
diff --git a/README.md b/README.md
index d43eccf..ea4f492 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
 # rlang
 
 [![Build Status](https://travis-ci.org/tidyverse/rlang.svg?branch=master)](https://travis-ci.org/tidyverse/rlang)
+[![Coverage Status](http://codecov.io/github/tidyverse/rlang/coverage.svg?branch=master)](http://codecov.io/github/tidyverse/rlang?branch=master)
 
 ## Overview
 
diff --git a/src/capture.c b/src/capture.c
index 0ebec71..6a0d9d4 100644
--- a/src/capture.c
+++ b/src/capture.c
@@ -73,10 +73,12 @@ SEXP attribute_hidden rlang_capturedots(SEXP call, SEXP op, SEXP args, SEXP rho)
     int strict = asLogical(CADR(args));
 
     // R code has checked for unbound dots
-    SEXP dots = findVarInFrame3(caller_env, R_DotsSymbol, TRUE);
+    SEXP dots = PROTECT(findVarInFrame3(caller_env, R_DotsSymbol, TRUE));
 
-    if (dots == R_MissingArg)
+    if (dots == R_MissingArg) {
+        UNPROTECT(1);
         return allocVector(VECSXP, 0);
+    }
 
     int n_dots = length(dots);
     SEXP captured = PROTECT(allocVector(VECSXP, n_dots));
@@ -91,7 +93,7 @@ SEXP attribute_hidden rlang_capturedots(SEXP call, SEXP op, SEXP args, SEXP rho)
         if (TYPEOF(dot) == PROMSXP) {
             dot = capture_promise(dot, strict);
             if (dot == R_NilValue) {
-                UNPROTECT(2);
+                UNPROTECT(3);
                 return R_NilValue;
             }
         } else {
@@ -106,6 +108,6 @@ SEXP attribute_hidden rlang_capturedots(SEXP call, SEXP op, SEXP args, SEXP rho)
         dots = CDR(dots);
     }
 
-    UNPROTECT(2);
+    UNPROTECT(3);
     return captured;
 }
diff --git a/src/export.c b/src/export.c
index 7b8fb83..cdf8fbc 100644
--- a/src/export.c
+++ b/src/export.c
@@ -18,9 +18,11 @@ DL_FUNC R_ExternalPtrAddrFn(SEXP s) {
 #endif
 
 SEXP rlang_namespace(const char* ns) {
-  SEXP call = PROTECT(Rf_lang2(Rf_install("getNamespace"), Rf_mkString(ns)));
+  SEXP ns_string = PROTECT(Rf_mkString(ns));
+  SEXP call = PROTECT(Rf_install("getNamespace"));
+  call = PROTECT(Rf_lang2(call, ns_string));
   SEXP ns_env = Rf_eval(call, R_BaseEnv);
-  UNPROTECT(1);
+  UNPROTECT(3);
   return ns_env;
 }
 
@@ -30,8 +32,10 @@ void rlang_register_pointer(const char* ns, const char* ptr_name, DL_FUNC fn) {
   SEXP ptr_obj = PROTECT(Rf_allocVector(VECSXP, 1));
   SET_VECTOR_ELT(ptr_obj, 0, ptr);
 
-  Rf_setAttrib(ptr_obj, R_ClassSymbol, Rf_mkString("fn_pointer"));
+  SEXP ptr_class = PROTECT(Rf_mkString("fn_pointer"));
+  Rf_setAttrib(ptr_obj, R_ClassSymbol, ptr_class);
 
-  Rf_defineVar(Rf_install(ptr_name), ptr_obj, rlang_namespace(ns));
-  UNPROTECT(2);
+  SEXP ns_env = PROTECT(rlang_namespace(ns));
+  Rf_defineVar(Rf_install(ptr_name), ptr_obj, ns_env);
+  UNPROTECT(4);
 }
diff --git a/src/splice.c b/src/splice.c
index 1856927..e0124f2 100644
--- a/src/splice.c
+++ b/src/splice.c
@@ -30,7 +30,7 @@ R_len_t atom_squash(SEXPTYPE kind, squash_info_t info,
     Rf_errorcall(R_NilValue, "Only lists can be spliced");
 
   SEXP inner;
-  SEXP out_names = names(out);
+  SEXP out_names = PROTECT(names(out));
   R_len_t n_outer = Rf_length(outer);
   R_len_t n_inner;
 
@@ -55,6 +55,7 @@ R_len_t atom_squash(SEXPTYPE kind, squash_info_t info,
     }
   }
 
+  UNPROTECT(1);
   return count;
 }
 
@@ -68,7 +69,7 @@ R_len_t list_squash(squash_info_t info, SEXP outer,
     Rf_errorcall(R_NilValue, "Only lists can be spliced");
 
   SEXP inner;
-  SEXP out_names = names(out);
+  SEXP out_names = PROTECT(names(out));
   R_len_t n_outer = Rf_length(outer);
 
   for (R_len_t i = 0; i != n_outer; ++i) {
@@ -88,6 +89,7 @@ R_len_t list_squash(squash_info_t info, SEXP outer,
     }
   }
 
+  UNPROTECT(1);
   return count;
 }
 
diff --git a/tests/testthat/test-dots.R b/tests/testthat/test-dots.R
index 68ea2c7..51a6919 100644
--- a/tests/testthat/test-dots.R
+++ b/tests/testthat/test-dots.R
@@ -19,7 +19,8 @@ test_that("dots are always named", {
 })
 
 test_that("dots can be spliced", {
-  expect_identical(dots_values(!!! list(letters)), named_list(splice(list(letters))))
+  spliced_dots <- dots_values(!!! list(letters))
+  expect_identical(spliced_dots, named_list(splice(list(letters))))
   expect_identical(flatten(dots_values(!!! list(letters))), list(letters))
   expect_identical(ll(!!! list(letters)), list(letters))
   wrapper <- function(...) ll(...)
diff --git a/tests/testthat/test-tidy-capture.R b/tests/testthat/test-tidy-capture.R
index 045dd08..8d6b411 100644
--- a/tests/testthat/test-tidy-capture.R
+++ b/tests/testthat/test-tidy-capture.R
@@ -57,10 +57,17 @@ test_that("dots capture is stack-consistent", {
 })
 
 test_that("splice is consistently recognised", {
-  expect_true(is_splice(quote(!!! list())))
-  expect_true(is_splice(quote(UQS(list()))))
-  expect_true(is_splice(quote(rlang::UQS(list()))))
-  expect_false(is_splice(quote(ns::UQS(list()))))
+  spliced <- quote(!!! list())
+  expect_true(is_splice(spliced))
+
+  spliced <- quote(UQS(list()))
+  expect_true(is_splice(spliced))
+
+  spliced <- quote(rlang::UQS(list()))
+  expect_true(is_splice(spliced))
+
+  spliced <- quote(ns::UQS(list()))
+  expect_false(is_splice(spliced))
 })
 
 test_that("dots can be spliced in", {
diff --git a/tests/testthat/test-tidy-unquote.R b/tests/testthat/test-tidy-unquote.R
index 11883cb..c8f955a 100644
--- a/tests/testthat/test-tidy-unquote.R
+++ b/tests/testthat/test-tidy-unquote.R
@@ -2,9 +2,12 @@ context("unquote")
 
 test_that("interpolation does not recurse over spliced arguments", {
   var1 <- quote(!! stop())
+  quo_var1 <- tryCatch(quo(list(!!! var1)), error = identity)
+  expect_false(inherits(quo_var1, "error"))
+
   var2 <- quote({foo; !! stop(); bar})
-  expect_error(quo(list(!!! var1)), NA)
-  expect_error(expr(list(!!! var2)), NA)
+  expr_var2 <- tryCatch(expr(list(!!! var2)), error = identity)
+  expect_false(inherits(expr_var2, "error"))
 })
 
 test_that("formulas containing unquote operators are interpolated", {
@@ -42,8 +45,12 @@ test_that("unquote operators are always in scope", {
 test_that("can interpolate in specific env", {
   foo <- "bar"
   env <- child_env(NULL, foo = "foo")
-  expect_identical(expr_interp(~UQ(foo)), set_env(quo("bar")))
-  expect_identical(expr_interp(~UQ(foo), env), set_env(quo("foo")))
+
+  expanded <- expr_interp(~UQ(foo))
+  expect_identical(expanded, set_env(quo("bar")))
+
+  expanded <- expr_interp(~UQ(foo), env)
+  expect_identical(expanded, set_env(quo("foo")))
 })
 
 test_that("can qualify operators with namespace", {
@@ -88,17 +95,28 @@ test_that("quosures are not rewrapped", {
 })
 
 test_that("UQ() fails if called without argument", {
-  expect_equal(quo(UQ(NULL)), ~NULL)
-  expect_equal(quo(rlang::UQ(NULL)), ~NULL)
-  expect_error(quo(UQ()), "must be called with an argument")
-  expect_error(quo(rlang::UQ()), "must be called with an argument")
+  quo <- quo(UQ(NULL))
+  expect_equal(quo, ~NULL)
+
+  quo <- quo(rlang::UQ(NULL))
+  expect_equal(quo, ~NULL)
+
+  quo <- tryCatch(quo(UQ()), error = identity)
+  expect_is(quo, "error")
+  expect_match(quo$message, "must be called with an argument")
+
+  quo <- tryCatch(quo(rlang::UQ()), error = identity)
+  expect_is(quo, "error")
+  expect_match(quo$message, "must be called with an argument")
 })
 
 
 # UQS ---------------------------------------------------------------------
 
 test_that("contents of UQS() must be a vector or language object", {
-  expect_error(quo(1 + UQS(environment())), "`x` must be a vector")
+  quo <- tryCatch(quo(1 + UQS(environment())), error = identity)
+  expect_is(quo, "error")
+  expect_match(quo$message, "`x` must be a vector")
 })
 
 test_that("values of UQS() spliced into expression", {
@@ -171,10 +189,14 @@ test_that("quosures are created for all informative formulas", {
 # dots_values() ------------------------------------------------------
 
 test_that("can unquote-splice symbols", {
-  expect_identical(ll(!!! list(quote(`_symbol`))), list(quote(`_symbol`)))
+  spliced <- ll(!!! list(quote(`_symbol`)))
+  expect_identical(spliced, list(quote(`_symbol`)))
 })
 
 test_that("can unquote symbols", {
-  expect_identical(dots_values(!! quote(.)), named_list(quote(.)))
-  expect_identical(dots_values(rlang::UQ(quote(.))), named_list(quote(.)))
+  unquoted <- dots_values(!! quote(.))
+  expect_identical(unquoted, named_list(quote(.)))
+
+  unquoted <- dots_values(rlang::UQ(quote(.)))
+  expect_identical(unquoted, named_list(quote(.)))
 })

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-rlang.git



More information about the debian-med-commit mailing list