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

Incorrect error message for undeclared struct field #455

Open
raptor-666 opened this issue May 14, 2024 · 1 comment
Open

Incorrect error message for undeclared struct field #455

raptor-666 opened this issue May 14, 2024 · 1 comment

Comments

@raptor-666
Copy link

When using structs in KSP scripts, an error occurs indicating that a struct field has not been declared, even though it has been correctly declared.

Steps to Reproduce:

  1. Create a new script using the following code:
on init
    struct simple_struct
        declare int_var
        declare ~float_var
    end struct

    declare &simple_struct new_structs[2]
    new_structs[0].int_var := 1
    new_structs[0].float_var := -1.0
end on
  1. Run the script in Sublime Text with the SublimeKSP plugin.

Expected Behavior:
The code should execute without errors since the 'float_var' field is correctly declared in the 'simple_struct' struct.

Actual Behavior:
An error is thrown:

new_structs.float_var has not been declared! (line 16)
new_structs(0).float_var := 1.0
main script: 9

Screenshot:
image

Additional Information:
The error occurs only for fields declared with a tilde ('~') when a struct array is declared. Fields declared without a tilde work correctly.

@mkruselj
Copy link
Collaborator

I suppose structs feature was done before we had reals in KSP and so was never adapted to work with them...

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

No branches or pull requests

2 participants