Skip to content

Commit

Permalink
polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
kushti committed Oct 22, 2024
1 parent 5f6b9ee commit 03bfd6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
10 changes: 5 additions & 5 deletions data/shared/src/main/scala/sigma/ast/methods.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._

Expand Down Expand Up @@ -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()
}
}

Expand All @@ -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()
}
}

Expand All @@ -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()
}
}

Expand Down

0 comments on commit 03bfd6a

Please sign in to comment.