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

Wrong source location when spreading amended object #775

Open
odenix opened this issue Nov 3, 2024 · 3 comments
Open

Wrong source location when spreading amended object #775

odenix opened this issue Nov 3, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@odenix
Copy link
Contributor

odenix commented Nov 3, 2024

l = new Listing { "foo" }

l2 = (l) {
  [0] = "bar"
}

l3 = new Listing<Int> {
  ...l2
}

The error message correctly complains about "bar" but shows the source location of "foo":

–– Pkl Error ––
Expected value of type `Int`, but got type `String`.
Value: "bar"

7 | l3 = new Listing<Int> {
                     ^^^
at test#l3 (file:///D:/pkl/test.pkl, line 7)

1 | l = new Listing { "foo" }
                      ^^^^^
at test#l[#1] (file:///D:/pkl/test.pkl, line 1)

This issue is caused by a fundamental flaw in how VmObject.iterateMemberValues() works. The same issue likely exists in other places.

I'm working towards a fix that offers better ways to iterate over VmObject. (It's how I discovered this problem.)

PS: The blue colored line numbers 7 | and 1 | are difficult to read on black background.

@bioball
Copy link
Contributor

bioball commented Nov 4, 2024

PS: The blue colored line numbers 7 | and 1 | are difficult to read on black background.

Hm, it doesn't look too bad for me. But, hard to predict how every terminal renders this. Can you send a screenshot?

@odenix
Copy link
Contributor Author

odenix commented Nov 4, 2024

I can barely read them.

Screenshot 2024-11-04 001340 - Copy

@bioball bioball added the bug Something isn't working label Nov 5, 2024
@odenix
Copy link
Contributor Author

odenix commented Nov 11, 2024

I have a PR ready. I'll send it once fewer PRs are in flight.

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

No branches or pull requests

2 participants