aboutsummaryrefslogblamecommitdiff
path: root/tests/pending/run/reflection-sync-subtypes.scala
blob: 1542b816f34956d8b7799d4d764ab65282a5ead4 (plain) (tree)
1
2
3
4
5
6
7
8

                                       
                                             


                                   

                                                










                                                                                                                                   
 
import scala.reflect.runtime.universe._

object Test extends dotty.runtime.LegacyApp {
  val n = 1000
  val rng = new scala.util.Random()
  val tasks = List(
    () => typeOf[List[Int]] <:< typeOf[List[_]],
    () => typeOf[List[_]] <:< typeOf[List[Any]],
    () => typeOf[Map[Int, Object]] <:< typeOf[Iterable[(Int, String)]],
    () => typeOf[Expr[Any] { val mirror: rootMirror.type }] <:< typeOf[Expr[List[List[List[Int]]]]{ val mirror: rootMirror.type }])
  val perms = tasks.permutations.toList
  val diceRolls = List.fill(n)(rng.nextInt(perms.length))
  val threads = (1 to n) map (i => new Thread(s"Reflector-$i") {
    override def run(): Unit = {
      val result = perms(diceRolls(i - 1)).map(_())
      assert(result.sorted == List(false, false, true, true))
    }
  })
  threads foreach (_.start)
}