Summary
When assigning a value of the wrong type to a String-typed property, the Pkl VS Code extension correctly flags a type mismatch only for primitive non‑string values (e.g., booleans), but fails to flag the error when the incorrect value is an object literal.
Example
Given a field:
This invalid assignment is correctly flagged:
my_property = true // type mismatch is highlighted
But this invalid assignment is NOT flagged:
my_property {
value = true
}
The second form assigns an object, which should not be allowed for a String-typed property, but the VS Code extension does not report any error.
Expected Behavior
The language server should report a type mismatch when a String-typed property is assigned an object literal.
Actual Behavior
No diagnostic is shown when assigning an object literal.
Environment
Extension version: 0.21.0
Pkl version: 0.30.0
VS Code: latest stable
Steps to Reproduce
- Create a
.pkl file with a String property.
- Assign an object literal to it.
- Observe that no type-checking error is shown.
Additional Notes
This looks like a missing diagnostic case in the language server’s type checker.
Summary
When assigning a value of the wrong type to a
String-typed property, the Pkl VS Code extension correctly flags a type mismatch only for primitive non‑string values (e.g., booleans), but fails to flag the error when the incorrect value is an object literal.Example
Given a field:
This invalid assignment is correctly flagged:
But this invalid assignment is NOT flagged:
The second form assigns an object, which should not be allowed for a
String-typed property, but the VS Code extension does not report any error.Expected Behavior
The language server should report a type mismatch when a
String-typed property is assigned an object literal.Actual Behavior
No diagnostic is shown when assigning an object literal.
Environment
Extension version: 0.21.0
Pkl version: 0.30.0
VS Code: latest stable
Steps to Reproduce
.pklfile with aStringproperty.Additional Notes
This looks like a missing diagnostic case in the language server’s type checker.