mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 14:20:35 +01:00
[PR #964] [MERGED] Execute typechecks eagerly when within a constraint #831
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/964
Author: @bioball
Created: 2/19/2025
Status: ✅ Merged
Merged: 2/19/2025
Merged by: @bioball
Base:
main← Head:eager-constraint-checks📝 Commits (1)
4342dc8Execute typechecks eagerly when within a constraint📊 Changes
17 files changed (+266 additions, -63 deletions)
View changed files
📝
pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java(+1 -1)📝
pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java(+86 -60)📝
pkl-core/src/main/java/org/pkl/core/ast/type/UnresolvedTypeNode.java(+7 -2)📝
pkl-core/src/main/java/org/pkl/core/runtime/VmLanguage.java(+4 -0)➕
pkl-core/src/main/java/org/pkl/core/runtime/VmLocalContext.java(+31 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input-helper/classes/MyClass.pkl(+9 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input-helper/classes/myClass1.pkl(+7 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input/classes/constraints13.pkl(+16 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input/classes/constraints14.pkl(+14 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input/errors/constraintDetails1.pkl(+9 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input/errors/constraintDetails2.pkl(+11 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input/errors/constraintDetails3.pkl(+9 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/classes/constraints13.pcf(+1 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/classes/constraints14.pcf(+15 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/errors/constraintDetails1.err(+15 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/errors/constraintDetails2.err(+16 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/errors/constraintDetails3.err(+15 -0)📄 Description
This changes the language to check all types eagerly when within a type constraint.
This addresses a regression where error messages might show objects that are missing details (see https://github.com/apple/pkl/issues/918).
Another implication of this change is: type constraints are stricter. Now, type annotations will check
MappingandListingmembers if the annotation is executed from a constraint.This currently does not throw, and will after this change:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.