Skip to content

Commit 9e055d0

Browse files
committed
Merge branch 'master' into assignment-promotion
2 parents 59f0c9c + df606ed commit 9e055d0

7 files changed

Lines changed: 92 additions & 1 deletion

File tree

RELEASE-NOTES.txt

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,65 @@
11
STANC3 RELEASE NOTES
22
======================================================================
33

4+
v2.29.0 (14 February 2022)
5+
======================================================================
6+
7+
FEATURES
8+
- Allow most reserved words in C++ (e.g., `public`) to appear in a stan program; they will be changed by the compiler to `_stan_<reserved word>` in the generated C++. (#962)
9+
- User defined functions can now be overloaded. Multiple definitions of the same function name are allowed if the arguments are different in each definition.(#1027)
10+
- Improved error messages for incorrect variable declarations. (#1099)
11+
- When an unknown identifier is encountered Stan will suggest nearby known names you might have meant (#1024)
12+
- Extra semicolons in `data` or `parameters` no longer produce syntax errors. (#988)
13+
- Improved error messages for incomplete probability library calls. (#1021)
14+
- Added nicer error message when a comment is unterminated at end of input. (#1025)
15+
- All internal compiler errors now include a link to the stanc3 issues page. (#1028)
16+
- Improve error messages when a user tries to declare a function argument as a constrained type. (#1030)
17+
- Replaced the use of the word twiddle with tilde in pedantic warning messages. (#1050)
18+
- Allow user-defined densities over complex arguments and deeply nested arguments. (#1046)
19+
- Added optimization layers `--O0` (default), `--O1`, and `--Oexperimental`
20+
- Turn back on allowing immediately assigned to decls not be NaN initialized at `O1` (#1029)
21+
- Allows `log_prob_impl` to use Struct of Arrays type for reverse mode autodiff at `O1` (#955)
22+
- Issue a warning when a user has a model with unreachable statements, such as code following a `return` statement. (#1063)
23+
- The compiler can now compile or format standalone function definitions in a `.stanfunctions` file. These are compiled as if a normal Stan program was compiled with `stanc3 --standalone-functions` and can be used with `#include` statements in the `functions` block (#1022)
24+
- The canonicalizer can now have each part enabled seperately. This can be done with commands like `stanc --auto-format --canonicalize=braces,deprecations <model>`. Current options are `deprecations`, `braces`, and `parenthesis`. (#1058)
25+
- Ensure the canonicalizer properly prints nested if-else statements. (#1055)
26+
- `--auto-format` no longer prints code which originated from an `#include` directive. This can be re-enabled by using `canonicalize=includes`. (#1069)
27+
- When using `--auto-format`, the user can now pass `--max-line-length=#` to set the column number at which the formatter will try to break lines. (#1068)
28+
- Tweak pretty-printing of if-else blocks. (#1008)
29+
- Canonicalizer now adds brackets around single statements in if-else/for/while. (#1003)
30+
- Expose `bernoulli_logit_glm_rng` functions. (#1034)
31+
- lchoose now has the same signatures as binomial_coefficient_log. (#1010)
32+
- Added `ordered_probit_lpmf(array[] int, real, vector) => real` and `ordered_probit_lpmf(array[] int, real, array[] vector) => real`. (#1073)
33+
- Added additional `normal_id_glm` signatures. (#1084)
34+
- Added signatures for `inv_erfc` function. (#1090)
35+
- Added Differential-Algebraic Equation solver (`dae`, `dae_tol`). (#1092)
36+
- Added `von_mises_cdf`, `von_mises_lcdf`, von_mises_lccdf`. (#1085)
37+
- Added `loglogistic_lpdf`, `loglogistic_log`, `loglogistic_rng` and `loglogistic_cdf`. (#1094)
38+
- Clean up more mutable state in the Javascript interface (#1118)
39+
40+
DEPRECATIONS
41+
- Added a warning for `matrix^scalar` that points users to `.^` and `matrix_power()`. (#1026)
42+
- Warn about the following identifiers being reserved in a future version: `array`, `upper`, `lower`, `offset`, `multiplier`. (#1048)
43+
- The old form of declaring arrays like `real a[5]`, which has been deprecated since 2.26, now issues a warning. (#1072)
44+
- Marked existing syntax deprecations (e.g., `<-`) as expiring in Stan 2.32.0. (#1044)
45+
- Deprecate nested multi-indexing on lvalues as it is inconsistent with rvalues.(#1059)
46+
47+
BUGFIXES
48+
- Fixed an issue that arose during C++ compilation of models that used a variable with the same name as a Stan library function and called that function. (#1011)
49+
- Fixed a bug where the lexer was allowing illegal variable names which began with an underscore. (#962)
50+
- Fixed an issue with parser errors 'sticking around' on subsequent runs, which primarily affected the Javascript compiler. (#1074)
51+
52+
DEVELOPER
53+
- Updated OCaml and build dependencies. (#1019)
54+
- Create internal developer documentation at https://mc-stan.org/stanc3/stanc/. (#1006)
55+
- stan2tfp now lives in a seperate repo at stan-dev/stan2tfp. (#1040)
56+
- Refactored Stan typechecker. (#995)
57+
- Replaces all references to Docker Hub for andrjohns images with stanorg. (#1017)
58+
- Move docker to ci-scripts repository. (#1020)
59+
- Refactored when logic for binaries builds and release. (#1018)
60+
- Added optimization level flags, debug-* and dump-math-signatures flags to stancjs. (#1082)
61+
- Compile Tests and Model end-to-end tests run now optionally only when test/integration/good has changed. (#1018)
62+
463
v2.28.1 (21 October 2021)
564
======================================================================
665

src/frontend/Preprocessor.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ let included_files : string list ref = ref []
1616
let size () = Stack.length include_stack
1717

1818
let init buf =
19+
included_files := [] ;
1920
Stack.clear include_stack ;
2021
Stack.push include_stack buf
2122

src/frontend/Typechecker.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,6 +1673,7 @@ let check_program_exn
16731673
; modelblock= mb
16741674
; generatedquantitiesblock= gqb
16751675
; comments } as ast ) =
1676+
warnings := [] ;
16761677
(* create a new type environment which has only stan-math functions *)
16771678
let tenv = Env.create () in
16781679
let tenv, typed_fb = check_toplevel_block Functions tenv fb in

src/stan_math_backend/Stan_math_code_gen.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,7 @@ let collect_functors_functions p =
10301030

10311031
(** Print the full C++ for the stan program. *)
10321032
let pp_prog ppf (p : Program.Typed.t) =
1033+
Hashtbl.clear Expression_gen.map_rect_calls ;
10331034
(* First, do some transformations on the MIR itself before we begin printing it.*)
10341035
let p, s = Locations.prepare_prog p in
10351036
let fns_str, functors = collect_functors_functions p in

src/stancjs/stancjs.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ let warn_uninitialized_msgs (uninit_vars : (Location_span.t * string) Set.Poly.t
2020
Set.Poly.(to_list (map filtered_uninit_vars ~f:show_var_info))
2121

2222
let stan2cpp model_name model_string is_flag_set flag_val =
23+
Common.Gensym.reset_danger_use_cautiously () ;
2324
Typechecker.model_name := model_name ;
2425
Typechecker.check_that_all_functions_have_definition :=
2526
not (is_flag_set "allow_undefined" || is_flag_set "allow-undefined") ;

test/stancjs/stancjs.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,4 @@ $ node version.js
200200
%%NAME%% %%VERSION%%
201201
$ node warnings.js
202202
["Warning in 'string', line 4, column 4: Comments beginning with # are\n deprecated and this syntax will be removed in Stan 2.32.0. Use // to\n begin line comments; this can be done automatically using the auto-format\n flag to stanc"]
203+
["Warning in 'string', line 10, column 11: Found int division:\n x / w\n Values will be rounded towards zero. If rounding is not desired you can\n write\n the division as\n x * 1.0 / w\n If rounding is intended please use the integer division operator %/%."]

test/stancjs/warnings.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,31 @@ model {
2929
increment_log_prob(5.0);
3030
}
3131
`
32-
var test_no_stderr = stanc.stanc("no_stderr", test_no_stderr_model, ["warn-uninitialized"]);
32+
var test_no_stderr = stanc.stanc("no_stderr", test_no_stderr_model, ["warn-uninitialized"]);
33+
34+
35+
var tc_warn = `
36+
parameters {
37+
real y;
38+
}
39+
model {
40+
y ~ normal(0,1);
41+
}
42+
generated quantities {
43+
int x, w;
44+
int z = x / w;
45+
}
46+
`
47+
var typechecker_test = stanc.stanc("deprecated", tc_warn);
48+
console.log(JSON.stringify(typechecker_test.warnings))
49+
50+
var tc_no_warn = `
51+
parameters {
52+
real y;
53+
}
54+
model {
55+
y ~ normal(0,1);
56+
}
57+
`
58+
var typechecker_test2 = stanc.stanc("deprecated", tc_no_warn);
59+
console.assert(typechecker_test2.warnings.length == 0, "Typechecker remembered a warning!")

0 commit comments

Comments
 (0)