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

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

Open
steinhh opened this issue Jan 15, 2025 · 0 comments
Open

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

steinhh opened this issue Jan 15, 2025 · 0 comments
Labels
type: feature New feature or request

Comments

@steinhh
Copy link

steinhh commented Jan 15, 2025

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

@steinhh steinhh added the type: feature New feature or request label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant