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

Cannot identify variadic functions with @type reflection #7182

Open
Chriscbr opened this issue Sep 30, 2024 · 0 comments
Open

Cannot identify variadic functions with @type reflection #7182

Chriscbr opened this issue Sep 30, 2024 · 0 comments
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler 🎨 sdk SDK

Comments

@Chriscbr
Copy link
Contributor

I tried this:

class Foo {
  pub bar(...xs: Array<num>): num {
    let var total = 0;
    for x in xs {
      total += x;
    }
    return total;
  }
}

let t = @type(Foo);
let cls = t.asClass()!;
log(cls.methods["bar"].child.toString());

This happened:

It prints out

preflight (Array): num

I expected this:

It should print out something like

preflight (...Array<num>): num

I also expected to have some way to see if the function is variadic or not:

assert(cls.methods["bar"].child.asFunction()!.isVariadic == true);

Is there a workaround?

No response

Anything else?

No response

Wing Version

0.85.13

Node.js Version

No response

Platform(s)

No response

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@Chriscbr Chriscbr added 🐛 bug Something isn't working 🎨 sdk SDK 🛠️ compiler Compiler labels Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler 🎨 sdk SDK
Projects
None yet
Development

No branches or pull requests

1 participant