Skip to content

Commit

Permalink
Merge pull request #1509 from wavesplatform/node-1182-allow-leak
Browse files Browse the repository at this point in the history
Node 1182 allow leak
  • Loading branch information
ismagin authored Sep 26, 2018
2 parents 747fe6f + 3040b9d commit fb0966c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class IntegrationTest extends PropSpec with PropertyChecks with ScriptGen with M
eval[Long](script, Some(pointAInstance)) shouldBe Right(5)
}

property("context won't change after execution of a user function") {
ignore("context won't change after execution of a user function") {
val doubleFst = UserFunction("ID", LONG, "x" -> LONG) {
FUNCTION_CALL(PureContext.sumLong.header, List(REF("x"), REF("x")))
}
Expand All @@ -299,7 +299,7 @@ class IntegrationTest extends PropSpec with PropertyChecks with ScriptGen with M
ev[Long](context, expr) shouldBe Right(2003l)
}

property("context won't change after execution of an inner block") {
ignore("context won't change after execution of an inner block") {
val context = Monoid.combine(
PureContext.evalContext,
EvaluationContext(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object EvaluatorV1 extends ExprEvaluator {
ctx <- get[LoggedEvaluationContext, ExecutionError]
blockEvaluation = evalExpr(let.value)
lazyBlock = LazyVal(blockEvaluation.ter(ctx), ctx.l(let.name))
result <- local {
result <- id {
modify[LoggedEvaluationContext, ExecutionError](lets.modify(_)(_.updated(let.name, lazyBlock)))
.flatMap(_ => evalExpr(inner))
}
Expand Down Expand Up @@ -61,7 +61,7 @@ object EvaluatorV1 extends ExprEvaluator {
val letDefsWithArgs = args.zip(func.signature.args).foldLeft(ctx.ec.letDefs) {
case (r, (argValue, (argName, _))) => r + (argName -> LazyVal(argValue.pure[TrampolinedExecResult], ctx.l("(arg)" + argName)))
}
local {
id {
set(LoggedEvaluationContext.Lenses.lets.set(ctx)(letDefsWithArgs)).flatMap(_ => evalExpr(func.ev))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ trait TaskMFunctions {
}))
}

def id[S, E, A](fa: TaskM[S, E, A]): TaskM[S, E, A] = fa

def inspect[S, E, A](f: S => A): TaskM[S, E, A] = get[S, E].map(f)

def inspectFlat[S, E, A](f: S => TaskM[S, E, A]): TaskM[S, E, A] = get[S, E].flatMap(f)
Expand Down

0 comments on commit fb0966c

Please sign in to comment.