Skip to content

Commit 26acd24

Browse files
committed
A few more edge cases
1 parent b94d8f2 commit 26acd24

File tree

8 files changed

+47
-4
lines changed

8 files changed

+47
-4
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
functions {
2-
real gen(real parameters) {
2+
real gen(real true) {
33
return 1;
44
}
55
}

test/integration/bad/lang/stanc.expected

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,28 @@ Semantic error in 'reused_name.stan', line 4, column 14 to column 15:
511511
-------------------------------------------------
512512

513513
Identifier 'e' is already in use.
514+
[exit 1]
515+
$ ../../../../../install/default/bin/stanc tparam_array_int.stan
516+
Semantic error in 'tparam_array_int.stan', line 2, column 2 to column 21:
517+
-------------------------------------------------
518+
1: transformed parameters {
519+
2: array[1,2,3] int x;
520+
^
521+
3: }
522+
-------------------------------------------------
523+
524+
(Transformed) Parameters cannot be integers.
525+
[exit 1]
526+
$ ../../../../../install/default/bin/stanc tparam_tuple_int.stan
527+
Semantic error in 'tparam_tuple_int.stan', line 2, column 2 to column 21:
528+
-------------------------------------------------
529+
1: transformed parameters {
530+
2: tuple(real, int) x;
531+
^
532+
3: }
533+
-------------------------------------------------
534+
535+
(Transformed) Parameters cannot be integers.
514536
[exit 1]
515537
$ ../../../../../install/default/bin/stanc unterminated_comment.stan
516538
Syntax error in 'unterminated_comment.stan', line 4, column -1, lexing error:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
transformed parameters {
2+
array[1,2,3] int x;
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
transformed parameters {
2+
tuple(real, int) x;
3+
}

test/integration/bad/stanc.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,16 +1657,16 @@ Semantic error in 'functions-bad30.stan', line 2, column 7 to column 16:
16571657
Identifier 'generated' clashes with reserved keyword.
16581658
[exit 1]
16591659
$ ../../../../install/default/bin/stanc functions-bad31.stan
1660-
Syntax error in 'functions-bad31.stan', line 2, column 16 to column 26, parsing error:
1660+
Semantic error in 'functions-bad31.stan', line 2, column 16 to column 20:
16611661
-------------------------------------------------
16621662
1: functions {
1663-
2: real gen(real parameters) {
1663+
2: real gen(real true) {
16641664
^
16651665
3: return 1;
16661666
4: }
16671667
-------------------------------------------------
16681668

1669-
Expected a new identifier but found reserved keyword 'parameters'.
1669+
Identifier 'true' clashes with reserved keyword.
16701670
[exit 1]
16711671
$ ../../../../install/default/bin/stanc functions-bad32.stan
16721672
Semantic error in 'functions-bad32.stan', line 9, column 8 to column 14:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
data {
2+
int N;
3+
int M;
4+
vector[N %/% M] x;
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"M": 0
3+
}

test/integration/cli-args/debug-generation.t/run.t

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ Don't provide _enough_ data
1717
Error in 'debug.stan', line 8, column 10 to column 25:
1818
Cannot evaluate expression: (((14 + N) + 1) + x.1)
1919
[1]
20+
21+
Bad data block, cannot be partially evaluated
22+
23+
$ stanc --debug-generate-data div0.stan --debug-data-file partial-div0.json
24+
Error in 'div0.stan', line 4, column 9 to column 16:
25+
Integer division by zero
26+
[1]

0 commit comments

Comments
 (0)