diff --git a/fundamentals/fundamentals-reflection/src/main/scala/com/github/pshirshov/izumi/fundamentals/reflection/SafeType0.scala b/fundamentals/fundamentals-reflection/src/main/scala/com/github/pshirshov/izumi/fundamentals/reflection/SafeType0.scala index 9f7f8070bc..487df7a194 100644 --- a/fundamentals/fundamentals-reflection/src/main/scala/com/github/pshirshov/izumi/fundamentals/reflection/SafeType0.scala +++ b/fundamentals/fundamentals-reflection/src/main/scala/com/github/pshirshov/izumi/fundamentals/reflection/SafeType0.scala @@ -1,7 +1,6 @@ package com.github.pshirshov.izumi.fundamentals.reflection import com.github.pshirshov.izumi.fundamentals.reflection.ReflectionUtil._ -import com.github.pshirshov.izumi.fundamentals.reflection.SafeType0.globalSubtypeCheckLock import scala.reflect.runtime.{universe => ru} @@ -73,23 +72,21 @@ class SafeType0[U <: SingletonUniverse]( } } + // <:< is not thread-safe and upstream refuses to fix that. + // /~https://github.com/scala/bug/issues/10766 final def <:<(that: SafeType0[U]): Boolean = - globalSubtypeCheckLock.synchronized { + SafeType0.synchronized { dealiased <:< that.dealiased || freeTermPrefixTypeSuffixHeuristicEq(_ <:< _, dealiased, that.dealiased) } final def weak_<:<(that: SafeType0[U]): Boolean = - globalSubtypeCheckLock.synchronized { + SafeType0.synchronized { (dealiased weak_<:< that.dealiased) || freeTermPrefixTypeSuffixHeuristicEq(_ weak_<:< _, dealiased, that.dealiased) } } object SafeType0 { - // <:< is not thread-safe and upstream refuses to fix that. - // /~https://github.com/scala/bug/issues/10766 - private[SafeType0] object globalSubtypeCheckLock - def apply[U <: SingletonUniverse](u: U, tpe: U#Type): SafeType0[U] = new SafeType0[U](u, tpe) def apply(tpe: ru.Type): SafeType0[ru.type] = new SafeType0[ru.type](ru, tpe)