Cannot declare and define an integer array using the colon operator
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 160
- Forks
- 59
- Avg merge
- 21h 45m
- Merged PRs (30d)
- 26
Description
Summary:
It is a parser error to declare and define a one-dimensional integer array using the colon operator.
Description:
It is a parser error to declare and define a one-dimensional integer array using the colon operator.
Reproducible Steps:
Try to parse the following Stan program
data {
int<lower=1> K;
}
transformed data {
int arr[K] = 1:K;
}
Current Output:
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
variable definition dimensions mismatch, definition specifies 1, declaration specifies 0 error in 'model_int_array' at line 5, column 17
-------------------------------------------------
3: }
4: transformed data {
5: int arr[K] = 1:K;
^
6: }
-------------------------------------------------
Error in stanc(model_code = paste(program, collapse = "\n"), model_name = model_cppname, :
failed to parse Stan model 'int_array' due to the above error.
Expected Output:
Nothing. It should assign the integers from 1 to K to arr
Additional Information:
Current Version:
v2.17.0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by parsing the provided Stan program in stanc3 and confirm the reported dimension-mismatch error for int arr[K] = 1:K. Trace the parser or type-checking path that handles the colon expression in this declaration. Done means the program parses successfully and assigns the integers from 1 through K to arr.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100