Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Hide ofSize even more from scala3 when using tasty" #119

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions data-structures/uarray/UArrayExample.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
Expand Down