diff --git a/data-structures/uarray/UArrayExample.scala b/data-structures/uarray/UArrayExample.scala index 82709a41..27ea4322 100644 --- a/data-structures/uarray/UArrayExample.scala +++ b/data-structures/uarray/UArrayExample.scala @@ -88,20 +88,16 @@ object UArrayExample: end UArray object UArray: - @extern @ignore // used because `new Array[T]` leaks out of @extern due to some compiler magic - def _ofSize[T: ClassTag](size: Int): UArray[T] = { + @extern + def ofSize[T: ClassTag](size: Int): UArray[T] = { + require(0 <= size) @ghost val definedNot = Array.fill(size)(false) given ct: realClassTag[T] = summon[ClassTag[T]].real val content = new Array[T](size) UArray[T](content, size, definedNot) - } - - @extern - def ofSize[T: ClassTag](size: Int): UArray[T] = { - require(0 <= size) - _ofSize[T](size) }.ensuring(res => res.size == size) + end UArray def arr3[T: ClassTag](mk: Int => T): Array[T] =