You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing diagnostic error when amending non-Object types #116
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:
my_property: String
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.
Thanks for the report! I was able to reproduce this:
class A {
foo: String
}
a: A = newA {}
b = (a) {
foo {
"oops"
}
}
c = (a) {
foo = true// ^^^^// Type mismatch.// Required: String// Actual: Boolean
}
With pkl-intellij, the same file produces both expected diagnostics:
class A {
foo: String
}
a: A = newA {}
b = (a) {
foo {
// ^// Cannot amend value of type String"oops"
}
}
c = (a) {
foo = true// ^^^^// Type mismatch.// Required: String// Found: Boolean
}
This appears to affect any type that isn't an Object including primitive and collection types.
changed the title [-]Type mismatch not reported when assigning object literal to primitive-typed property[/-][+]Missing diagnostic error when amending non-`Object` types[/+]on Nov 17, 2025
Activity
HT154 commentedon Nov 17, 2025
Thanks for the report! I was able to reproduce this:
With pkl-intellij, the same file produces both expected diagnostics:
This appears to affect any type that isn't an
Objectincluding primitive and collection types.[-]Type mismatch not reported when assigning object literal to primitive-typed property[/-][+]Missing diagnostic error when amending non-`Object` types[/+]