File tree Expand file tree Collapse file tree
main/java/org/pkl/core/runtime
files/LanguageSnippetTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,8 +158,12 @@ public int getRegularMemberCount() {
158158 }
159159
160160 private boolean isHiddenOrLocalProperty (Object key ) {
161- return key instanceof ObjectMember member && member .isLocal ()
162- || key instanceof Identifier identifier
163- && (key == Identifier .DEFAULT || identifier .isLocalProp ());
161+ // only local members have the entire `ObjectMember` stored as a key in cachedValues
162+ if (key instanceof ObjectMember member ) {
163+ assert member .isLocal ();
164+ return true ;
165+ }
166+ return key instanceof Identifier identifier
167+ && (key == Identifier .DEFAULT || identifier .isLocalProp ());
164168 }
165169}
Original file line number Diff line number Diff line change 1+ extends ".../pklbinaryTest.pkl"
2+
3+ dynamic : Dynamic = new {
4+ local foo = new Test {}
5+ bar = foo
6+ }
7+
8+ listing : Listing = new {
9+ local foo = new Test {}
10+ foo
11+ }
12+
13+ mapping : Mapping = new {
14+ local foo = new Test {}
15+ ["bar" ] = foo
16+ }
17+
18+ `class` : MyClass = new {
19+ local foo = new Test {}
20+ bar = foo
21+ }
22+
23+ class MyClass {
24+ bar : Test
25+ }
26+
27+ class Test
Original file line number Diff line number Diff line change 1+ - 1
2+ - ' localMembers.msgpack.yaml'
3+ - ' file:///$snippetsDir/input/pklbinary/localMembers.msgpack.yaml.pkl'
4+ -
5+ -
6+ - 16
7+ - ' dynamic'
8+ -
9+ - 1
10+ - ' Dynamic'
11+ - ' pkl:base'
12+ -
13+ -
14+ - 16
15+ - ' bar'
16+ -
17+ - 1
18+ - ' localMembers.msgpack.yaml#Test'
19+ - ' file:///$snippetsDir/input/pklbinary/localMembers.msgpack.yaml.pkl'
20+ - []
21+ -
22+ - 16
23+ - ' listing'
24+ -
25+ - 5
26+ -
27+ -
28+ - 1
29+ - ' localMembers.msgpack.yaml#Test'
30+ - ' file:///$snippetsDir/input/pklbinary/localMembers.msgpack.yaml.pkl'
31+ - []
32+ -
33+ - 16
34+ - ' mapping'
35+ -
36+ - 3
37+ -
38+ ' bar ' :
39+ - 1
40+ - ' localMembers.msgpack.yaml#Test'
41+ - ' file:///$snippetsDir/input/pklbinary/localMembers.msgpack.yaml.pkl'
42+ - []
43+ -
44+ - 16
45+ - ' class'
46+ -
47+ - 1
48+ - ' localMembers.msgpack.yaml#MyClass'
49+ - ' file:///$snippetsDir/input/pklbinary/localMembers.msgpack.yaml.pkl'
50+ -
51+ -
52+ - 16
53+ - ' bar'
54+ -
55+ - 1
56+ - ' localMembers.msgpack.yaml#Test'
57+ - ' file:///$snippetsDir/input/pklbinary/localMembers.msgpack.yaml.pkl'
58+ - []
Original file line number Diff line number Diff line change @@ -696,48 +696,6 @@ class EvaluatorTest {
696696 }
697697 }
698698
699- @Test
700- fun `objects with object locals are encoded correctly` () {
701- val data =
702- evaluator.evaluateOutputBytes(
703- text(
704- """
705- import "pkl:pklbinary"
706-
707- dynamic: Dynamic = new {
708- local foo = new Test {}
709- bar = foo
710- }
711- listing: Listing = new {
712- local foo = new Test {}
713- foo
714- }
715- mapping: Mapping = new {
716- local foo = new Test {}
717- ["bar"] = foo
718- }
719- `class`: MyClass = new {
720- local foo = new Test {}
721- bar = foo
722- }
723-
724- class MyClass {
725- bar: Test
726- }
727-
728- class Test
729-
730- output {
731- renderer = new pklbinary.Renderer {}
732- }
733- """
734- .trimIndent()
735- )
736- )
737-
738- assertThatCode { PklBinaryDecoder .decode(data) }.doesNotThrowAnyException()
739- }
740-
741699 @Test
742700 fun `power assertions work with test facts with unavailable source section` () {
743701 val evaluator =
You can’t perform that action at this time.
0 commit comments