From 33071c0cb767cc1d37a5da6b164dc16d564ca24b Mon Sep 17 00:00:00 2001 From: Marcel van Lohuizen Date: Fri, 28 Jul 2023 12:13:16 +0200 Subject: [PATCH] internal/core/adt: fix stack overflow with comprehensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The issue was that evaluating an arc in the source of a comprehension resulted in infinite recursion. The call to unify that is removed can be removed, as it is already called in the block above when it is necessary. This is not a full fix, but is something that will be easier to fix in the new evaluator. Fixes #2367 Signed-off-by: Marcel van Lohuizen Change-Id: Ibcab74235097180094284f249750c3c0ec5d2845 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/557011 TryBot-Result: CUEcueckoo Reviewed-by: Daniel Martí Unity-Result: CUE porcuepine --- cue/testdata/benchmarks/issue2176.txtar | 16 +++--- .../015_list_comprehension.txtar | 8 +-- .../045_comprehension_and_skipped_field.txtar | 4 +- cue/testdata/comprehensions/closed.txtar | 2 +- cue/testdata/comprehensions/errors.txtar | 18 +++--- cue/testdata/comprehensions/fields.txtar | 4 +- cue/testdata/comprehensions/for.txtar | 8 +-- cue/testdata/comprehensions/iferror.txtar | 4 +- cue/testdata/comprehensions/issue1732.txtar | 10 ++-- cue/testdata/comprehensions/issue2171.txtar | 4 +- cue/testdata/comprehensions/issue843.txtar | 2 +- cue/testdata/comprehensions/nested.txtar | 4 +- cue/testdata/comprehensions/pushdown.txtar | 6 +- cue/testdata/cycle/chain.txtar | 10 ++-- cue/testdata/cycle/comprehension.txtar | 31 +++++++--- cue/testdata/cycle/evaluate.txtar | 56 +++++++------------ cue/testdata/cycle/issue990.txtar | 4 +- cue/testdata/cycle/self.txtar | 22 ++++---- .../037_closing_with_comprehensions.txtar | 4 +- cue/testdata/disjunctions/019_ips.txtar | 4 +- cue/testdata/disjunctions/embed.txtar | 8 +-- cue/testdata/eval/conjuncts.txtar | 2 +- cue/testdata/eval/discontinuous.txtar | 4 +- cue/testdata/eval/issue2146.txtar | 12 ++-- cue/testdata/eval/issue2235.txtar | 8 +-- cue/testdata/eval/issue500.txtar | 2 +- cue/testdata/eval/let.txtar | 10 ++-- cue/testdata/eval/lists.txtar | 2 +- cue/testdata/export/009.txtar | 4 +- cue/testdata/export/010.txtar | 4 +- .../fulleval/004_field_comprehension.txtar | 8 +-- ...rencing_field_in_field_comprehension.txtar | 8 +-- ...ld_comprehensions_with_multiple_keys.txtar | 4 +- ...6_struct_comprehension_with_template.txtar | 8 +-- ...lutions_in_struct_comprehension_keys.txtar | 2 +- ...20_complex_interaction_of_groundness.txtar | 4 +- cue/testdata/fulleval/053_issue312.txtar | 8 +-- cue/testdata/fulleval/054_issue312.txtar | 8 +-- cue/testdata/lists/019_list_types.txtar | 4 +- cue/testdata/lists/020_list_arithmetic.txtar | 2 +- .../038_incomplete_comprehensions.txtar | 2 +- .../resolve/047_struct_comprehensions.txtar | 6 +- internal/core/adt/expr.go | 1 - 43 files changed, 171 insertions(+), 171 deletions(-) diff --git a/cue/testdata/benchmarks/issue2176.txtar b/cue/testdata/benchmarks/issue2176.txtar index 442f3f4c458..4d9a098c13e 100644 --- a/cue/testdata/benchmarks/issue2176.txtar +++ b/cue/testdata/benchmarks/issue2176.txtar @@ -59,15 +59,15 @@ output: { "2": (datastream & {marker: length: 14}).marker.position } -- out/eval/stats -- -Leaks: 214 -Freed: 5799 -Reused: 5795 -Allocs: 218 -Retain: 1911 +Leaks: 90 +Freed: 4079 +Reused: 4074 +Allocs: 95 +Retain: 1359 -Unifications: 6005 -Conjuncts: 14507 -Disjuncts: 6864 +Unifications: 4161 +Conjuncts: 9489 +Disjuncts: 4804 -- out/eval -- (struct){ #Datastream: (#struct){ diff --git a/cue/testdata/comprehensions/015_list_comprehension.txtar b/cue/testdata/comprehensions/015_list_comprehension.txtar index ba12862a981..5a6763618b1 100644 --- a/cue/testdata/comprehensions/015_list_comprehension.txtar +++ b/cue/testdata/comprehensions/015_list_comprehension.txtar @@ -83,12 +83,12 @@ d: -- out/eval/stats -- Leaks: 0 Freed: 19 -Reused: 11 -Allocs: 8 -Retain: 14 +Reused: 12 +Allocs: 7 +Retain: 10 Unifications: 19 -Conjuncts: 35 +Conjuncts: 36 Disjuncts: 23 -- out/eval -- (struct){ diff --git a/cue/testdata/comprehensions/045_comprehension_and_skipped_field.txtar b/cue/testdata/comprehensions/045_comprehension_and_skipped_field.txtar index 00d05ca1e3a..4836edbd2af 100644 --- a/cue/testdata/comprehensions/045_comprehension_and_skipped_field.txtar +++ b/cue/testdata/comprehensions/045_comprehension_and_skipped_field.txtar @@ -54,11 +54,11 @@ Leaks: 3 Freed: 7 Reused: 2 Allocs: 8 -Retain: 8 +Retain: 7 Unifications: 8 Conjuncts: 11 -Disjuncts: 13 +Disjuncts: 12 -- out/eval -- (struct){ x: (struct){ diff --git a/cue/testdata/comprehensions/closed.txtar b/cue/testdata/comprehensions/closed.txtar index ec7b5073bb0..0c7827d3a0d 100644 --- a/cue/testdata/comprehensions/closed.txtar +++ b/cue/testdata/comprehensions/closed.txtar @@ -95,7 +95,7 @@ Leaks: 2 Freed: 70 Reused: 64 Allocs: 8 -Retain: 4 +Retain: 3 Unifications: 58 Conjuncts: 103 diff --git a/cue/testdata/comprehensions/errors.txtar b/cue/testdata/comprehensions/errors.txtar index f83acaec1a8..41570f9a62d 100644 --- a/cue/testdata/comprehensions/errors.txtar +++ b/cue/testdata/comprehensions/errors.txtar @@ -44,18 +44,18 @@ conflictRangingOverSelf: { } } -- out/eval/stats -- -Leaks: 4 -Freed: 27 -Reused: 23 -Allocs: 8 -Retain: 6 +Leaks: 1 +Freed: 28 +Reused: 22 +Allocs: 7 +Retain: 1 -Unifications: 21 +Unifications: 19 Conjuncts: 40 -Disjuncts: 30 +Disjuncts: 29 -- out/eval -- Errors: -conflictRangingOverSelf.x: conflicting values int and "age" (mismatched types int and string): +conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): ./in.cue:36:9 ./in.cue:40:3 ./in.cue:41:9 @@ -102,7 +102,7 @@ Result: // [eval] name: (string){ "name" } age: (_|_){ - // [eval] conflictRangingOverSelf.x: conflicting values int and "age" (mismatched types int and string): + // [eval] conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): // ./in.cue:36:9 // ./in.cue:40:3 // ./in.cue:41:9 diff --git a/cue/testdata/comprehensions/fields.txtar b/cue/testdata/comprehensions/fields.txtar index 5c6543a78c6..3bc79040973 100644 --- a/cue/testdata/comprehensions/fields.txtar +++ b/cue/testdata/comprehensions/fields.txtar @@ -62,10 +62,10 @@ Leaks: 1 Freed: 32 Reused: 26 Allocs: 7 -Retain: 2 +Retain: 1 Unifications: 33 -Conjuncts: 40 +Conjuncts: 41 Disjuncts: 33 -- out/eval -- (struct){ diff --git a/cue/testdata/comprehensions/for.txtar b/cue/testdata/comprehensions/for.txtar index 14ad47b830c..d336f468c20 100644 --- a/cue/testdata/comprehensions/for.txtar +++ b/cue/testdata/comprehensions/for.txtar @@ -13,13 +13,13 @@ comprehensionBinds: { b: {for _, _ in [1] {a: _}} } -- out/eval/stats -- -Leaks: 4 +Leaks: 2 Freed: 16 Reused: 12 -Allocs: 8 -Retain: 11 +Allocs: 6 +Retain: 7 -Unifications: 20 +Unifications: 18 Conjuncts: 18 Disjuncts: 21 -- out/eval -- diff --git a/cue/testdata/comprehensions/iferror.txtar b/cue/testdata/comprehensions/iferror.txtar index 58acc9a85b7..279aeeda720 100644 --- a/cue/testdata/comprehensions/iferror.txtar +++ b/cue/testdata/comprehensions/iferror.txtar @@ -151,10 +151,10 @@ Leaks: 0 Freed: 43 Reused: 35 Allocs: 8 -Retain: 18 +Retain: 14 Unifications: 33 -Conjuncts: 65 +Conjuncts: 66 Disjuncts: 57 -- out/eval -- Errors: diff --git a/cue/testdata/comprehensions/issue1732.txtar b/cue/testdata/comprehensions/issue1732.txtar index 73fe4dff697..f0a71d04253 100644 --- a/cue/testdata/comprehensions/issue1732.txtar +++ b/cue/testdata/comprehensions/issue1732.txtar @@ -122,15 +122,15 @@ foo: { } } -- out/eval/stats -- -Leaks: 4 +Leaks: 3 Freed: 118 Reused: 103 -Allocs: 19 -Retain: 14 +Allocs: 18 +Retain: 10 -Unifications: 112 +Unifications: 111 Conjuncts: 249 -Disjuncts: 128 +Disjuncts: 126 -- out/eval -- (struct){ networkingv1: (struct){ diff --git a/cue/testdata/comprehensions/issue2171.txtar b/cue/testdata/comprehensions/issue2171.txtar index b742d4a67dc..49cbd866cac 100644 --- a/cue/testdata/comprehensions/issue2171.txtar +++ b/cue/testdata/comprehensions/issue2171.txtar @@ -25,11 +25,11 @@ Leaks: 0 Freed: 3 Reused: 0 Allocs: 3 -Retain: 2 +Retain: 0 Unifications: 3 Conjuncts: 5 -Disjuncts: 5 +Disjuncts: 3 -- out/eval -- (struct){ do: (struct){ diff --git a/cue/testdata/comprehensions/issue843.txtar b/cue/testdata/comprehensions/issue843.txtar index f09d112d618..98a993b6042 100644 --- a/cue/testdata/comprehensions/issue843.txtar +++ b/cue/testdata/comprehensions/issue843.txtar @@ -45,7 +45,7 @@ Leaks: 9 Freed: 55 Reused: 41 Allocs: 23 -Retain: 20 +Retain: 14 Unifications: 52 Conjuncts: 120 diff --git a/cue/testdata/comprehensions/nested.txtar b/cue/testdata/comprehensions/nested.txtar index f8d3083d90a..4f51a3b8602 100644 --- a/cue/testdata/comprehensions/nested.txtar +++ b/cue/testdata/comprehensions/nested.txtar @@ -63,11 +63,11 @@ Leaks: 0 Freed: 45 Reused: 26 Allocs: 19 -Retain: 36 +Retain: 33 Unifications: 35 Conjuncts: 95 -Disjuncts: 78 +Disjuncts: 75 -- out/eval -- (struct){ service: (struct){ diff --git a/cue/testdata/comprehensions/pushdown.txtar b/cue/testdata/comprehensions/pushdown.txtar index 0719964a6db..e45e1dc021a 100644 --- a/cue/testdata/comprehensions/pushdown.txtar +++ b/cue/testdata/comprehensions/pushdown.txtar @@ -746,11 +746,11 @@ Leaks: 14 Freed: 394 Reused: 387 Allocs: 21 -Retain: 120 +Retain: 107 Unifications: 394 -Conjuncts: 637 -Disjuncts: 476 +Conjuncts: 638 +Disjuncts: 471 -- out/eval -- Errors: embed.fail1.p: field not allowed: diff --git a/cue/testdata/cycle/chain.txtar b/cue/testdata/cycle/chain.txtar index 7f529c2771a..c8b74775b2c 100644 --- a/cue/testdata/cycle/chain.txtar +++ b/cue/testdata/cycle/chain.txtar @@ -208,14 +208,14 @@ issue2052: full: { d: #Depth & {#in: tree} } -- out/eval/stats -- -Leaks: 72 +Leaks: 70 Freed: 1815 Reused: 1801 -Allocs: 86 -Retain: 195 +Allocs: 84 +Retain: 185 -Unifications: 802 -Conjuncts: 3177 +Unifications: 800 +Conjuncts: 3175 Disjuncts: 1974 -- out/eval -- (struct){ diff --git a/cue/testdata/cycle/comprehension.txtar b/cue/testdata/cycle/comprehension.txtar index 5110009b23c..f1af150e6b3 100644 --- a/cue/testdata/cycle/comprehension.txtar +++ b/cue/testdata/cycle/comprehension.txtar @@ -303,16 +303,22 @@ selfReferential: fail: { } } +// avoid infinite recursion +issue2367: { + a: _ + for x in [a] {a: x} +} + -- out/eval/stats -- -Leaks: 48 -Freed: 1268 -Reused: 1256 +Leaks: 50 +Freed: 1270 +Reused: 1260 Allocs: 60 -Retain: 189 +Retain: 145 -Unifications: 828 -Conjuncts: 2512 -Disjuncts: 1437 +Unifications: 832 +Conjuncts: 2525 +Disjuncts: 1404 -- out/eval -- Errors: selfReferential.insertionError.A: field foo3 not allowed by earlier comprehension or reference cycle @@ -710,6 +716,9 @@ Result: } } } + issue2367: (struct){ + a: (_){ _ } + } } -- out/compile -- --- in.cue @@ -1194,4 +1203,12 @@ Result: if 〈0;b〉 {} } } + issue2367: { + a: _ + for _, x in [ + 〈1;a〉, + ] { + a: 〈1;x〉 + } + } } diff --git a/cue/testdata/cycle/evaluate.txtar b/cue/testdata/cycle/evaluate.txtar index 89a50b4bc1a..2ea667ce5ca 100644 --- a/cue/testdata/cycle/evaluate.txtar +++ b/cue/testdata/cycle/evaluate.txtar @@ -107,15 +107,15 @@ closeFail: { } -- out/eval/stats -- -Leaks: 66 -Freed: 95 -Reused: 91 -Allocs: 70 -Retain: 136 +Leaks: 57 +Freed: 90 +Reused: 86 +Allocs: 61 +Retain: 126 -Unifications: 149 -Conjuncts: 289 -Disjuncts: 171 +Unifications: 135 +Conjuncts: 269 +Disjuncts: 156 -- out/eval -- Errors: closeCycle.a: structural cycle @@ -126,6 +126,9 @@ closeFail.x.b: field not allowed: ./in.cue:104:6 ./in.cue:105:5 letCycleFail.t1.a.c: structural cycle +listAddCycle.a: structural cycle +listAddCycle.b.0.0: structural cycle +listAddCycle.b.0.1: structural cycle structCycle.a: structural cycle structCycle.b.d: structural cycle disjunctionCycle.a: cannot use 1 (type int) as list in argument 1 to and: @@ -142,10 +145,8 @@ structCycle.c: structural cycle: ./in.cue:77:14 embedCycle: structural cycle: ./in.cue:83:11 -listAddCycle.c.0.0: structural cycle: - ./in.cue:89:5 -listAddCycle.c.0.1: structural cycle: - ./in.cue:89:5 +listAddCycle.c: structural cycle: + ./in.cue:89:6 listMulCycle.a: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): ./in.cue:95:5 ./in.cue:95:9 @@ -303,44 +304,27 @@ Result: listAddCycle: (_|_){ // [structural cycle] a: (_|_){ - // [structural cycle] - 0: (_|_){ - // [structural cycle] listAddCycle.c.0.0: structural cycle: - // ./in.cue:89:5 - } - 1: (_|_){ - // [structural cycle] listAddCycle.c.0.0: structural cycle: - // ./in.cue:89:5 - } + // [structural cycle] listAddCycle.a: structural cycle } b: (_|_){ - // [structural cycle] - 0: (_|_){ - // [structural cycle] listAddCycle.c.0.0: structural cycle: - // ./in.cue:89:5 - } - 1: (_|_){ - // [structural cycle] listAddCycle.c.0.0: structural cycle: - // ./in.cue:89:5 - } - } - c: (_|_){ // [structural cycle] 0: (_|_){ // [structural cycle] 0: (_|_){ - // [structural cycle] listAddCycle.c.0.0: structural cycle: - // ./in.cue:89:5 + // [structural cycle] listAddCycle.b.0.0: structural cycle } 1: (_|_){ - // [structural cycle] listAddCycle.c.0.1: structural cycle: - // ./in.cue:89:5 + // [structural cycle] listAddCycle.b.0.1: structural cycle } } 1: (_|_){ // [structural cycle] } } + c: (_|_){ + // [structural cycle] listAddCycle.c: structural cycle: + // ./in.cue:89:6 + } } listMulCycle: (_|_){ // [eval] diff --git a/cue/testdata/cycle/issue990.txtar b/cue/testdata/cycle/issue990.txtar index aa4b75ddc4d..c7e8345f651 100644 --- a/cue/testdata/cycle/issue990.txtar +++ b/cue/testdata/cycle/issue990.txtar @@ -177,11 +177,11 @@ Leaks: 0 Freed: 1907 Reused: 1882 Allocs: 25 -Retain: 14 +Retain: 12 Unifications: 1541 Conjuncts: 6931 -Disjuncts: 1921 +Disjuncts: 1919 -- out/eval -- (struct){ #AC: (#struct){ diff --git a/cue/testdata/cycle/self.txtar b/cue/testdata/cycle/self.txtar index e33e1d1e588..020d553c3a4 100644 --- a/cue/testdata/cycle/self.txtar +++ b/cue/testdata/cycle/self.txtar @@ -267,10 +267,10 @@ Leaks: 14 Freed: 414 Reused: 405 Allocs: 23 -Retain: 42 +Retain: 27 Unifications: 236 -Conjuncts: 682 +Conjuncts: 686 Disjuncts: 439 -- out/eval -- Errors: @@ -281,16 +281,16 @@ expr.error2.a: conflicting values 4 and 3: ./in.cue:6:5 ./in.cue:7:5 list.error1.a: element at index 2 not allowed by earlier comprehension or reference cycle -list.error2.a: conflicting values "1" and "2": - ./in.cue:16:6 - ./in.cue:16:11 -list.error2.a: conflicting values "3" and "1": +list.error2.a: element at index 2 not allowed by earlier comprehension or reference cycle +list.error2.a.0: conflicting values "3" and "1": ./in.cue:15:6 ./in.cue:16:6 -list.error2.a: conflicting values "3" and "2": +list.error2.a.1: conflicting values "1" and "2": + ./in.cue:16:6 + ./in.cue:16:11 +list.error2.a.1: conflicting values "3" and "2": ./in.cue:15:6 ./in.cue:16:11 -list.error2.a: element at index 2 not allowed by earlier comprehension or reference cycle list.error2.a.2: conflicting values "1" and "2": ./in.cue:16:6 ./in.cue:16:11 @@ -336,15 +336,15 @@ Result: a: (_|_){ // [eval] list.error2.a: element at index 2 not allowed by earlier comprehension or reference cycle 0: (_|_){ - // [eval] list.error2.a: conflicting values "3" and "1": + // [eval] list.error2.a.0: conflicting values "3" and "1": // ./in.cue:15:6 // ./in.cue:16:6 } 1: (_|_){ - // [eval] list.error2.a: conflicting values "1" and "2": + // [eval] list.error2.a.1: conflicting values "1" and "2": // ./in.cue:16:6 // ./in.cue:16:11 - // list.error2.a: conflicting values "3" and "2": + // list.error2.a.1: conflicting values "3" and "2": // ./in.cue:15:6 // ./in.cue:16:11 } diff --git a/cue/testdata/definitions/037_closing_with_comprehensions.txtar b/cue/testdata/definitions/037_closing_with_comprehensions.txtar index cb44c05846f..c6a22540756 100644 --- a/cue/testdata/definitions/037_closing_with_comprehensions.txtar +++ b/cue/testdata/definitions/037_closing_with_comprehensions.txtar @@ -107,11 +107,11 @@ Leaks: 10 Freed: 18 Reused: 15 Allocs: 13 -Retain: 15 +Retain: 10 Unifications: 28 Conjuncts: 43 -Disjuncts: 33 +Disjuncts: 28 -- out/eval -- Errors: #E.f3: field not allowed: diff --git a/cue/testdata/disjunctions/019_ips.txtar b/cue/testdata/disjunctions/019_ips.txtar index 6d5da82ce81..5655756464c 100644 --- a/cue/testdata/disjunctions/019_ips.txtar +++ b/cue/testdata/disjunctions/019_ips.txtar @@ -59,11 +59,11 @@ Leaks: 3 Freed: 54 Reused: 48 Allocs: 9 -Retain: 14 +Retain: 6 Unifications: 48 Conjuncts: 111 -Disjuncts: 68 +Disjuncts: 60 -- out/eval -- (struct){ IP: (#list){ diff --git a/cue/testdata/disjunctions/embed.txtar b/cue/testdata/disjunctions/embed.txtar index 0e3bc5a8353..1f94421e11f 100644 --- a/cue/testdata/disjunctions/embed.txtar +++ b/cue/testdata/disjunctions/embed.txtar @@ -61,13 +61,13 @@ nested: { (3 | 4 | *( 5 | 6 | *7)) & ( 3 | 4 | ( *7 | 8 ))) } -- out/eval/stats -- -Leaks: 2 +Leaks: 1 Freed: 416 Reused: 381 -Allocs: 37 -Retain: 2 +Allocs: 36 +Retain: 1 -Unifications: 258 +Unifications: 257 Conjuncts: 478 Disjuncts: 417 -- out/eval -- diff --git a/cue/testdata/eval/conjuncts.txtar b/cue/testdata/eval/conjuncts.txtar index beb732b8b71..090753227fe 100644 --- a/cue/testdata/eval/conjuncts.txtar +++ b/cue/testdata/eval/conjuncts.txtar @@ -73,7 +73,7 @@ Leaks: 9 Freed: 68 Reused: 59 Allocs: 18 -Retain: 24 +Retain: 22 Unifications: 45 Conjuncts: 135 diff --git a/cue/testdata/eval/discontinuous.txtar b/cue/testdata/eval/discontinuous.txtar index 4840d4eeffc..9a8187ca470 100644 --- a/cue/testdata/eval/discontinuous.txtar +++ b/cue/testdata/eval/discontinuous.txtar @@ -53,11 +53,11 @@ Leaks: 0 Freed: 14 Reused: 5 Allocs: 9 -Retain: 10 +Retain: 9 Unifications: 14 Conjuncts: 23 -Disjuncts: 24 +Disjuncts: 23 -- out/eval -- (struct){ a: (#list){ diff --git a/cue/testdata/eval/issue2146.txtar b/cue/testdata/eval/issue2146.txtar index 727ba49515b..ebc5c45c87d 100644 --- a/cue/testdata/eval/issue2146.txtar +++ b/cue/testdata/eval/issue2146.txtar @@ -40,15 +40,15 @@ p2: { } -- out/eval/stats -- -Leaks: 37 -Freed: 152 -Reused: 145 -Allocs: 44 -Retain: 77 +Leaks: 18 +Freed: 171 +Reused: 163 +Allocs: 26 +Retain: 18 Unifications: 173 Conjuncts: 557 -Disjuncts: 206 +Disjuncts: 189 -- out/eval -- (struct){ p1: (struct){ diff --git a/cue/testdata/eval/issue2235.txtar b/cue/testdata/eval/issue2235.txtar index e3c0bf7cc15..73fcbbfff75 100644 --- a/cue/testdata/eval/issue2235.txtar +++ b/cue/testdata/eval/issue2235.txtar @@ -102,13 +102,13 @@ clusters: foo: {} -- out/eval/stats -- Leaks: 1 Freed: 99 -Reused: 76 -Allocs: 24 -Retain: 80 +Reused: 80 +Allocs: 20 +Retain: 64 Unifications: 100 Conjuncts: 260 -Disjuncts: 166 +Disjuncts: 151 -- out/eval -- (struct){ shorewallParams: (#struct){ diff --git a/cue/testdata/eval/issue500.txtar b/cue/testdata/eval/issue500.txtar index 3915ce06568..31f9279da72 100644 --- a/cue/testdata/eval/issue500.txtar +++ b/cue/testdata/eval/issue500.txtar @@ -24,7 +24,7 @@ Leaks: 16 Freed: 34 Reused: 31 Allocs: 19 -Retain: 37 +Retain: 22 Unifications: 50 Conjuncts: 66 diff --git a/cue/testdata/eval/let.txtar b/cue/testdata/eval/let.txtar index e8bc7ac5c89..dafd950ad3c 100644 --- a/cue/testdata/eval/let.txtar +++ b/cue/testdata/eval/let.txtar @@ -159,14 +159,14 @@ keepDescending: t2: { } -- out/eval/stats -- -Leaks: 45 +Leaks: 43 Freed: 161 Reused: 152 -Allocs: 54 -Retain: 230 +Allocs: 52 +Retain: 202 -Unifications: 192 -Conjuncts: 365 +Unifications: 190 +Conjuncts: 377 Disjuncts: 246 -- out/eval -- Errors: diff --git a/cue/testdata/eval/lists.txtar b/cue/testdata/eval/lists.txtar index 62d531565e4..19afa80f079 100644 --- a/cue/testdata/eval/lists.txtar +++ b/cue/testdata/eval/lists.txtar @@ -12,7 +12,7 @@ Leaks: 4 Freed: 11 Reused: 8 Allocs: 7 -Retain: 8 +Retain: 6 Unifications: 15 Conjuncts: 29 diff --git a/cue/testdata/export/009.txtar b/cue/testdata/export/009.txtar index 37e72d7330c..e809044b31c 100644 --- a/cue/testdata/export/009.txtar +++ b/cue/testdata/export/009.txtar @@ -47,11 +47,11 @@ Leaks: 3 Freed: 13 Reused: 10 Allocs: 6 -Retain: 17 +Retain: 7 Unifications: 16 Conjuncts: 37 -Disjuncts: 30 +Disjuncts: 20 -- out/eval -- (struct){ a: (#list){ diff --git a/cue/testdata/export/010.txtar b/cue/testdata/export/010.txtar index 3fcd33b2813..a604c42e2ba 100644 --- a/cue/testdata/export/010.txtar +++ b/cue/testdata/export/010.txtar @@ -48,11 +48,11 @@ Leaks: 3 Freed: 13 Reused: 10 Allocs: 6 -Retain: 17 +Retain: 7 Unifications: 16 Conjuncts: 37 -Disjuncts: 30 +Disjuncts: 20 -- out/eval -- (struct){ a: (#list){ diff --git a/cue/testdata/fulleval/004_field_comprehension.txtar b/cue/testdata/fulleval/004_field_comprehension.txtar index 7fd7a37ea7c..c67cecadaeb 100644 --- a/cue/testdata/fulleval/004_field_comprehension.txtar +++ b/cue/testdata/fulleval/004_field_comprehension.txtar @@ -92,12 +92,12 @@ c: -- out/eval/stats -- Leaks: 0 Freed: 12 -Reused: 4 -Allocs: 8 -Retain: 16 +Reused: 5 +Allocs: 7 +Retain: 12 Unifications: 12 -Conjuncts: 16 +Conjuncts: 17 Disjuncts: 16 -- out/eval -- (struct){ diff --git a/cue/testdata/fulleval/006_referencing_field_in_field_comprehension.txtar b/cue/testdata/fulleval/006_referencing_field_in_field_comprehension.txtar index 86b70a0827e..fb313271df3 100644 --- a/cue/testdata/fulleval/006_referencing_field_in_field_comprehension.txtar +++ b/cue/testdata/fulleval/006_referencing_field_in_field_comprehension.txtar @@ -59,12 +59,12 @@ a: -- out/eval/stats -- Leaks: 0 Freed: 7 -Reused: 2 -Allocs: 5 -Retain: 3 +Reused: 3 +Allocs: 4 +Retain: 1 Unifications: 7 -Conjuncts: 11 +Conjuncts: 13 Disjuncts: 8 -- out/eval -- (struct){ diff --git a/cue/testdata/fulleval/010_field_comprehensions_with_multiple_keys.txtar b/cue/testdata/fulleval/010_field_comprehensions_with_multiple_keys.txtar index b260b5f7a17..41a34949603 100644 --- a/cue/testdata/fulleval/010_field_comprehensions_with_multiple_keys.txtar +++ b/cue/testdata/fulleval/010_field_comprehensions_with_multiple_keys.txtar @@ -173,11 +173,11 @@ Leaks: 20 Freed: 29 Reused: 25 Allocs: 24 -Retain: 62 +Retain: 56 Unifications: 49 Conjuncts: 48 -Disjuncts: 67 +Disjuncts: 61 -- out/eval -- (struct){ a: (struct){ diff --git a/cue/testdata/fulleval/016_struct_comprehension_with_template.txtar b/cue/testdata/fulleval/016_struct_comprehension_with_template.txtar index 8f4c7837de3..a3b305cd854 100644 --- a/cue/testdata/fulleval/016_struct_comprehension_with_template.txtar +++ b/cue/testdata/fulleval/016_struct_comprehension_with_template.txtar @@ -138,13 +138,13 @@ service: -- out/eval/stats -- Leaks: 0 Freed: 51 -Reused: 41 -Allocs: 10 -Retain: 7 +Reused: 43 +Allocs: 8 +Retain: 4 Unifications: 27 Conjuncts: 70 -Disjuncts: 58 +Disjuncts: 55 -- out/eval -- (struct){ result: (#list){ diff --git a/cue/testdata/fulleval/017_resolutions_in_struct_comprehension_keys.txtar b/cue/testdata/fulleval/017_resolutions_in_struct_comprehension_keys.txtar index 5f505ff52fb..d4650cd5147 100644 --- a/cue/testdata/fulleval/017_resolutions_in_struct_comprehension_keys.txtar +++ b/cue/testdata/fulleval/017_resolutions_in_struct_comprehension_keys.txtar @@ -35,7 +35,7 @@ Leaks: 2 Freed: 3 Reused: 0 Allocs: 5 -Retain: 4 +Retain: 3 Unifications: 5 Conjuncts: 5 diff --git a/cue/testdata/fulleval/020_complex_interaction_of_groundness.txtar b/cue/testdata/fulleval/020_complex_interaction_of_groundness.txtar index 966c2df4972..22b61268aea 100644 --- a/cue/testdata/fulleval/020_complex_interaction_of_groundness.txtar +++ b/cue/testdata/fulleval/020_complex_interaction_of_groundness.txtar @@ -64,11 +64,11 @@ Leaks: 0 Freed: 10 Reused: 3 Allocs: 7 -Retain: 7 +Retain: 5 Unifications: 10 Conjuncts: 33 -Disjuncts: 17 +Disjuncts: 15 -- out/eval -- (struct){ res: (#list){ diff --git a/cue/testdata/fulleval/053_issue312.txtar b/cue/testdata/fulleval/053_issue312.txtar index 0dfebb587bb..3556416fc5e 100644 --- a/cue/testdata/fulleval/053_issue312.txtar +++ b/cue/testdata/fulleval/053_issue312.txtar @@ -21,13 +21,13 @@ for x in [1] *close({}) | { -- out/legacy-debug -- <0>{ <1>for _, x in [1] yield <2>{}, (*close (<3>{}) | <4>{[]: <5>(_: string)->null, })} -- out/eval/stats -- -Leaks: 3 +Leaks: 2 Freed: 3 Reused: 0 -Allocs: 6 -Retain: 3 +Allocs: 5 +Retain: 2 -Unifications: 4 +Unifications: 3 Conjuncts: 8 Disjuncts: 5 -- out/eval -- diff --git a/cue/testdata/fulleval/054_issue312.txtar b/cue/testdata/fulleval/054_issue312.txtar index 8079c542d85..1d8fd3d3a11 100644 --- a/cue/testdata/fulleval/054_issue312.txtar +++ b/cue/testdata/fulleval/054_issue312.txtar @@ -31,13 +31,13 @@ a: 2 } } -- out/eval/stats -- -Leaks: 2 +Leaks: 1 Freed: 8 Reused: 3 -Allocs: 7 -Retain: 2 +Allocs: 6 +Retain: 1 -Unifications: 6 +Unifications: 5 Conjuncts: 12 Disjuncts: 9 -- out/eval -- diff --git a/cue/testdata/lists/019_list_types.txtar b/cue/testdata/lists/019_list_types.txtar index f3648a2413a..d19e07235ce 100644 --- a/cue/testdata/lists/019_list_types.txtar +++ b/cue/testdata/lists/019_list_types.txtar @@ -121,11 +121,11 @@ Leaks: 15 Freed: 26 Reused: 23 Allocs: 18 -Retain: 42 +Retain: 20 Unifications: 41 Conjuncts: 75 -Disjuncts: 67 +Disjuncts: 45 -- out/eval -- Errors: e0: incompatible list lengths (1 and 2) diff --git a/cue/testdata/lists/020_list_arithmetic.txtar b/cue/testdata/lists/020_list_arithmetic.txtar index 62b0d399037..fb3626e9359 100644 --- a/cue/testdata/lists/020_list_arithmetic.txtar +++ b/cue/testdata/lists/020_list_arithmetic.txtar @@ -329,7 +329,7 @@ Leaks: 198 Freed: 133 Reused: 130 Allocs: 201 -Retain: 390 +Retain: 210 Unifications: 331 Conjuncts: 475 diff --git a/cue/testdata/resolve/038_incomplete_comprehensions.txtar b/cue/testdata/resolve/038_incomplete_comprehensions.txtar index eac7b3820ef..67e1e3df73f 100644 --- a/cue/testdata/resolve/038_incomplete_comprehensions.txtar +++ b/cue/testdata/resolve/038_incomplete_comprehensions.txtar @@ -52,7 +52,7 @@ Leaks: 0 Freed: 11 Reused: 6 Allocs: 5 -Retain: 11 +Retain: 9 Unifications: 11 Conjuncts: 16 diff --git a/cue/testdata/resolve/047_struct_comprehensions.txtar b/cue/testdata/resolve/047_struct_comprehensions.txtar index 42915e96d74..1d50a87e5f4 100644 --- a/cue/testdata/resolve/047_struct_comprehensions.txtar +++ b/cue/testdata/resolve/047_struct_comprehensions.txtar @@ -80,9 +80,9 @@ reg: 4 -- out/eval/stats -- Leaks: 2 Freed: 12 -Reused: 6 -Allocs: 8 -Retain: 3 +Reused: 7 +Allocs: 7 +Retain: 2 Unifications: 10 Conjuncts: 19 diff --git a/internal/core/adt/expr.go b/internal/core/adt/expr.go index 6d367ddc4b3..6463c0329e8 100644 --- a/internal/core/adt/expr.go +++ b/internal/core/adt/expr.go @@ -1878,7 +1878,6 @@ func (x *ForClause) yield(s *compState) { } } - c.unify(a, partial) if !a.definitelyExists() { continue }