Skip to content

Commit

Permalink
Hide ofSize even more from scala3 when using tasty
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuncak committed Dec 6, 2024
1 parent 62c0ac8 commit 3138763
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions data-structures/uarray/UArrayExample.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3138763

Please sign in to comment.