Skip to content

stanc3 checks data keywords and doesn't allow potential non-data to be passed in. #336

Closed
@wds15

Description

@wds15

When calling the integrate_ode functions inside other functions, then this is prone to over-propagation from data to var for the data arguments. With the old compiler it was possible to sub-select from bigger data structures smaller ones and these then still stay as data (as it should be). The new compiler does not do that. The new compiler does "stronger" over-propagation from data to var which makes the programs fail to compile due to a syntax error.

Attached is a Stan program example which illustrates the problem.

The error message is:

Semantic error in '../stan_pkpd/oral_1cmt_mm/oral_1cmt_mm_run.stan', line 868, column 14 to column 99:
   -------------------------------------------------
   866:      theta_tilde[P+1] = lref[1];
   867:      lref_tilde[1] = lref[2];
   868:      int_sol = integrate_ode(pk_1cmt_mm_lode, lref_tilde, 0, to_array_1d(Dt), theta_tilde, x_r, x_i);//, 1e-4, 1e-4, 1000);
                       ^
   869:      ka = theta[1];
   870:      for(i in 1:num_elements(Dt)) {
   -------------------------------------------------

Ill-typed arguments supplied to function 'integrate_ode'. Available signatures:
((real, real[], real[], data real[], data int[]) => real[], real[], real, real[], real[], data real[], data int[]) => real[,]
Instead supplied arguments of incompatible type: (real, real[], real[], real[], int[]) => real[], real[], int, real[], real[], real[], int[].

I really think this should be fixed ... if possible before the 2.21 release.

stanc3-overpropagate-error.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions