Skip to content

Cannot identify variadic functions with @type reflection #7182

Open
@Chriscbr

Description

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.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions