From 537aefec06307139899e3f2f2cd74842a3af6345 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 23 Sep 2023 17:04:31 +0100 Subject: Generate code for zero-element tuple without alloc --- .../shedlang/compiler/patio/PatioCodeGenTupleCreateTests.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/test/java') diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenTupleCreateTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenTupleCreateTests.java index b95ca4fb..e489fb37 100644 --- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenTupleCreateTests.java +++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenTupleCreateTests.java @@ -26,4 +26,14 @@ public class PatioCodeGenTupleCreateTests { snapshotter.assertSnapshot(serialize(result)); } + + @Test + public void zeroElementTupleIsCreatedWithoutAlloc(Snapshotter snapshotter) throws IOException { + var stackIr = Instructions.tupleCreate(0); + var context = PatioCodeGenContext.EMPTY; + + var result = PatioCodeGen.generateInstruction(stackIr, context); + + snapshotter.assertSnapshot(serialize(result)); + } } -- cgit v1.2.3