Skip to content

Commit c9a750e

Browse files
authored
Merge pull request #61 from t-kalinowski/fix/r-devel
Fix R-devel check failures after `R_typeToChar` relocation and deprecation.
2 parents bdd7018 + 902b7eb commit c9a750e

19 files changed

Lines changed: 121 additions & 117 deletions

AGENTS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ This project is an R package that transpiles R functions to Fortran.
33

44
- To run the full test suite:
55
```sh
6-
R -q -e 'testthat::test_local()'
6+
R -q -e 'devtools::test()'
77
```
88

99
- To run a single test file:
@@ -22,4 +22,8 @@ r2f(function(x) {
2222
EOF
2323
```
2424

25+
- When running tests and snapshots need to be updated, use this workflow:
26+
- `R -q -e 'testthat::set_max_fails(Inf); devtools::test(); testthat::snapshot_accept()'`
27+
- Afterwards always review diffs of updated snapshots to confirm they match expectations.
28+
2529
- Never disable or skip tests.

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ Config/testthat/parallel: true
3131
Config/testthat/start-first: unary-intrinsics, loops
3232
Encoding: UTF-8
3333
Roxygen: list(markdown = TRUE)
34-
RoxygenNote: 7.3.2
34+
RoxygenNote: 7.3.3

R/c-wrapper.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ closure_arg_c_defs <- function(var, strict = TRUE) {
158158
if (strict) {
159159
glue(
160160
r"(
161-
Rf_error("typeof({name}) must be '{mode}', not '%s'", R_typeToChar({name}));
161+
Rf_error("typeof({name}) must be '{mode}', not '%s'", Rf_type2char(TYPEOF({name})));
162162
)"
163163
)
164164
} else {

tests/testthat/_snaps/add.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
_args = CDR(_args);
4343
SEXP x = CAR(_args);
4444
if (TYPEOF(x) != REALSXP) {
45-
Rf_error("typeof(x) must be 'double', not '%s'", R_typeToChar(x));
45+
Rf_error("typeof(x) must be 'double', not '%s'", Rf_type2char(TYPEOF(x)));
4646
}
4747
x = Rf_duplicate(x);
4848
SETCAR(_args, x);
@@ -105,7 +105,7 @@
105105
_args = CDR(_args);
106106
SEXP x = CAR(_args);
107107
if (TYPEOF(x) != INTSXP) {
108-
Rf_error("typeof(x) must be 'integer', not '%s'", R_typeToChar(x));
108+
Rf_error("typeof(x) must be 'integer', not '%s'", Rf_type2char(TYPEOF(x)));
109109
}
110110
const int* const x__ = INTEGER(x);
111111
const R_xlen_t x__len_ = Rf_xlength(x);
@@ -114,7 +114,7 @@
114114
_args = CDR(_args);
115115
SEXP y = CAR(_args);
116116
if (TYPEOF(y) != INTSXP) {
117-
Rf_error("typeof(y) must be 'integer', not '%s'", R_typeToChar(y));
117+
Rf_error("typeof(y) must be 'integer', not '%s'", Rf_type2char(TYPEOF(y)));
118118
}
119119
const int* const y__ = INTEGER(y);
120120
const R_xlen_t y__len_ = Rf_xlength(y);

tests/testthat/_snaps/dims2f.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
_args = CDR(_args);
4848
SEXP n = CAR(_args);
4949
if (TYPEOF(n) != INTSXP) {
50-
Rf_error("typeof(n) must be 'integer', not '%s'", R_typeToChar(n));
50+
Rf_error("typeof(n) must be 'integer', not '%s'", Rf_type2char(TYPEOF(n)));
5151
}
5252
const int* const n__ = INTEGER(n);
5353
const R_xlen_t n__len_ = Rf_xlength(n);
@@ -111,7 +111,7 @@
111111
_args = CDR(_args);
112112
SEXP n = CAR(_args);
113113
if (TYPEOF(n) != INTSXP) {
114-
Rf_error("typeof(n) must be 'integer', not '%s'", R_typeToChar(n));
114+
Rf_error("typeof(n) must be 'integer', not '%s'", Rf_type2char(TYPEOF(n)));
115115
}
116116
const int* const n__ = INTEGER(n);
117117
const R_xlen_t n__len_ = Rf_xlength(n);
@@ -175,7 +175,7 @@
175175
_args = CDR(_args);
176176
SEXP n = CAR(_args);
177177
if (TYPEOF(n) != INTSXP) {
178-
Rf_error("typeof(n) must be 'integer', not '%s'", R_typeToChar(n));
178+
Rf_error("typeof(n) must be 'integer', not '%s'", Rf_type2char(TYPEOF(n)));
179179
}
180180
const int* const n__ = INTEGER(n);
181181
const R_xlen_t n__len_ = Rf_xlength(n);

tests/testthat/_snaps/div-cast.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
_args = CDR(_args);
4848
SEXP a = CAR(_args);
4949
if (TYPEOF(a) != INTSXP) {
50-
Rf_error("typeof(a) must be 'integer', not '%s'", R_typeToChar(a));
50+
Rf_error("typeof(a) must be 'integer', not '%s'", Rf_type2char(TYPEOF(a)));
5151
}
5252
const int* const a__ = INTEGER(a);
5353
const R_xlen_t a__len_ = Rf_xlength(a);
@@ -56,7 +56,7 @@
5656
_args = CDR(_args);
5757
SEXP b = CAR(_args);
5858
if (TYPEOF(b) != INTSXP) {
59-
Rf_error("typeof(b) must be 'integer', not '%s'", R_typeToChar(b));
59+
Rf_error("typeof(b) must be 'integer', not '%s'", Rf_type2char(TYPEOF(b)));
6060
}
6161
const int* const b__ = INTEGER(b);
6262
const R_xlen_t b__len_ = Rf_xlength(b);
@@ -128,7 +128,7 @@
128128
_args = CDR(_args);
129129
SEXP a = CAR(_args);
130130
if (TYPEOF(a) != REALSXP) {
131-
Rf_error("typeof(a) must be 'double', not '%s'", R_typeToChar(a));
131+
Rf_error("typeof(a) must be 'double', not '%s'", Rf_type2char(TYPEOF(a)));
132132
}
133133
const double* const a__ = REAL(a);
134134
const R_xlen_t a__len_ = Rf_xlength(a);
@@ -137,7 +137,7 @@
137137
_args = CDR(_args);
138138
SEXP b = CAR(_args);
139139
if (TYPEOF(b) != INTSXP) {
140-
Rf_error("typeof(b) must be 'integer', not '%s'", R_typeToChar(b));
140+
Rf_error("typeof(b) must be 'integer', not '%s'", Rf_type2char(TYPEOF(b)));
141141
}
142142
const int* const b__ = INTEGER(b);
143143
const R_xlen_t b__len_ = Rf_xlength(b);
@@ -209,7 +209,7 @@
209209
_args = CDR(_args);
210210
SEXP a = CAR(_args);
211211
if (TYPEOF(a) != REALSXP) {
212-
Rf_error("typeof(a) must be 'double', not '%s'", R_typeToChar(a));
212+
Rf_error("typeof(a) must be 'double', not '%s'", Rf_type2char(TYPEOF(a)));
213213
}
214214
const double* const a__ = REAL(a);
215215
const R_xlen_t a__len_ = Rf_xlength(a);
@@ -218,7 +218,7 @@
218218
_args = CDR(_args);
219219
SEXP b = CAR(_args);
220220
if (TYPEOF(b) != LGLSXP) {
221-
Rf_error("typeof(b) must be 'logical', not '%s'", R_typeToChar(b));
221+
Rf_error("typeof(b) must be 'logical', not '%s'", Rf_type2char(TYPEOF(b)));
222222
}
223223
const int* const b__ = LOGICAL(b);
224224
const R_xlen_t b__len_ = Rf_xlength(b);
@@ -290,7 +290,7 @@
290290
_args = CDR(_args);
291291
SEXP a = CAR(_args);
292292
if (TYPEOF(a) != CPLXSXP) {
293-
Rf_error("typeof(a) must be 'complex', not '%s'", R_typeToChar(a));
293+
Rf_error("typeof(a) must be 'complex', not '%s'", Rf_type2char(TYPEOF(a)));
294294
}
295295
const Rcomplex* const a__ = COMPLEX(a);
296296
const R_xlen_t a__len_ = Rf_xlength(a);
@@ -299,7 +299,7 @@
299299
_args = CDR(_args);
300300
SEXP b = CAR(_args);
301301
if (TYPEOF(b) != CPLXSXP) {
302-
Rf_error("typeof(b) must be 'complex', not '%s'", R_typeToChar(b));
302+
Rf_error("typeof(b) must be 'complex', not '%s'", Rf_type2char(TYPEOF(b)));
303303
}
304304
const Rcomplex* const b__ = COMPLEX(b);
305305
const R_xlen_t b__len_ = Rf_xlength(b);
@@ -370,7 +370,7 @@
370370
_args = CDR(_args);
371371
SEXP x = CAR(_args);
372372
if (TYPEOF(x) != REALSXP) {
373-
Rf_error("typeof(x) must be 'double', not '%s'", R_typeToChar(x));
373+
Rf_error("typeof(x) must be 'double', not '%s'", Rf_type2char(TYPEOF(x)));
374374
}
375375
const double* const x__ = REAL(x);
376376
const R_xlen_t x__len_ = Rf_xlength(x);

tests/testthat/_snaps/div-mod.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
_args = CDR(_args);
4848
SEXP a = CAR(_args);
4949
if (TYPEOF(a) != REALSXP) {
50-
Rf_error("typeof(a) must be 'double', not '%s'", R_typeToChar(a));
50+
Rf_error("typeof(a) must be 'double', not '%s'", Rf_type2char(TYPEOF(a)));
5151
}
5252
const double* const a__ = REAL(a);
5353
const R_xlen_t a__len_ = Rf_xlength(a);
@@ -56,7 +56,7 @@
5656
_args = CDR(_args);
5757
SEXP b = CAR(_args);
5858
if (TYPEOF(b) != REALSXP) {
59-
Rf_error("typeof(b) must be 'double', not '%s'", R_typeToChar(b));
59+
Rf_error("typeof(b) must be 'double', not '%s'", Rf_type2char(TYPEOF(b)));
6060
}
6161
const double* const b__ = REAL(b);
6262
const R_xlen_t b__len_ = Rf_xlength(b);
@@ -128,7 +128,7 @@
128128
_args = CDR(_args);
129129
SEXP a = CAR(_args);
130130
if (TYPEOF(a) != REALSXP) {
131-
Rf_error("typeof(a) must be 'double', not '%s'", R_typeToChar(a));
131+
Rf_error("typeof(a) must be 'double', not '%s'", Rf_type2char(TYPEOF(a)));
132132
}
133133
const double* const a__ = REAL(a);
134134
const R_xlen_t a__len_ = Rf_xlength(a);
@@ -137,7 +137,7 @@
137137
_args = CDR(_args);
138138
SEXP b = CAR(_args);
139139
if (TYPEOF(b) != REALSXP) {
140-
Rf_error("typeof(b) must be 'double', not '%s'", R_typeToChar(b));
140+
Rf_error("typeof(b) must be 'double', not '%s'", Rf_type2char(TYPEOF(b)));
141141
}
142142
const double* const b__ = REAL(b);
143143
const R_xlen_t b__len_ = Rf_xlength(b);

tests/testthat/_snaps/example-convolve.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
_args = CDR(_args);
6868
SEXP a = CAR(_args);
6969
if (TYPEOF(a) != REALSXP) {
70-
Rf_error("typeof(a) must be 'double', not '%s'", R_typeToChar(a));
70+
Rf_error("typeof(a) must be 'double', not '%s'", Rf_type2char(TYPEOF(a)));
7171
}
7272
const double* const a__ = REAL(a);
7373
const R_xlen_t a__len_ = Rf_xlength(a);
@@ -76,7 +76,7 @@
7676
_args = CDR(_args);
7777
SEXP b = CAR(_args);
7878
if (TYPEOF(b) != REALSXP) {
79-
Rf_error("typeof(b) must be 'double', not '%s'", R_typeToChar(b));
79+
Rf_error("typeof(b) must be 'double', not '%s'", Rf_type2char(TYPEOF(b)));
8080
}
8181
const double* const b__ = REAL(b);
8282
const R_xlen_t b__len_ = Rf_xlength(b);

tests/testthat/_snaps/example-heat_diffusion.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
_args = CDR(_args);
139139
SEXP nx = CAR(_args);
140140
if (TYPEOF(nx) != INTSXP) {
141-
Rf_error("typeof(nx) must be 'integer', not '%s'", R_typeToChar(nx));
141+
Rf_error("typeof(nx) must be 'integer', not '%s'", Rf_type2char(TYPEOF(nx)));
142142
}
143143
const int* const nx__ = INTEGER(nx);
144144
const R_xlen_t nx__len_ = Rf_xlength(nx);
@@ -147,7 +147,7 @@
147147
_args = CDR(_args);
148148
SEXP ny = CAR(_args);
149149
if (TYPEOF(ny) != INTSXP) {
150-
Rf_error("typeof(ny) must be 'integer', not '%s'", R_typeToChar(ny));
150+
Rf_error("typeof(ny) must be 'integer', not '%s'", Rf_type2char(TYPEOF(ny)));
151151
}
152152
const int* const ny__ = INTEGER(ny);
153153
const R_xlen_t ny__len_ = Rf_xlength(ny);
@@ -156,7 +156,7 @@
156156
_args = CDR(_args);
157157
SEXP dx = CAR(_args);
158158
if (TYPEOF(dx) != INTSXP) {
159-
Rf_error("typeof(dx) must be 'integer', not '%s'", R_typeToChar(dx));
159+
Rf_error("typeof(dx) must be 'integer', not '%s'", Rf_type2char(TYPEOF(dx)));
160160
}
161161
const int* const dx__ = INTEGER(dx);
162162
const R_xlen_t dx__len_ = Rf_xlength(dx);
@@ -165,7 +165,7 @@
165165
_args = CDR(_args);
166166
SEXP dy = CAR(_args);
167167
if (TYPEOF(dy) != INTSXP) {
168-
Rf_error("typeof(dy) must be 'integer', not '%s'", R_typeToChar(dy));
168+
Rf_error("typeof(dy) must be 'integer', not '%s'", Rf_type2char(TYPEOF(dy)));
169169
}
170170
const int* const dy__ = INTEGER(dy);
171171
const R_xlen_t dy__len_ = Rf_xlength(dy);
@@ -174,7 +174,7 @@
174174
_args = CDR(_args);
175175
SEXP dt = CAR(_args);
176176
if (TYPEOF(dt) != REALSXP) {
177-
Rf_error("typeof(dt) must be 'double', not '%s'", R_typeToChar(dt));
177+
Rf_error("typeof(dt) must be 'double', not '%s'", Rf_type2char(TYPEOF(dt)));
178178
}
179179
const double* const dt__ = REAL(dt);
180180
const R_xlen_t dt__len_ = Rf_xlength(dt);
@@ -183,7 +183,7 @@
183183
_args = CDR(_args);
184184
SEXP k = CAR(_args);
185185
if (TYPEOF(k) != REALSXP) {
186-
Rf_error("typeof(k) must be 'double', not '%s'", R_typeToChar(k));
186+
Rf_error("typeof(k) must be 'double', not '%s'", Rf_type2char(TYPEOF(k)));
187187
}
188188
const double* const k__ = REAL(k);
189189
const R_xlen_t k__len_ = Rf_xlength(k);
@@ -192,7 +192,7 @@
192192
_args = CDR(_args);
193193
SEXP steps = CAR(_args);
194194
if (TYPEOF(steps) != INTSXP) {
195-
Rf_error("typeof(steps) must be 'integer', not '%s'", R_typeToChar(steps));
195+
Rf_error("typeof(steps) must be 'integer', not '%s'", Rf_type2char(TYPEOF(steps)));
196196
}
197197
const int* const steps__ = INTEGER(steps);
198198
const R_xlen_t steps__len_ = Rf_xlength(steps);

tests/testthat/_snaps/example-roll_mean.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
_args = CDR(_args);
7676
SEXP x = CAR(_args);
7777
if (TYPEOF(x) != REALSXP) {
78-
Rf_error("typeof(x) must be 'double', not '%s'", R_typeToChar(x));
78+
Rf_error("typeof(x) must be 'double', not '%s'", Rf_type2char(TYPEOF(x)));
7979
}
8080
const double* const x__ = REAL(x);
8181
const R_xlen_t x__len_ = Rf_xlength(x);
@@ -84,7 +84,7 @@
8484
_args = CDR(_args);
8585
SEXP weights = CAR(_args);
8686
if (TYPEOF(weights) != REALSXP) {
87-
Rf_error("typeof(weights) must be 'double', not '%s'", R_typeToChar(weights));
87+
Rf_error("typeof(weights) must be 'double', not '%s'", Rf_type2char(TYPEOF(weights)));
8888
}
8989
weights = Rf_duplicate(weights);
9090
SETCAR(_args, weights);
@@ -95,7 +95,7 @@
9595
_args = CDR(_args);
9696
SEXP normalize = CAR(_args);
9797
if (TYPEOF(normalize) != LGLSXP) {
98-
Rf_error("typeof(normalize) must be 'logical', not '%s'", R_typeToChar(normalize));
98+
Rf_error("typeof(normalize) must be 'logical', not '%s'", Rf_type2char(TYPEOF(normalize)));
9999
}
100100
const int* const normalize__ = LOGICAL(normalize);
101101
const R_xlen_t normalize__len_ = Rf_xlength(normalize);

0 commit comments

Comments
 (0)