Skip to content

Commit

Permalink
Fix #713 (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
Felalolf authored Feb 23, 2024
1 parent 8c65681 commit 7c271a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ protected class ClosureSpecsEncoder {
val result = in.Parameter.Out(Names.closureArg, genericFuncType)(info)
val satisfiesSpec = in.ExprAssertion(in.ClosureImplements(result, in.ClosureSpec(func, Map.empty)(info))(info))(info)
val (args, captAssertions) = capturedArgsAndAssertions(ctx)(result, captured(ctx)(func), info)
val getter = in.PureFunction(proxy, args, Vector(result), Vector.empty, Vector(satisfiesSpec) ++ captAssertions, Vector.empty, None, false)(memberOrLit(ctx)(func).info)
val notNil = in.ExprAssertion(in.UneqCmp(result, in.NilLit(genericFuncType)(info))(info))(info)
val getter = in.PureFunction(proxy, args, Vector(result), Vector.empty, Vector(satisfiesSpec) ++ captAssertions :+ notNil, Vector.empty, None, false)(memberOrLit(ctx)(func).info)
ctx.defaultEncoding.pureFunction(getter)(ctx)
}

Expand Down
9 changes: 9 additions & 0 deletions src/test/resources/regressions/issues/000713.gobra
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

package issue000713

func foo() {
f := func g() {}
assert f != nil
}

0 comments on commit 7c271a0

Please sign in to comment.