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

Can't have variable with upcased name when using arrays #765

Open
med-ayssar opened this issue Apr 24, 2022 · 1 comment · May be fixed by #766
Open

Can't have variable with upcased name when using arrays #765

med-ayssar opened this issue Apr 24, 2022 · 1 comment · May be fixed by #766

Comments

@med-ayssar
Copy link
Contributor

It seems when we have arrays and variables with upcased names, nestml generates the code without any problem, but the code won't compile for the following reasons, but first let's demonstrate the problem.
Again, we start with a simple model that should cause the problem:

neuron names_conflicts:
    state:
      Y_1 real = 42.
      x[N] real = 1.
    end
   
    parameters:
      N integer = 1  # array size
    end   
  end

Here, we have an array x and a double variable named Y_1, and the generated C++ block for the state struct is the following:

 struct State_ {
    enum StateVecVars {
      Y_1 = 0,
      X = 1,
    };
    double Y_1;
    std::vector<double> x;

    State_();
  };

Y_1 was declared twice, first as part of enum and then as double in the same State_ struct, thus the compilation of the code won't be successful, and the compiler throws the following error: ` double names_conflicts::State_::Y_1 conflicts with a previous declaration´.

@med-ayssar
Copy link
Contributor Author

As long as we use arrays, we aren't allowed to use upcased variables names, even for arrays themselves.

@med-ayssar med-ayssar changed the title Can't have variable with upcased name when having arrays Can't have variable with upcased name when using arrays Apr 24, 2022
@clinssen clinssen linked a pull request Apr 24, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant