Skip to content

Commit

Permalink
Fix native
Browse files Browse the repository at this point in the history
  • Loading branch information
armanbilge committed Jan 9, 2025
1 parent b7681ca commit e3d17fc
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions utest/src-native/utest/PlatformShims.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,15 @@ package utest

// Taken from the implementation for JS

import scala.concurrent.Future
import scala.concurrent.{Await, Future}
import concurrent.duration._
import scala.scalanative.reflect.Reflect

/**
* Platform specific stuff that differs between JVM, JS and Native
*/
object PlatformShims {
def await[T](f: Future[T]): T = {
scala.scalanative.runtime.loop()
f.value match {
case Some(v) => v.get
case None => throw new IllegalStateException(
"Test that returns Future must be run asynchronously in Scala Native, see TestTreeSeq::runAsync"
)
}
}
def await[T](f: Future[T]): T = Await.result(f, Duration.Inf)

type EnableReflectiveInstantiation =
scala.scalanative.reflect.annotation.EnableReflectiveInstantiation
Expand Down

0 comments on commit e3d17fc

Please sign in to comment.