Skip to content

Handle mean(a,b) under R's startsWith() - #6291

Merged
MichaelChirico merged 3 commits into
masterfrom
optmean-dots
Jul 17, 2024
Merged

MichaelChirico merged 3 commits into
masterfrom
optmean-dots

Conversation

@MichaelChirico

@MichaelChirico MichaelChirico commented Jul 17, 2024 •

Copy link
Copy Markdown
Member

Part of #6284

We used to have a backport:

startsWith = function(x, stub) substr(x, 1L, nchar(stub))==stub

substr() coerces its argument to character, but base::startsWith() does not, hence the change in behavior. Anyway, the use of startsWith() was still error-prone; this PR adds further robustness checks as well.

Confirmed the test fails on master, passes on branch. Also confirmed that as.character() is not sufficient -- without isTRUE(), the same test errors as "missing value where TRUE/FALSE needed".

Also checked all other startsWith() call sites to be sure none of them might have silently been accepting non-character input.

@github-actions

github-actions Bot commented Jul 17, 2024 •

Copy link
Copy Markdown

Comparison Plot

Generated via commit a89f2e9

Download link for the artifact containing the test results: ↓ atime-results.zip

Time taken to finish the standard R installation steps: 12 minutes and 17 seconds

Time taken to run atime::atime_pkg on the tests: 3 minutes and 43 seconds

@tdhock

tdhock commented Jul 17, 2024

Copy link
Copy Markdown
Member

nice work thanks! please add NEWS item.

@MichaelChirico

Copy link
Copy Markdown
Member Author

We are just restoring a behavior present on CRAN, so no NEWS. i.e. #6232 is a regression in dev that we've fixed.

@MichaelChirico
MichaelChirico merged commit ff808ae into master Jul 17, 2024
@MichaelChirico
MichaelChirico deleted the optmean-dots branch July 17, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants