From 0aa7a94e1032a96a2a72cb6a82824f9fe970d412 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 14 Dec 2022 14:18:44 +0200 Subject: Improve empty simple value to empty list of names reduction heuristics Specifically, do not reduce typed RHS empty simple values for prepend/append and additionally for assignment provided LHS is typed and is a container. --- tests/value/reverse.testscript | 55 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'tests') diff --git a/tests/value/reverse.testscript b/tests/value/reverse.testscript index 9f73981..921d14b 100644 --- a/tests/value/reverse.testscript +++ b/tests/value/reverse.testscript @@ -89,3 +89,58 @@ EOO } } + +: reduce +: +: Test empty simple value reduction heuristics. +: +{ + : typed + : + $* <>"EOO" + x = [string] + n = [string,null] + y = [strings] $x + y += $x + y += $n + print $size($y) + + file{*}: y += $x + file{x}: + print $size($(file{x}: y)) + + for i: $x + print iteration + + print $null($x[0]) + EOI + 2 + 3 + iteration + false + EOO + + : untyped + : + $* <>"EOO" + x = + n = [null] + y = $x + y += $x + y += $n + print $size($y) + + file{*}: y += $x + file{x}: + print $size($(file{x}: y)) + + for i: $x + print iteration + + print $null($x[0]) + EOI + 0 + 0 + true + EOO +} -- cgit v1.1