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 backend-*.R files #1556

Merged
merged 11 commits into from
Nov 12, 2024
Merged

use type checkers in backend-*.R files #1556

merged 11 commits into from
Nov 12, 2024

Conversation

simonpcouch
Copy link
Collaborator

Closes #1555. As in #1554, didn't apply checks to arguments that are passed directly to sql_*() functions.

@simonpcouch
Copy link
Collaborator Author

Just confirmed that the postgres GHA failure can be replicated on main—will go ahead and request review.

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

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

This is going to be a very nice improvement to the user experience.

R/backend-mssql.R Show resolved Hide resolved
@@ -333,6 +335,7 @@ simulate_mssql <- function(version = "15.0") {
second = function(x) sql_expr(DATEPART(SECOND, !!x)),

month = function(x, label = FALSE, abbr = TRUE) {
check_bool(label)
Copy link
Member

Choose a reason for hiding this comment

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

I'd be tempted to move the check for check_unsupported_arg() next to this check.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, interesting. I moved that check_unsupported_arg() call to be evaluated unconditionally before realizing that the only allowed value for abbr is FALSE and the default is TRUE. Bringing the check out of if (label) would mean that month(x) would fail by default on SQL server. I opted not to make your suggested change here and will leave this as unresolved for a day or two to give you a chance to reply before merging.

R/backend-mssql.R Show resolved Hide resolved
R/backend-mssql.R Outdated Show resolved Hide resolved
@simonpcouch simonpcouch merged commit d854986 into main Nov 12, 2024
12 of 13 checks passed
@simonpcouch simonpcouch deleted the check-1546 branch November 12, 2024 16:57
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.

Use type checkers
2 participants