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

[bug] Resource referring to self in params or results causes a stack overflow #77

Open
JonasKruckenberg opened this issue Mar 13, 2023 · 0 comments

Comments

@JonasKruckenberg
Copy link
Contributor

When referring to self i.e. the current resource from a method parameter or result then this causes a stack overflow in the type resolver. The issue is caused by not having the resource name cached when we first encounter it and since it's a recursive reference we spin into a stack overflow.

Reproduction

interface foo {
   resource a {
      constructor() -> a
   }
}

Solution

Refactor the resolver to a 2 stage setup:

  1. resolve all the names, check for duplicate or undefined names
  2. expand all the type definitions

This way, during type expansion we already have a reference to the resource and are not infinitely trying to resolve the name.

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