diff --git a/common/jvm/src/main/scala/scalan/reflection/JavaImpl.scala b/common/jvm/src/main/scala/scalan/reflection/JavaImpl.scala index fba9fcd29c..75c46ae352 100644 --- a/common/jvm/src/main/scala/scalan/reflection/JavaImpl.scala +++ b/common/jvm/src/main/scala/scalan/reflection/JavaImpl.scala @@ -134,9 +134,6 @@ object JRConstructor { */ class JRMethod private (val value: Method) extends RMethod { override def invoke(obj: Any, args: AnyRef*): AnyRef = { -// val name = value.getName -// val parameterTypes: Seq[Class[_]] = value.getParameterTypes -// memoize(declaringClass.methods)((name, parameterTypes), this) value.invoke(obj, args:_*) } diff --git a/common/shared/src/main/scala/scalan/TypeDesc.scala b/common/shared/src/main/scala/scalan/RType.scala similarity index 100% rename from common/shared/src/main/scala/scalan/TypeDesc.scala rename to common/shared/src/main/scala/scalan/RType.scala diff --git a/common/shared/src/main/scala/special/collection/CollType.scala b/common/shared/src/main/scala/special/collection/CollType.scala new file mode 100644 index 0000000000..bb14366c0b --- /dev/null +++ b/common/shared/src/main/scala/special/collection/CollType.scala @@ -0,0 +1,11 @@ +package special.collection + +import scalan.RType +import scala.reflect.ClassTag + +/** Type descriptor for `Coll[A]` type. */ +case class CollType[A](tItem: RType[A]) extends RType[Coll[A]] { + override val classTag: ClassTag[Coll[A]] = ClassTag[Coll[A]](classOf[Coll[A]]) + + override def name: String = s"Coll[${tItem.name}]" +} diff --git a/common/shared/src/main/scala/special/collection/CollsOverArrays.scala b/common/shared/src/main/scala/special/collection/CollsOverArrays.scala index 7b91c0f50b..9e93251626 100644 --- a/common/shared/src/main/scala/special/collection/CollsOverArrays.scala +++ b/common/shared/src/main/scala/special/collection/CollsOverArrays.scala @@ -1,10 +1,9 @@ package special.collection import java.util -import scalan._ +import scalan._ // required import scalan.util.CollectionUtil import scalan.RType -import Helpers._ import debox.Buffer import scalan.RType._ import sigmastate.VersionContext diff --git a/common/shared/src/main/scala/special/collection/Helpers.scala b/common/shared/src/main/scala/special/collection/Helpers.scala deleted file mode 100644 index 732603b7e4..0000000000 --- a/common/shared/src/main/scala/special/collection/Helpers.scala +++ /dev/null @@ -1,11 +0,0 @@ -package special.collection - -object Helpers { - private def sameLengthErrorMsg[A,B](xs: Coll[A], ys: Coll[B]) = - s"Collections should have same length but was ${xs.length} and ${ys.length}:\n xs=$xs;\n ys=$ys" - - def requireSameLength[A,B](xs: Coll[A], ys: Coll[B]) = { - require(xs.length == ys.length, sameLengthErrorMsg(xs, ys)) - } - -} diff --git a/common/shared/src/main/scala/special/collection/package.scala b/common/shared/src/main/scala/special/collection/package.scala index b8be71be23..0fea9c92d1 100644 --- a/common/shared/src/main/scala/special/collection/package.scala +++ b/common/shared/src/main/scala/special/collection/package.scala @@ -1,17 +1,9 @@ package special -import scala.language.implicitConversions import scalan.RType -import scala.reflect.{classTag, ClassTag} - -package collection { - /** Type descriptor for `Coll[A]` type. */ - case class CollType[A](tItem: RType[A]) extends RType[Coll[A]] { - override val classTag: ClassTag[Coll[A]] = ClassTag[Coll[A]](classOf[Coll[A]]) - override def name: String = s"Coll[${tItem.name}]" - } -} +import scala.language.implicitConversions +import scala.reflect.classTag package object collection { /** Forces reflection data initialization */ @@ -30,4 +22,11 @@ package object collection { implicit def downcastCollType[A](ct: RType[Coll[A]]): CollType[A] = ct.asInstanceOf[CollType[A]] implicit val collBuilderRType: RType[CollBuilder] = RType.fromClassTag(classTag[CollBuilder]) + + private def sameLengthErrorMsg[A, B](xs: Coll[A], ys: Coll[B]) = + s"Collections should have same length but was ${xs.length} and ${ys.length}:\n xs=$xs;\n ys=$ys" + + def requireSameLength[A, B](xs: Coll[A], ys: Coll[B]) = { + require(xs.length == ys.length, sameLengthErrorMsg(xs, ys)) + } } diff --git a/common/shared/src/main/scala/special/sigma/SigmaDsl.scala b/common/shared/src/main/scala/special/sigma/SigmaDsl.scala index 462c5382ab..325aaa444a 100644 --- a/common/shared/src/main/scala/special/sigma/SigmaDsl.scala +++ b/common/shared/src/main/scala/special/sigma/SigmaDsl.scala @@ -316,7 +316,7 @@ trait Box { * @tparam T expected type of the register. * @return Some(value) if the register is defined AND has the given type. * None otherwise - * @throws special.sigma.InvalidType exception when the type of the register value is + * @throws `sigmastate.eval.InvalidType` exception when the type of the register value is * different from cT. * @since 2.0 */ diff --git a/sc/shared/src/main/scala/scalan/GraphIRReflection.scala b/sc/shared/src/main/scala/scalan/GraphIRReflection.scala index 4be98bdf10..e271d5d176 100644 --- a/sc/shared/src/main/scala/scalan/GraphIRReflection.scala +++ b/sc/shared/src/main/scala/scalan/GraphIRReflection.scala @@ -2,7 +2,8 @@ package scalan import scalan.primitives.Thunks import scalan.reflection.CommonReflection.registerClassEntry -import scalan.reflection.{mkConstructor, mkMethod, CommonReflection} +import scalan.reflection.{CommonReflection, mkConstructor, mkMethod} +import sigmastate.eval.SigmaLibrary import special.CoreLibReflection import special.collection.Colls import special.sigma.SigmaDsl diff --git a/sc/shared/src/main/scala/sigmastate/eval/GraphBuilding.scala b/sc/shared/src/main/scala/sigmastate/eval/GraphBuilding.scala index a992dbf0d7..347468da89 100644 --- a/sc/shared/src/main/scala/sigmastate/eval/GraphBuilding.scala +++ b/sc/shared/src/main/scala/sigmastate/eval/GraphBuilding.scala @@ -4,7 +4,7 @@ import org.ergoplatform._ import scalan.ExactIntegral.{ByteIsExactIntegral, IntIsExactIntegral, LongIsExactIntegral, ShortIsExactIntegral} import scalan.ExactOrdering.{ByteIsExactOrdering, IntIsExactOrdering, LongIsExactOrdering, ShortIsExactOrdering} import scalan.util.Extensions.ByteOps -import scalan.{ExactIntegral, ExactNumeric, ExactOrdering, Lazy, MutableLazy, Nullable, SigmaLibrary} +import scalan.{ExactIntegral, ExactNumeric, ExactOrdering, Lazy, MutableLazy, Nullable} import sigmastate.Values.Value.Typed import sigmastate.Values._ import sigmastate.interpreter.Interpreter.ScriptEnv diff --git a/sc/shared/src/main/scala/scalan/SigmaLibrary.scala b/sc/shared/src/main/scala/sigmastate/eval/SigmaLibrary.scala similarity index 90% rename from sc/shared/src/main/scala/scalan/SigmaLibrary.scala rename to sc/shared/src/main/scala/sigmastate/eval/SigmaLibrary.scala index 46c235758b..bc1e17d228 100644 --- a/sc/shared/src/main/scala/scalan/SigmaLibrary.scala +++ b/sc/shared/src/main/scala/sigmastate/eval/SigmaLibrary.scala @@ -1,5 +1,6 @@ -package scalan +package sigmastate.eval +import scalan.Library import special.sigma.SigmaDslModule /** Main trait which represents sigma operations in graph IR cake. */ diff --git a/sc/shared/src/main/scala/sigmastate/eval/TreeBuilding.scala b/sc/shared/src/main/scala/sigmastate/eval/TreeBuilding.scala index f6e77f12e0..d0245f5799 100644 --- a/sc/shared/src/main/scala/sigmastate/eval/TreeBuilding.scala +++ b/sc/shared/src/main/scala/sigmastate/eval/TreeBuilding.scala @@ -10,7 +10,6 @@ import sigmastate.serialization.ConstantStore import scala.collection.mutable.ArrayBuffer import SType._ -import scalan.SigmaLibrary import sigmastate.basics.DLogProtocol.ProveDlog import sigmastate.basics.ProveDHTuple import sigmastate.lang.Terms diff --git a/sc/shared/src/main/scala/special/sigma/SigmaDslUnit.scala b/sc/shared/src/main/scala/special/sigma/SigmaDslUnit.scala index 43ba7f5db2..0ac9882574 100644 --- a/sc/shared/src/main/scala/special/sigma/SigmaDslUnit.scala +++ b/sc/shared/src/main/scala/special/sigma/SigmaDslUnit.scala @@ -1,5 +1,6 @@ package special.sigma { import scalan._ + import sigmastate.eval.SigmaLibrary trait SigmaDsl extends Base { self: SigmaLibrary => trait BigInt extends Def[BigInt] { diff --git a/sc/shared/src/main/scala/special/sigma/impl/SigmaDslImpl.scala b/sc/shared/src/main/scala/special/sigma/impl/SigmaDslImpl.scala index 0642168d68..c56beb83cb 100644 --- a/sc/shared/src/main/scala/special/sigma/impl/SigmaDslImpl.scala +++ b/sc/shared/src/main/scala/special/sigma/impl/SigmaDslImpl.scala @@ -1,13 +1,14 @@ package special.sigma -import scala.language.{existentials,implicitConversions} +import scala.language.{existentials, implicitConversions} import scalan._ +import sigmastate.eval.SigmaLibrary + import scala.collection.compat.immutable.ArraySeq package impl { - import scalan.OverloadHack.Overloaded1 - import scalan.reflection.CommonReflection.registerClassEntry - import scalan.reflection.{RClass, RMethod, SRMethod} // manual fix + import scalan.reflection.{RClass, RMethod} + import sigmastate.eval.SigmaLibrary // Abs ----------------------------------- trait SigmaDslDefs extends scalan.Scalan with SigmaDsl {