mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 14:20:35 +01:00
[PR #1257] Add Object.toMixin() method
#976
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/1257
Author: @Mikulas
Created: 10/27/2025
Status: 🔄 Open
Base:
main← Head:tomixin📝 Commits (1)
84e495aAdd Object.toMixin() method📊 Changes
7 files changed (+1055 additions, -5 deletions)
View changed files
➕
pkl-core/src/main/java/org/pkl/core/ast/ObjectToMixinNode.java(+150 -0)➕
pkl-core/src/main/java/org/pkl/core/stdlib/base/ObjectNodes.java(+41 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input/api/objectToMixin.pkl(+339 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/api/objectToMixin.pcf(+218 -0)📝
pkl-core/src/test/files/LanguageSnippetTests/output/api/reflectedDeclaration.pcf(+290 -4)📝
pkl-core/src/test/kotlin/org/pkl/core/ReplServerTest.kt(+2 -0)📝
stdlib/base.pkl(+15 -1)📄 Description
Adds a
toMixin()method to theObjectclass that converts anObjectinto a
Mixinfunction applicable via the pipe operator (|>).A generic
toMixin()method cannot be implemented in user land, so thisimplementation provides a native method that properly handles:
Implementation uses the source
Object's enclosing frame to ensureproper module context for type resolution during member evaluation.
edit: updated from
DynamictoObject🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.