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

Late-bound values of iteratees within nested for/spread fail to resolve for-generator variables #741

Open
bioball opened this issue Oct 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@bioball
Copy link
Contributor

bioball commented Oct 25, 2024

This code throws:

bar = new {}

foo {
  for (i in List(1)) {
    ...(bar) {
      baz {
        new { i }
      }
    }.baz
  }
}

This also throws (logically the same code):

bar = new {}

foo {
  for (i in List(1)) {
    for (elem in (bar) {
      baz {
        new { i }
      }
    }.baz) {
      elem
    }
  }
}

Throws:

–– Pkl Error ––
Cannot find property `i`.

7 | new { i }
          ^
bioball added a commit to bioball/pkl that referenced this issue Oct 30, 2024
There is currently a bug around resolving variables within the iterable of a for
generator or spread syntax (apple#741)

Normally, mappings/listings are type-checked lazily. However, this results in the said
bug getting widened, for any object members declared in the iterable.

As a workaround for now, prevent the bug from being any worse by ensuring that these
object members are eagerly typechecked.
@bioball bioball added the bug Something isn't working label Oct 31, 2024
bioball added a commit that referenced this issue Oct 31, 2024
There is currently a bug around resolving variables within the iterable of a for
generator or spread syntax (#741)

Normally, mappings/listings are type-checked lazily. However, this results in the said
bug getting widened, for any object members declared in the iterable.

As a workaround for now, prevent the bug from being any worse by ensuring that these
object members are eagerly typechecked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@bioball and others