-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When a Pkl object is instantiated, it captures the current frame's receiver and owner by storing `frame.materialize()`. Because a materialized frame is a reference to, not a snapshot of, a virtual frame, this way of capturing receiver and owner is only safe if the virtual frame's receiver and owner are never mutated. However, TypeAliasTypeNode does mutate receiver and owner (3d1db25), which is why a VmListingOrMapping instantiated by ListingOrMappingTypeNode must store them individually instead of storing `frame.materialize()`. To rule out that the same problem surfaces elsewhere, it might be a good idea to do one of the following: * stop mutating receiver and owner * change the way Pkl objects capture receiver and owner
- Loading branch information
Showing
9 changed files
with
74 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
pkl-core/src/test/files/LanguageSnippetTests/input/types/helpers/originalTypealias.pkl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const local lastName = "Birdo" | ||
|
||
typealias Birds = Listing<String(endsWith(lastName))> | ||
|
||
typealias Birds2 = Pair<Listing<String(endsWith(lastName))>, Int> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
pkl-core/src/test/files/LanguageSnippetTests/input/types/typeAliasContext.pkl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import "helpers/originalTypealias.pkl" | ||
|
||
res: originalTypealias.Birds = new { "Jimmy Bird" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
pkl-core/src/test/files/LanguageSnippetTests/output/types/typeAliasContext.err
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
–– Pkl Error –– | ||
Type constraint `endsWith(lastName)` violated. | ||
Value: "Jimmy Bird" | ||
|
||
x | typealias Birds = Listing<String(endsWith(lastName))> | ||
^^^^^^^^^^^^^^^^^^ | ||
at typeAliasContext#res (file:///$snippetsDir/input/types/helpers/originalTypealias.pkl) | ||
|
||
x | res: originalTypealias.Birds = new { "Jimmy Bird" } | ||
^^^^^^^^^^^^ | ||
at typeAliasContext#res[#1] (file:///$snippetsDir/input/types/typeAliasContext.pkl) | ||
|
||
xxx | text = renderer.renderDocument(value) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
at pkl.base#Module.output.text (pkl:base) |