From 3138763f33435bd6747a67e5a30010ff7f89a04e Mon Sep 17 00:00:00 2001 From: Viktor Kuncak Date: Fri, 6 Dec 2024 22:52:54 +0100 Subject: [PATCH] Hide ofSize even more from scala3 when using tasty --- data-structures/uarray/UArrayExample.scala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/data-structures/uarray/UArrayExample.scala b/data-structures/uarray/UArrayExample.scala index 27ea4322..82709a41 100644 --- a/data-structures/uarray/UArrayExample.scala +++ b/data-structures/uarray/UArrayExample.scala @@ -88,15 +88,19 @@ object UArrayExample: end UArray object UArray: - @extern - def ofSize[T: ClassTag](size: Int): UArray[T] = { - require(0 <= size) + @extern @ignore // used because `new Array[T]` leaks out of @extern due to some compiler magic + def _ofSize[T: ClassTag](size: Int): UArray[T] = { @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) - }.ensuring(res => res.size == size) + } + @extern + def ofSize[T: ClassTag](size: Int): UArray[T] = { + require(0 <= size) + _ofSize[T](size) + }.ensuring(res => res.size == size) end UArray