Skip to content

declare and define does not work at the top of a block without curly braces #2610

Closed
stan-dev/stanc3
#1207
@bgoodri

Description

@bgoodri

Summary:

Declare and define does not work at the top of a block without curly braces.

Description:

There is a parser error if you attempt to declare and define does not work at the top of a block without curly braces.

Reproducible Steps:

Parse this

functions {
  real foo() {
    if (1)
      real this_does_not_parse = 0;
    return 0;
  }
}

Current Output:

SYNTAX ERROR, MESSAGE(S) FROM PARSER:

Unknown variable: real
variable "real" does not exist.
  error in 'model_parser' at line 4, column 11
  -------------------------------------------------
     2:   real foo() {
     3:     if (1)
     4:       real this_does_not_parse = 0;
                  ^
     5:     return 0;
  -------------------------------------------------

Expected Output:

Nothing

Additional Information:

None

Current Version:

v2.18.0

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