Skip to content

Recursive includes are not processed #2716

@VMatthijs

Description

@VMatthijs

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions