Canonicalizer not working in latest Cmdstan and cmdstanr

Hi all. I recently upgraded to the latest versions of Cmdstan and cmdstanr, and now my canonicalizer is not working. The example gives the following error:

file <- write_stan_file("
parameters {
  real x[2];
}
model {
  x ~ std_normal();
}
")

# set compile=FALSE then call format to fix old syntax
mod <- cmdstan_model(file, compile = FALSE)
mod$format(canonicalize = list("deprecations"))

Syntax error in 'C:/Users/uqnclar2/AppData/Local/Temp/RtmpeccZfw/model_1fc88c86300d78667dd3e476a636c279.stan', line 3, column 8 to column 9, parsing error:
   -------------------------------------------------
     1:  
     2:  parameters {
     3:    real x[2];
                 ^
     4:  }
     5:  model {
   -------------------------------------------------

";" expected after variable declaration.

Error: Syntax error found! See the message above for more information.

My setup is as follows:

> cmdstan_version()
[1] "2.34.0"

> utils::packageVersion('cmdstanr')
[1] ‘0.7.1’

> version
               _                                
platform       x86_64-w64-mingw32               
arch           x86_64                           
os             mingw32                          
crt            ucrt                             
system         x86_64, mingw32                  
status                                          
major          4                                
minor          3.1                              
year           2023                             
month          06                               
day            16                               
svn rev        84548                            
language       R                                
version.string R version 4.3.1 (2023-06-16 ucrt)
nickname       Beagle Scouts 

Thanks very much for any help you can provide

The canonicalizer is only guaranteed to work for one version after a deprecated feature is removed

Ok thanks @WardBrian. I presume the examples will be updated to reflect this?
All the best,
Nick

1 Like