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

fix: MultiReturn unpacking with get accessors is broken #1542

Open
Z3rio opened this issue Mar 1, 2024 · 0 comments
Open

fix: MultiReturn unpacking with get accessors is broken #1542

Z3rio opened this issue Mar 1, 2024 · 0 comments

Comments

@Z3rio
Copy link
Contributor

Z3rio commented Mar 1, 2024

Introduction / Explenation

Upon running the example below, you'll quickly realize that the getter function errors, whereas the normal function does not.
Even though they consist of the same code.

The issue seems to be with unwrapping return values in class getters.

What should happen instead?

I think most of us would simply expect both these code snippets to work the exact same, aka to unwrap the return values without any issues.

Reproduction

Code

class TestClass {
  public get Test1(): LuaMultiReturn<[number, number]>{
    return $multi(0, 0);
  }

  public Test2(): LuaMultiReturn<[number, number]>{
    return $multi(0, 0);
  }

  public showcaseIssue(): void {
    const [a, b] = this.Test2();
    console.log(a,b)
    const [c, d] = this.Test1;
    console.log(c,d)
  }
}

const a = new TestClass();
a.showcaseIssue()

Playground Link

Click here

@Perryvw Perryvw changed the title fix: retval unpacking in class getters are broken fix: MultiReturn unpacking with get accessors are broken Mar 1, 2024
@Perryvw Perryvw changed the title fix: MultiReturn unpacking with get accessors are broken fix: MultiReturn unpacking with get accessors is broken Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant