apple / apple/pkl

🐛`fixed` properties not respected by `toTyped()`

Open
#573 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
11.5k
Forks
402
Avg merge
1d 15h
Merged PRs (30d)
20

Description

The `toTyped` API doesn't respect `fixed` properties on classes, resulting in the following unexpected outcome:

```pkl
class Bird {
fixed type = "Parrot"
name = "Polly"
}

untypedBird {
type = "Cocker spaniel"
name = "Morris"
}

result = untypedBird.toTyped(Bird)
```

[produces](https://pkl-playground.vercel.app/?share=truck-species-screen)

```
untypedBird {
type = "Cocker spaniel"
name = "Morris"
}
result {
type = "Cocker spaniel"
name = "Morris"
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided Pkl example in the linked playground and trace the toTyped API behavior for fixed properties. The work is done when converting untypedBird to Bird preserves Bird's fixed type value instead of accepting the input value.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.