From 03bfd6aca0115690b04b4c8b02f2b826f80f37b5 Mon Sep 17 00:00:00 2001 From: Alexander Chepurnoy Date: Wed, 23 Oct 2024 00:05:24 +0300 Subject: [PATCH] polishing --- data/shared/src/main/scala/sigma/ast/methods.scala | 10 +++++----- .../scala/sigmastate/utxo/BasicOpsSpecification.scala | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/data/shared/src/main/scala/sigma/ast/methods.scala b/data/shared/src/main/scala/sigma/ast/methods.scala index 62a8691ee..37ca4778f 100644 --- a/data/shared/src/main/scala/sigma/ast/methods.scala +++ b/data/shared/src/main/scala/sigma/ast/methods.scala @@ -1836,19 +1836,19 @@ case object SGlobalMethods extends MonoTypeMethods { } lazy val someMethod = SMethod(this, "some", - SFunc(Array(SGlobal, tT), SOption(tT), Array(paramT)), 8, FixedCost(JitCost(5)), Seq(tT)) // todo: cost + SFunc(Array(SGlobal, tT), SOption(tT), Array(paramT)), 8, FixedCost(JitCost(5)), Seq(tT)) .withIRInfo(MethodCallIrBuilder, javaMethodOf[SigmaDslBuilder, Any, RType[_]]("some"), { mtype => Array(mtype.tRange) }) - .withInfo(MethodCall, "", - ArgInfo("value", "value to be serialized")) + .withInfo(MethodCall, "Wrap given input into optional value (Option()).", + ArgInfo("value", "Value to wrap into Option.")) lazy val noneMethod = SMethod(this, "none", - SFunc(Array(SGlobal), SOption(tT), Array(paramT)), 9, FixedCost(JitCost(5)), Seq(tT)) // todo: cost + SFunc(Array(SGlobal), SOption(tT), Array(paramT)), 9, FixedCost(JitCost(5)), Seq(tT)) .withIRInfo(MethodCallIrBuilder, javaMethodOf[SigmaDslBuilder, RType[_]]("none"), { mtype => Array(mtype.tRange) }) - .withInfo(MethodCall, "") + .withInfo(MethodCall, "Returns empty Option[T] of given type T.") protected override def getMethods() = super.getMethods() ++ { if (VersionContext.current.isV6SoftForkActivated) { diff --git a/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala index f42114148..f15e2e717 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala @@ -27,6 +27,7 @@ import sigma.ast.Apply import sigma.eval.EvalSettings import sigma.exceptions.InvalidType import sigma.serialization.ErgoTreeSerializer +import sigma.validation.ValidationException import sigmastate.utils.Helpers import sigmastate.utils.Helpers._ @@ -1787,7 +1788,7 @@ class BasicOpsSpecification extends CompilerTestingCommons if (VersionContext.current.isV6SoftForkActivated) { someTest() } else { - an[Exception] should be thrownBy someTest() + an[sigmastate.exceptions.MethodNotFound] should be thrownBy someTest() } } @@ -1809,7 +1810,7 @@ class BasicOpsSpecification extends CompilerTestingCommons if (VersionContext.current.isV6SoftForkActivated) { someTest() } else { - an[Exception] should be thrownBy someTest() + an[sigmastate.exceptions.MethodNotFound] should be thrownBy someTest() } } @@ -1831,7 +1832,7 @@ class BasicOpsSpecification extends CompilerTestingCommons if (VersionContext.current.isV6SoftForkActivated) { someTest() } else { - an[Exception] should be thrownBy someTest() + an[sigmastate.exceptions.MethodNotFound] should be thrownBy someTest() } }