nojanath / SublimeKSP

Fork of Nils Liberg's SublimeKSP plugin. See README for details.
GNU General Public License v3.0
88 stars 18 forks source link

Incorrect error message for undeclared struct field #455

Open raptor-666 opened 4 months ago

raptor-666 commented 4 months ago

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
  2. 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 commented 3 months ago

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