Skip to content

[Feature]: Update variable type dynamically when reassigning #64

Description

@steinhh

Description

This makes the plugin report test as returning a hash:

FUNCTION test
  a = hash()
  a = (a.keys()).toArray()
  arr = (a.keys()).toArray()
  return, a
END

The plugin knows what's going on with the calls to .keys() and .toArray() though, b/c if you change the last line to

  return, arr

then the function is reported as returning an array. I realise it may be tricky from a parsing perspective, but it would be nice if types could be updated upon reassignments.

Why it Matters

Reassignments should update the type info for a variable, as it is not uncommon to e.g., reuse the same variable name after changing the type. But consider this a "weak" feature request, the workaround using a new variable name is semi-obvious.

Suggested Behavior

In the example above, the type of variable a should be changed during the reassignment.

Alternate Behavior

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions