Skip to content

Missing diagnostic error when amending non-Object types #116

@9sb8ctgmws-design

Description

@9sb8ctgmws-design

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:

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

  1. Create a .pkl file with a String property.
  2. Assign an object literal to it.
  3. Observe that no type-checking error is shown.

Additional Notes

This looks like a missing diagnostic case in the language server’s type checker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions