Originally created by @taichi-ishitani on GitHub (Jan 26, 2025).
A pkl error is reported when refering a property defined in the amanded moudule.
How to reproduce:
// foo.pkl
foo_0 {
v = 0
}
foo_1 {
v = 1
}
// bar.pkl
amends "foo.pkl"
foo_1 {
v = foo_0.v
}
Evaluate the above pkl code (bar.pkl) then report the error message below.
$ ../pkl --version
Pkl 0.27.2 (Linux 5.15.0-1057-aws, native)
$ ../pkl eval bar.pkl
–– Pkl Error ––
Cannot find property `foo_0`.
4 | v = foo_0.v
^^^^^
at bar#foo_1.v (file:///home/taichi/temp/pkl/test/bar.pkl, line 4)
Did you mean any of the following?
foo_1
Originally created by @taichi-ishitani on GitHub (Jan 26, 2025).
A pkl error is reported when refering a property defined in the amanded moudule.
How to reproduce:
```pkl
// foo.pkl
foo_0 {
v = 0
}
foo_1 {
v = 1
}
```
```pkl
// bar.pkl
amends "foo.pkl"
foo_1 {
v = foo_0.v
}
```
Evaluate the above pkl code (`bar.pkl`) then report the error message below.
```
$ ../pkl --version
Pkl 0.27.2 (Linux 5.15.0-1057-aws, native)
$ ../pkl eval bar.pkl
–– Pkl Error ––
Cannot find property `foo_0`.
4 | v = foo_0.v
^^^^^
at bar#foo_1.v (file:///home/taichi/temp/pkl/test/bar.pkl, line 4)
Did you mean any of the following?
foo_1
```
This is expected behavior and the intentional design of Pkl's scoping rules. In short, this is designed to prevent unintentional changes to name resolution. In this case, the correct (and unambiguous) way to do this looks like this:
// bar.pkl
amends "foo.pkl"
foo_1 {
v = module.foo_0.v
}
@HT154 commented on GitHub (Jan 26, 2025):
This is expected behavior and the intentional design of Pkl's scoping rules. In short, this is designed to prevent unintentional changes to name resolution. In this case, the correct (and unambiguous) way to do this looks like this:
```pkl
// bar.pkl
amends "foo.pkl"
foo_1 {
v = module.foo_0.v
}
```
This post from @bioball goes into more detail about a similar case with the same motivation: https://github.com/apple/pkl/discussions/865#discussioncomment-11640312
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @taichi-ishitani on GitHub (Jan 26, 2025).
A pkl error is reported when refering a property defined in the amanded moudule.
How to reproduce:
Evaluate the above pkl code (
bar.pkl) then report the error message below.@HT154 commented on GitHub (Jan 26, 2025):
This is expected behavior and the intentional design of Pkl's scoping rules. In short, this is designed to prevent unintentional changes to name resolution. In this case, the correct (and unambiguous) way to do this looks like this:
This post from @bioball goes into more detail about a similar case with the same motivation: https://github.com/apple/pkl/discussions/865#discussioncomment-11640312
@taichi-ishitani commented on GitHub (Jan 27, 2025):
Hi @HT154 ,
Thank you for your reply.
I understood this is expected behaviro.