Surprising scoping behavior: annotations on class properties cannot see the enclosing class
Open
- Dominant language
- Java
- Stars
- 11.5k
- Forks
- 402
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 20
Description
In this snippet, `qux` is not visible inside `@MyAnnotation { ... }`.
```pkl
class MyClass {
@MyAnnotation { prop = qux }
foo: Int
const qux = 15
}
```
Contributor guide
Research direction
Start by reproducing the supplied Pkl snippet and inspect how annotation bodies on class properties resolve names. Trace the scoping rules for `@MyAnnotation { prop = qux }` and compare them with the enclosing class scope. Done means the example can resolve `qux` as the class property, with a regression test covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100