Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use type checkers in fit.R #1182

Merged
merged 3 commits into from
Sep 9, 2024
Merged

use type checkers in fit.R #1182

merged 3 commits into from
Sep 9, 2024

Conversation

simonpcouch
Copy link
Contributor

Closes #1181.🐝

@@ -533,6 +533,21 @@ check_case_weights <- function(x, spec, call = rlang::caller_env()) {
invisible(NULL)
}

# ------------------------------------------------------------------------------

check_inherits <- function(x, cls, arg = caller_arg(x), call = caller_env()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided to write out inher() in favor of this helper. I think we could probably get a good bit of mileage out of this based on the number of if (inherits( in this repo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100%, and the name is much better too!

Copy link
Member

@EmilHvitfeldt EmilHvitfeldt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so happy to see this being done!

R/fit.R Outdated Show resolved Hide resolved
@@ -533,6 +533,21 @@ check_case_weights <- function(x, spec, call = rlang::caller_env()) {
invisible(NULL)
}

# ------------------------------------------------------------------------------

check_inherits <- function(x, cls, arg = caller_arg(x), call = caller_env()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100%, and the name is much better too!

R/fit.R Outdated Show resolved Hide resolved
@simonpcouch simonpcouch merged commit 2872d5e into main Sep 9, 2024
10 checks passed
@simonpcouch simonpcouch deleted the fit-1181 branch September 9, 2024 16:39
Copy link

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

transition to rlang type checkers in fit.R
2 participants