-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add check for inits named with square brackets #452
Add check for inits named with square brackets #452
Conversation
Ah shoot, silly mistakes in both code and in my procedure for checking the tests passed before submitting this PR. Corrected now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, one suggestion for the error text. But can also leave it and improve the text later.
R/args.R
Outdated
@@ -715,7 +715,9 @@ process_init_list <- function(init, num_procs) { | |||
if (any(sapply(init, function(x) length(x) == 0))) { | |||
stop("'init' contains empty lists.", call. = FALSE) | |||
} | |||
|
|||
if (grepl("\\[",names(unlist(init)))) { | |||
stop("'init' contains entries with parameter names that include square-brackets, which is not permitted. To supply inits for a multi-element parameter, create a single entry with the parameter's name in the init list and use c()/matrix()/etc to specify the values.", call. = FALSE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stop("'init' contains entries with parameter names that include square-brackets, which is not permitted. To supply inits for a multi-element parameter, create a single entry with the parameter's name in the init list and use c()/matrix()/etc to specify the values.", call. = FALSE) | |
stop("'init' contains entries with parameter names that include square-brackets, which is not permitted. To supply inits for a vector, matrix or array of parameters, create a single entry with the parameter's name in the init list and specify init values for the entire parameter container.", call. = FALSE) |
Thanks for fixing this! Also, can you add an entry to the NEWS.md. |
Codecov Report
@@ Coverage Diff @@
## master #452 +/- ##
==========================================
- Coverage 93.17% 92.33% -0.84%
==========================================
Files 12 12
Lines 2871 2832 -39
==========================================
- Hits 2675 2615 -60
- Misses 196 217 +21
Continue to review full report at Codecov.
|
Great! Will merge once tests pass again. |
Addresses #451 (& stan-dev/cmdstan#966)
Submission Checklist
Summary
Please describe the purpose of the pull request.
Copyright and Licensing
Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Michael A. Lawrence
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses: