Skip to content

Commit

Permalink
Remove obsolete isEntityType and isBaseType methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Romanov committed Dec 16, 2016
1 parent b494dad commit 2ac16a9
Show file tree
Hide file tree
Showing 44 changed files with 2 additions and 147 deletions.
Expand Up @@ -20,7 +20,6 @@ trait BitSetsAbs extends scalan.ScalanDsl with BitSets {
extends EntityElem[To] {
lazy val parent: Option[Elem[_]] = None
lazy val typeArgs = TypeArgs()
override def isEntityType = true
override lazy val tag = {
weakTypeTag[BitSet].asInstanceOf[WeakTypeTag[To]]
}
Expand Down Expand Up @@ -94,7 +93,6 @@ trait BitSetsAbs extends scalan.ScalanDsl with BitSets {
def productElement(n: Int) = ???
}
case class BoolCollBitSetIsoElem() extends Elem[BoolCollBitSetIso] {
def isEntityType = true
def getDefaultRep = reifyObject(new BoolCollBitSetIso())
lazy val tag = {
weakTypeTag[BoolCollBitSetIso]
Expand Down
Expand Up @@ -27,7 +27,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
def eItem = _eItem
lazy val parent: Option[Elem[_]] = None
lazy val typeArgs = TypeArgs("Item" -> (eItem -> scalan.util.Covariant))
override def isEntityType = true
override lazy val tag = {
implicit val tagAnnotatedItem = eItem.tag
weakTypeTag[Collection[Item]].asInstanceOf[WeakTypeTag[To]]
Expand Down Expand Up @@ -75,7 +74,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
def eB = _eB
override lazy val parent: Option[Elem[_]] = Some(collectionElement(pairElement(element[A],element[B])))
override lazy val typeArgs = TypeArgs("A" -> (eA -> scalan.util.Invariant), "B" -> (eB -> scalan.util.Invariant))
override def isEntityType = true
override lazy val tag = {
implicit val tagA = eA.tag
implicit val tagB = eB.tag
Expand Down Expand Up @@ -123,7 +121,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
def eA = _eA
override lazy val parent: Option[Elem[_]] = Some(collectionElement(collectionElement(element[A])))
override lazy val typeArgs = TypeArgs("A" -> (eA -> scalan.util.Invariant))
override def isEntityType = true
override lazy val tag = {
implicit val tagA = eA.tag
weakTypeTag[NestedCollection[A]].asInstanceOf[WeakTypeTag[To]]
Expand Down Expand Up @@ -198,7 +195,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
def productElement(n: Int) = ???
}
case class UnitCollectionIsoElem() extends Elem[UnitCollectionIso] {
def isEntityType = true
def getDefaultRep = reifyObject(new UnitCollectionIso())
lazy val tag = {
weakTypeTag[UnitCollectionIso]
Expand Down Expand Up @@ -281,7 +277,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
def productElement(n: Int) = eItem
}
case class CollectionOverArrayIsoElem[Item](eItem: Elem[Item]) extends Elem[CollectionOverArrayIso[Item]] {
def isEntityType = true
def getDefaultRep = reifyObject(new CollectionOverArrayIso[Item]()(eItem))
lazy val tag = {
implicit val tagItem = eItem.tag
Expand Down Expand Up @@ -365,7 +360,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
def productElement(n: Int) = eItem
}
case class CollectionOverListIsoElem[Item](eItem: Elem[Item]) extends Elem[CollectionOverListIso[Item]] {
def isEntityType = true
def getDefaultRep = reifyObject(new CollectionOverListIso[Item]()(eItem))
lazy val tag = {
implicit val tagItem = eItem.tag
Expand Down Expand Up @@ -449,7 +443,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
def productElement(n: Int) = eItem
}
case class CollectionOverSeqIsoElem[Item](eItem: Elem[Item]) extends Elem[CollectionOverSeqIso[Item]] {
def isEntityType = true
def getDefaultRep = reifyObject(new CollectionOverSeqIso[Item]()(eItem))
lazy val tag = {
implicit val tagItem = eItem.tag
Expand Down Expand Up @@ -537,7 +530,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
}
}
case class PairCollectionSOAIsoElem[A, B](eA: Elem[A], eB: Elem[B]) extends Elem[PairCollectionSOAIso[A, B]] {
def isEntityType = true
def getDefaultRep = reifyObject(new PairCollectionSOAIso[A, B]()(eA, eB))
lazy val tag = {
implicit val tagA = eA.tag
Expand Down Expand Up @@ -628,7 +620,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
}
}
case class PairCollectionAOSIsoElem[A, B](eA: Elem[A], eB: Elem[B]) extends Elem[PairCollectionAOSIso[A, B]] {
def isEntityType = true
def getDefaultRep = reifyObject(new PairCollectionAOSIso[A, B]()(eA, eB))
lazy val tag = {
implicit val tagA = eA.tag
Expand Down Expand Up @@ -713,7 +704,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
def productElement(n: Int) = eA
}
case class NestedCollectionFlatIsoElem[A](eA: Elem[A]) extends Elem[NestedCollectionFlatIso[A]] {
def isEntityType = true
def getDefaultRep = reifyObject(new NestedCollectionFlatIso[A]()(eA))
lazy val tag = {
implicit val tagA = eA.tag
Expand Down Expand Up @@ -799,7 +789,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
def productElement(n: Int) = eA
}
case class JuggedCollectionIsoElem[A](eA: Elem[A]) extends Elem[JuggedCollectionIso[A]] {
def isEntityType = true
def getDefaultRep = reifyObject(new JuggedCollectionIso[A]()(eA))
lazy val tag = {
implicit val tagA = eA.tag
Expand Down Expand Up @@ -890,7 +879,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
}
}
case class FuncCollectionIsoElem[A, B, Env](eA: Elem[A], eB: Elem[B], eEnv: Elem[Env]) extends Elem[FuncCollectionIso[A, B, Env]] {
def isEntityType = true
def getDefaultRep = reifyObject(new FuncCollectionIso[A, B, Env]()(eA, eB, eEnv))
lazy val tag = {
implicit val tagA = eA.tag
Expand Down Expand Up @@ -983,7 +971,6 @@ trait CollectionsAbs extends scalan.ScalanDsl with Collections {
}
}
case class StructItemCollectionIsoElem[Val, Schema <: Struct](eVal: Elem[Val], eSchema: Elem[Schema]) extends Elem[StructItemCollectionIso[Val, Schema]] {
def isEntityType = true
def getDefaultRep = reifyObject(new StructItemCollectionIso[Val, Schema]()(eVal, eSchema))
lazy val tag = {
implicit val tagVal = eVal.tag
Expand Down
Expand Up @@ -68,7 +68,6 @@ trait HashSetsAbs extends scalan.ScalanDsl with HashSets {
def eA = _eA
lazy val parent: Option[Elem[_]] = None
lazy val typeArgs = TypeArgs("A" -> (eA -> scalan.util.Invariant))
override def isEntityType = true
override lazy val tag = {
implicit val tagA = eA.tag
weakTypeTag[SHashSet[A]].asInstanceOf[WeakTypeTag[To]]
Expand Down Expand Up @@ -165,7 +164,6 @@ trait HashSetsAbs extends scalan.ScalanDsl with HashSets {
def productElement(n: Int) = eA
}
case class SHashSetImplIsoElem[A](eA: Elem[A]) extends Elem[SHashSetImplIso[A]] {
def isEntityType = true
def getDefaultRep = reifyObject(new SHashSetImplIso[A]()(eA))
lazy val tag = {
implicit val tagA = eA.tag
Expand Down
Expand Up @@ -21,7 +21,6 @@ trait MultiMapsAbs extends scalan.ScalanDsl with MultiMaps {
def elemValue = _elemValue
lazy val parent: Option[Elem[_]] = None
lazy val typeArgs = TypeArgs("K" -> (elemKey -> scalan.util.Invariant), "V" -> (elemValue -> scalan.util.Invariant))
override def isEntityType = true
override lazy val tag = {
implicit val tagK = elemKey.tag
implicit val tagV = elemValue.tag
Expand Down Expand Up @@ -102,7 +101,6 @@ trait MultiMapsAbs extends scalan.ScalanDsl with MultiMaps {
}
}
case class HashMMultiMapIsoElem[K, V](elemKey: Elem[K], elemValue: Elem[V]) extends Elem[HashMMultiMapIso[K, V]] {
def isEntityType = true
def getDefaultRep = reifyObject(new HashMMultiMapIso[K, V]()(elemKey, elemValue))
lazy val tag = {
implicit val tagK = elemKey.tag
Expand Down
Expand Up @@ -69,7 +69,6 @@ trait SeqsAbs extends scalan.ScalanDsl with Seqs {
def eA = _eA
lazy val parent: Option[Elem[_]] = None
lazy val typeArgs = TypeArgs("A" -> (eA -> scalan.util.Invariant))
override def isEntityType = true
override lazy val tag = {
implicit val tagA = eA.tag
weakTypeTag[SSeq[A]].asInstanceOf[WeakTypeTag[To]]
Expand Down Expand Up @@ -206,7 +205,6 @@ trait SeqsAbs extends scalan.ScalanDsl with Seqs {
def productElement(n: Int) = eA
}
case class SSeqImplIsoElem[A](eA: Elem[A]) extends Elem[SSeqImplIso[A]] {
def isEntityType = true
def getDefaultRep = reifyObject(new SSeqImplIso[A]()(eA))
lazy val tag = {
implicit val tagA = eA.tag
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/scala/scalan/Entities.scala
Expand Up @@ -169,8 +169,6 @@ trait Entities extends TypeDescs { self: Scalan =>
}
}
trait CompanionElem[T] extends Elem[T] { _: scala.Equals =>
override def isEntityType = false

lazy val typeArgs = TypeArgs()
override protected def _copyWithTypeArgs(args: Iterator[TypeDesc]): Elem[_] = this
}
Expand Down
3 changes: 0 additions & 3 deletions core/src/main/scala/scalan/JNIExtractorOps.scala
Expand Up @@ -28,16 +28,13 @@ trait JNIExtractorOps extends Base { self: Scalan with AbstractStringsDsl =>
weakTypeTag[JNIType[T]]
}

override def isEntityType: Boolean = eT.isEntityType

lazy val getDefaultRep = null.asInstanceOf[Rep[JNIType[T]]]

lazy val typeArgs = TypeArgs("T" -> (eT -> Invariant))
}

case class JNIArrayElem[A](override val eItem: Elem[A]) extends ArrayElem[A]()(eItem) {
def parent: Option[Elem[_]] = Some(arrayElement(eItem))
override def isEntityType = eItem.isEntityType
override lazy val typeArgs = TypeArgs("A" -> (eItem -> Invariant))
override def getName(f: TypeDesc => String) = s"JNI-${super.getName(f)}"

Expand Down
7 changes: 0 additions & 7 deletions core/src/main/scala/scalan/TypeDescs.scala
Expand Up @@ -37,8 +37,6 @@ trait TypeDescs extends Base { self: Scalan =>
*/
@implicitNotFound(msg = "No Elem available for ${A}.")
abstract class Elem[A] extends TypeDesc { _: scala.Equals =>
def isEntityType: Boolean
def isBaseType: Boolean = this.isInstanceOf[BaseElem[_]]
def tag: WeakTypeTag[A]
final lazy val classTag: ClassTag[A] = ReflectionUtil.typeTagToClassTag(tag)
// classTag.runtimeClass is cheap, no reason to make it lazy
Expand Down Expand Up @@ -207,7 +205,6 @@ trait TypeDescs extends Base { self: Scalan =>

class BaseElem[A](defaultValue: A)(implicit val tag: WeakTypeTag[A]) extends Elem[A] with Serializable with scala.Equals {
protected def getDefaultRep = toRep(defaultValue)(this)
override def isEntityType = false
override def canEqual(other: Any) = other.isInstanceOf[BaseElem[_]]
override def equals(other: Any) = other match {
case other: BaseElem[_] =>
Expand Down Expand Up @@ -235,7 +232,6 @@ trait TypeDescs extends Base { self: Scalan =>

case class PairElem[A, B](eFst: Elem[A], eSnd: Elem[B]) extends Elem[(A, B)] {
assert(eFst != null && eSnd != null)
override def isEntityType = eFst.isEntityType || eSnd.isEntityType
lazy val tag = {
implicit val tA = eFst.tag
implicit val tB = eSnd.tag
Expand All @@ -247,7 +243,6 @@ trait TypeDescs extends Base { self: Scalan =>
}

case class SumElem[A, B](eLeft: Elem[A], eRight: Elem[B]) extends Elem[A | B] {
override def isEntityType = eLeft.isEntityType || eRight.isEntityType
lazy val tag = {
implicit val tA = eLeft.tag
implicit val tB = eRight.tag
Expand All @@ -259,7 +254,6 @@ trait TypeDescs extends Base { self: Scalan =>
}

case class FuncElem[A, B](eDom: Elem[A], eRange: Elem[B]) extends Elem[A => B] {
override def isEntityType = eDom.isEntityType || eRange.isEntityType
lazy val tag = {
implicit val tA = eDom.tag
implicit val tB = eRange.tag
Expand All @@ -276,7 +270,6 @@ trait TypeDescs extends Base { self: Scalan =>
class ArgElem(val tyArg: STpeArg) extends Elem[Any] with Serializable with scala.Equals {
protected def getDefaultRep = toRep(null.asInstanceOf[Any])(this)
val tag = ReflectionUtil.createArgTypeTag(tyArg.name).asInstanceOf[WeakTypeTag[Any]]
override def isEntityType = false
def argName = tyArg.name
lazy val typeArgs = {
assert(noTypeArgs)
Expand Down
1 change: 0 additions & 1 deletion core/src/main/scala/scalan/Views.scala
Expand Up @@ -272,7 +272,6 @@ trait ViewsDsl extends impl.ViewsAbs { self: Scalan =>

trait ViewElem[From, To] extends Elem[To] { _: scala.Equals =>
def iso: Iso[From, To]
override def isEntityType = shouldUnpack(this)

override protected def _copyWithTypeArgs(argsIterator: Iterator[TypeDesc]): Elem[_] =
if (typeArgs.isEmpty)
Expand Down
1 change: 0 additions & 1 deletion core/src/main/scala/scalan/arrays/ArrayOps.scala
Expand Up @@ -121,7 +121,6 @@ trait ArrayOps { self: Scalan =>
case class ScalaArrayElem[A](override val eItem: Elem[A]) extends ArrayElem[A]()(eItem) {
def parent: Option[Elem[_]] = Some(arrayElement(eItem))

override def isEntityType = eItem.isEntityType
lazy val tag = {
implicit val tag1 = eItem.tag
weakTypeTag[Array[A]]
Expand Down
1 change: 0 additions & 1 deletion core/src/main/scala/scalan/collections/ArrayBuffer.scala
Expand Up @@ -45,7 +45,6 @@ trait ArrayBuffers extends Base { self: Scalan =>
case class ArrayBufferElem[A](override val eItem: Elem[A])
extends EntityElem1[A, ArrayBuffer[A], ArrayBuffer](eItem, container[ArrayBuffer]) {
def parent: Option[Elem[_]] = None
override def isEntityType = eItem.isEntityType
override lazy val typeArgs = TypeArgs("A" -> (eItem -> Invariant))

lazy val tag = {
Expand Down
1 change: 0 additions & 1 deletion core/src/main/scala/scalan/collections/ListOps.scala
Expand Up @@ -64,7 +64,6 @@ trait ListOps { self: Scalan =>
case class ListElem[A](override val eItem: Elem[A])
extends EntityElem1[A, List[A], List](eItem, container[List]) {
def parent: Option[Elem[_]] = None
override def isEntityType = eItem.isEntityType
override lazy val typeArgs = TypeArgs("A" -> (eItem -> Covariant))
lazy val tag = {
implicit val rt = eItem.tag
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/scala/scalan/collections/MapOps.scala
Expand Up @@ -43,8 +43,6 @@ trait MapOps extends Base { self: Scalan =>
}

case class MMapElem[K, V](eKey: Elem[K], eValue: Elem[V]) extends Elem[MMap[K, V]] {
override def isEntityType = eKey.isEntityType || eValue.isEntityType

lazy val tag = {
implicit val kt = eKey.tag
implicit val vt = eValue.tag
Expand Down
8 changes: 0 additions & 8 deletions core/src/main/scala/scalan/impl/ConvertersImpl.scala
Expand Up @@ -23,7 +23,6 @@ trait ConvertersAbs extends Converters {
def eR = _eR
lazy val parent: Option[Elem[_]] = None
lazy val typeArgs = TypeArgs("T" -> (eT -> scalan.util.Invariant), "R" -> (eR -> scalan.util.Invariant))
override def isEntityType = true
override lazy val tag = {
implicit val tagT = eT.tag
implicit val tagR = eR.tag
Expand Down Expand Up @@ -100,7 +99,6 @@ trait ConvertersAbs extends Converters {
def productElement(n: Int) = eA
}
case class IdentityConvIsoElem[A](eA: Elem[A]) extends Elem[IdentityConvIso[A]] {
def isEntityType = true
def getDefaultRep = reifyObject(new IdentityConvIso[A]()(eA))
lazy val tag = {
implicit val tagA = eA.tag
Expand Down Expand Up @@ -190,7 +188,6 @@ trait ConvertersAbs extends Converters {
}
}
case class BaseConverterIsoElem[T, R](eT: Elem[T], eR: Elem[R]) extends Elem[BaseConverterIso[T, R]] {
def isEntityType = true
def getDefaultRep = reifyObject(new BaseConverterIso[T, R]()(eT, eR))
lazy val tag = {
implicit val tagT = eT.tag
Expand Down Expand Up @@ -284,7 +281,6 @@ trait ConvertersAbs extends Converters {
}
}
case class PairConverterIsoElem[A1, A2, B1, B2](eA1: Elem[A1], eA2: Elem[A2], eB1: Elem[B1], eB2: Elem[B2]) extends Elem[PairConverterIso[A1, A2, B1, B2]] {
def isEntityType = true
def getDefaultRep = reifyObject(new PairConverterIso[A1, A2, B1, B2]()(eA1, eA2, eB1, eB2))
lazy val tag = {
implicit val tagA1 = eA1.tag
Expand Down Expand Up @@ -382,7 +378,6 @@ trait ConvertersAbs extends Converters {
}
}
case class SumConverterIsoElem[A1, A2, B1, B2](eA1: Elem[A1], eA2: Elem[A2], eB1: Elem[B1], eB2: Elem[B2]) extends Elem[SumConverterIso[A1, A2, B1, B2]] {
def isEntityType = true
def getDefaultRep = reifyObject(new SumConverterIso[A1, A2, B1, B2]()(eA1, eA2, eB1, eB2))
lazy val tag = {
implicit val tagA1 = eA1.tag
Expand Down Expand Up @@ -478,7 +473,6 @@ trait ConvertersAbs extends Converters {
}
}
case class ComposeConverterIsoElem[A, B, C](eA: Elem[A], eB: Elem[B], eC: Elem[C]) extends Elem[ComposeConverterIso[A, B, C]] {
def isEntityType = true
def getDefaultRep = reifyObject(new ComposeConverterIso[A, B, C]()(eA, eB, eC))
lazy val tag = {
implicit val tagA = eA.tag
Expand Down Expand Up @@ -572,7 +566,6 @@ trait ConvertersAbs extends Converters {
}
}
case class FunctorConverterIsoElem[A, B, F[_]](eA: Elem[A], eB: Elem[B], F: Functor[F]) extends Elem[FunctorConverterIso[A, B, F]] {
def isEntityType = true
def getDefaultRep = reifyObject(new FunctorConverterIso[A, B, F]()(eA, eB, F))
lazy val tag = {
implicit val tagA = eA.tag
Expand Down Expand Up @@ -661,7 +654,6 @@ trait ConvertersAbs extends Converters {
}
}
case class NaturalConverterIsoElem[A, F[_], G[_]](eA: Elem[A], cF: Cont[F], cG: Cont[G]) extends Elem[NaturalConverterIso[A, F, G]] {
def isEntityType = true
def getDefaultRep = reifyObject(new NaturalConverterIso[A, F, G]()(eA, cF, cG))
lazy val tag = {
implicit val tagA = eA.tag
Expand Down

0 comments on commit 2ac16a9

Please sign in to comment.