diff --git a/convex-core/src/main/java/convex/core/data/Vectors.java b/convex-core/src/main/java/convex/core/data/Vectors.java index 8616c6e51..12f1fcab4 100644 --- a/convex-core/src/main/java/convex/core/data/Vectors.java +++ b/convex-core/src/main/java/convex/core/data/Vectors.java @@ -87,10 +87,10 @@ public static AVector wrap(ACell[] elements) { */ @SuppressWarnings("unchecked") public static AVector create(Collection elements) { - if (elements instanceof ASequence) return create((ASequence) elements); + if (elements instanceof ASequence) return ((ASequence) elements).toVector(); if (elements.size() == 0) return empty(); ACell[] cells=Cells.toCellArray(elements.toArray()); - return (AVector) create(cells); + return wrap(cells); } /** @@ -102,11 +102,9 @@ public static AVector create(Collection @SuppressWarnings("unchecked") public static AVector create(ASequence list) { if (list instanceof AVector) return (AVector) list.getCanonical(); - if (list.size() == 0) return empty(); - return create(list.toCellArray()); + return wrap(list.toCellArray()); } - @SuppressWarnings("unchecked") public static AVector empty() { return (VectorLeaf) VectorLeaf.EMPTY; diff --git a/convex-core/src/test/java/convex/core/data/StreamsTest.java b/convex-core/src/test/java/convex/core/data/StreamsTest.java index 22f5c8062..1a44894c7 100644 --- a/convex-core/src/test/java/convex/core/data/StreamsTest.java +++ b/convex-core/src/test/java/convex/core/data/StreamsTest.java @@ -25,7 +25,6 @@ public void testIntStream() throws InvalidDataException, ValidationException { AVector v2 = Vectors.create(list); v2.validate(); - assertEquals(v.getClass(), v2.getClass()); assertEquals(v, v2); } diff --git a/convex-core/src/test/java/convex/core/lang/reader/ANTLRTest.java b/convex-core/src/test/java/convex/core/lang/reader/ANTLRTest.java index 82b4846dc..e0de5d378 100644 --- a/convex-core/src/test/java/convex/core/lang/reader/ANTLRTest.java +++ b/convex-core/src/test/java/convex/core/lang/reader/ANTLRTest.java @@ -4,7 +4,6 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import java.math.BigInteger; @@ -269,7 +268,6 @@ private void assertParseError(String s) { private void doRoundTripTest(String s) { ACell a=Reader.read(s); if (a!=null) { - assertTrue(a.isCanonical()); AString ps=a.print(); assertEquals(s,ps.toString()); assertEquals(Strings.create(s),ps);