Skip to content

wrong higher-order function error msg from parser #2578

@yizhang-yiz

Description

@yizhang-yiz

Summary:

Wrong error message with non-existent higher-order function.

Description:

If a higher-order function does not exist, parser error message points to its functor argument instead of the higher-order function itself.

Reproducible Steps:

The following variant of ODE example from the manual, replacing integrate_ode_bdf with non-existent foobar

functions {
real[] sho(real t,        // time
           real[] y,      // state
           real[] theta,  // parameters
           real[] x_r,    // data (real)
           int[] x_i) {   // data (integer)
  real dydt[2];
  dydt[1] = y[2];
  dydt[2] = -y[1] - theta[1] * y[2];
   return dydt;
}
  
}

data {
  int<lower=1> T;
  real y[T*2];
  real t0;
  real ts[T];
}
transformed data {
  real x_r[0];
  int x_i[0]; }
parameters {
  real y0[2];
  vector<lower=0>[2] sigma;
  real theta[1];
}
model {
  real y_hat[T,2];
  sigma ~ cauchy(0, 2.5);
  theta ~ normal(0, 1);
  y0 ~ normal(0, 1);
  y_hat = foobar(sho, y0, t0, ts, theta, x_r,
                             x_i);
  for (t in 1:T)
    y[t] ~ normal(y_hat[t][1], sigma);
  for (t in 1:T)
    y[t+T] ~ normal(y_hat[t][2], sigma);
}

Current Output:

variable "sho" does not exist.

Expected Output:

Function foobar not found.

Additional Information:

Provide any additional information here.

Current Version:

v2.17.1

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