diff --git a/convex-core/src/main/java/convex/core/cvm/Syntax.java b/convex-core/src/main/java/convex/core/cvm/Syntax.java index 122e271c1..0892945b1 100644 --- a/convex-core/src/main/java/convex/core/cvm/Syntax.java +++ b/convex-core/src/main/java/convex/core/cvm/Syntax.java @@ -243,7 +243,6 @@ public void validateStructure() throws InvalidDataException { if (datum instanceof Syntax) { throw new InvalidDataException("Cannot double-wrap a Syntax value",this); } - if (!datum.isCVMValue()) throw new InvalidDataException("Syntax can only wrap CVM values",this); } } diff --git a/convex-core/src/test/java/convex/core/data/SyntaxTest.java b/convex-core/src/test/java/convex/core/data/SyntaxTest.java index 1b08e30e2..114ce5b14 100644 --- a/convex-core/src/test/java/convex/core/data/SyntaxTest.java +++ b/convex-core/src/test/java/convex/core/data/SyntaxTest.java @@ -7,6 +7,8 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import java.io.IOException; + import org.junit.jupiter.api.Test; import convex.core.cvm.Address; @@ -75,6 +77,19 @@ private void doSyntaxTest(Syntax s) { } + @Test public void testSytaxEncode() throws BadFormatException, IOException { + + Syntax s=Reader.read("^{} {#1 -9223372036854775808}"); + Blob b=s.getEncoding(); + Syntax s2=Format.read(b); + + assertEquals(s,s2); + + Ref<Syntax> pref=Cells.persist(s).getRef(); + assertEquals(s,pref.getValue()); + + } + @Test public void testSyntaxPrintRegression() { String s="^{} 0xa89e59cc8ab9fc6a13785a37938c85b306b24663415effc01063a6e25ef52ebcd3647d3a77e0a33908a372146fdccab6"; int n=s.length();