Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive includes are not processed #2716

Closed
VMatthijs opened this issue Dec 19, 2018 · 2 comments
Closed

Recursive includes are not processed #2716

VMatthijs opened this issue Dec 19, 2018 · 2 comments

Comments

@VMatthijs
Copy link
Member

Summary:

Currently, includes of more than 1 level deep are ignored. This seems impractical.

Description:

Currently, you can include one Stan file a.stan from another b.stan. But we cannot have a.stan includes b.stan includes c.stan. The include of c.stan in b.stan will then be silently ignored by the current parser. At the very least, an error should be thrown if that is the desired behaviour.

Reproducible Steps:

Write file a.stan with content

model {
#include b.stan
}

b.stan with content

int y;
#include c.stan

c.stanwith content

int y;
```.


#### Current Output:
This parses fine.


#### Expected Output:
I would expect an error saying that the variable y is declared twice.


#### Additional Information:
Provide any additional information here.

#### Current Version:
v2.18.0
@VMatthijs VMatthijs added the bug label Dec 19, 2018
@VMatthijs
Copy link
Member Author

VMatthijs commented Dec 19, 2018

Stanc3 fixes this by allowing arbitrary hierarchies of includes. It throws an informative error if a cyclical include structure is detected (e.g. a.stan includes b.stan includes a.stan again).

@rok-cesnovar
Copy link
Member

Fixed in stanc3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants