From d932f204a74f7f4715f7513d2fcce7664cf28a5b Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 19 Oct 2026 01:54:45 +0100 Subject: Pure 027's 5d: a number, a bool and an i64 carried over each other when exact, else the new default: states 5 and 2.5 (numbers), 7 and 2^53 + 1 (i64s) and a stored list's rows 3, 2.5, -0 and 1e300 (a number field) moved to i64, i64, number and bool states and an i64 field: 5, -2 (its default), 7, false (its default), rows 3, 9, 0, 9; alike on a replace while running and on two starts from the store the old module wrote (moved, then stored as moved); back to the old module, false is the i64 0 --- tests/check.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests') diff --git a/tests/check.py b/tests/check.py index e66a384..234bb4e 100644 --- a/tests/check.py +++ b/tests/check.py @@ -2515,6 +2515,42 @@ def main(): final = json.loads(lines[-1]) assert final['states'] == {'bonus': 7, 'count': 9} and final['views'] == {'doubled': 18}, final report['replace_keeps_states_by_name'] = True + # A number, a bool and an i64 carry over each other when exact (Pure 027's 5d), else take the new default: on a + # replace and on a start from a store the old module wrote, its states and a stored list's fields alike. + kinds = ('record Row {\n a@A\n}\nstate x@X\nstate y@Y\nstate w@W\nstate v@V\nstate rows: list of Row\n' + 'input set = message {\n x: number\n y: number\n w: i64\n v: i64\n}\ninput add = message { a: number }\n' + 'on set {\n x = set.x\n y = set.y\n w = set.w\n v = set.v\n}\non add { rows.append(Row { a: add.a }) }\n' + 'view cells = each r in rows {\n a = r.a\n}\n') + before = {'A': ' = 0', 'X': ' = 0', 'Y': ' = 0', 'W': ': i64', 'V': ': i64'} + after = {'A': ': i64 = 9', 'X': ': i64 = -1', 'Y': ': i64 = -2', 'W': ' = 3', 'V': ' = false'} + for name, types in (('kinds-before', before), ('kinds-after', after)): + source = kinds + for mark, written in types.items(): + source = source.replace('@' + mark, written) + if name == 'kinds-after': # its handlers would not type: the states alone, and the view + source = source.split('input set')[0] + 'view cells = each r in rows {\n a = r.a\n}\n' + (work / f'{name}.aup').write_text(source) + compile_module(aup, work / f'{name}.aup', work / f'{name}.pmod') + given = f"message set {struct.pack('