error msg rewrite for illegal/unknown functions/distributions

17 views
Skip to first unread message

Bob Carpenter

unread,
Jun 10, 2015, 4:33:08 PM6/10/15
to stan...@googlegroups.com
At Andrew's urging (we do keep track), I (finally!) rewrote the error
messages so that they line up with how users entered the sampling statement
or function call.

There are four cases: known/unknown function, known/unknown sampling.

1. Unknown, sampling
------------------------------------------

data {
vector[4] x;
}
parameters {
vector[4] theta;
}
model {
x ~ foo_whatev_log(theta);
}

++++++++++++++++

SYNTAX ERROR, MESSAGE(S) FROM PARSER:

No matches for:

vector ~ foo_whatev_log(vector)

Distribution foo_whatev_log not found.

ERROR at line 8

6: }
7: model {
8: x ~ foo_whatev_log(theta);
^
9: }


2. Unknown, function
-----------------------------------------------------------

increment_log_prob(foo_whatev_log(x, theta));

++++++++++++++++++

No matches for:

foo_whatev_log(vector, vector)

Function foo_whatev_log not found.

ERROR at line 8

6: }
7: model {
8: increment_log_prob(foo_whatev_log(x, theta));
^
9: }


3. Known, sampling
-----------------------------------------------------------
Same as before, except:

x ~ bernoulli_logit(theta);

++++++++++++++++++++++

No matches for:

vector ~ bernoulli_logit(vector)

Available argument signatures for bernoulli_logit:

int ~ bernoulli_logit(real)
int ~ bernoulli_logit(real[])
int ~ bernoulli_logit(vector)
int ~ bernoulli_logit(row vector)
int[] ~ bernoulli_logit(real)
int[] ~ bernoulli_logit(real[])
int[] ~ bernoulli_logit(vector)
int[] ~ bernoulli_logit(row vector)

ERROR at line 8

6: }
7: model {
8: x ~ bernoulli_logit(theta);
^
9: }


4. Known, function
---------------------------------------------------------------

increment_log_prob(bernoulli_logit_log(x, theta));

++++++++++

No matches for:

bernoulli_logit_log(vector, vector)

Available argument signatures for bernoulli_logit_log:

bernoulli_logit_log(int, real)
bernoulli_logit_log(int, real[])
bernoulli_logit_log(int, vector)
bernoulli_logit_log(int, row vector)
bernoulli_logit_log(int[], real)
bernoulli_logit_log(int[], real[])
bernoulli_logit_log(int[], vector)
bernoulli_logit_log(int[], row vector)

ERROR at line 8

6: }
7: model {
8: increment_log_prob(bernoulli_logit_log(x, theta));
^
9: }


Next up in a separate issue, I'm going to try to convert errors with
"multiply(a,b)" back to "a * b" syntax if that's what the user input.

- Bob

Reply all
Reply to author
Forward
0 new messages