Repository navigation
Refuse the category names n, ptarget and nn in race models - #594
Merged
Merged
Conversation
brms adds group-level effects in a `for (n in 1:N)` loop and, under threading, declares `ptarget` and `nn` as well, so a race-model category with one of these names passed the name check and then failed in stanc. The three names now join seq, start and end in the shared list, and the race models no longer need to list them themselves.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refuse the category names
n,ptargetandnnin race modelsA follow-up to #499. A race model's custom version turns each response category into a parameter of the generated likelihood, so a category cannot take a name the Stan program already declares. #499 refuses Stan keywords and brms's threading names
seq,startandend. Three more names collide:n: brms adds group-level effects to a parameter in afor (n in 1:N)loop, so a categorynfails in stanc as soon as any parameter has a random effect, with or without threading.ptargetandnn: brms declares them in threaded programs.Before this PR such a category passed the name check and failed in stanc with "Identifier ... is already in use". Now
race_category_names()refuses it with the same message as the other reserved words. Each race model can drop its own copy of these names.Found while cleaning up the race-model PRs (#500, #501, #502): with the name guard switched off, a category
nfailed stanc for both LBA and RDM, threaded or not, andptargetandnnfailed under threading.Changes
R/utils.R:n,ptargetandnnadded to.stan_reserved, with the reason for each.tests/testthat/test-helpers-race.R: three expectations, one per name. They fail without the change.No user-visible change outside the race models, which are not released yet. So there is no NEWS entry.
Checks (local, macOS)
NOT_CRAN=true, Stan tests on, 4 workers): 1917 tests, 0 failed, 0 skipped.Merge order
Merge this before #500, #501 and #502, with a merge commit rather than a squash: each of those branches already contains this commit.