Skip to content

Confusing compilation error message when variable in Kernel has same name as FieldSet constant #1512

@erikvansebille

Description

@erikvansebille

When a user writes a Kernel with a variable that has the same name as a FieldSet contestant, that throws an unclear error. E.g.

fieldset.add_constant('vertical_speed', 0.1)

 def ArgoVerticalMovement(particle, fieldset, time):
    vertical_speed = fieldset.vertical_speed

Throws an output like

/var/folders/1n/500ln6w97859_nqq86vwpl000000gr/T/parcels-504/982d2e61fa4f6033c50aae39bf44d63b_0.c:73:18: warning: explicitly assigning value of variable of type 'float' to itself [-Wself-assign]
  vertical_speed = vertical_speed;
  ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~

This could be caught in the codeconverter.py with a more elegant and understandable error

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