<commit_before>discard """
  output: '''true
(999, 0)'''
"""


block tissue600:
  for i in 1..1:
    var reported = false
    proc report() =
      reported = true



import sequtils
block tissue1502def:
  let xs: seq[tuple[key: string, val: seq[string]]] = @[("foo", @["bar"])]

  let maps = xs.map(
    proc(x: auto): tuple[typ: string, maps: seq[string]] =
      (x.key, x.val.map(proc(x: string): string = x)))



block tissue1642:
  var i = 0
  proc p() = inc(i)



block tissue1846:
  type
    TBinOp[T] = proc (x,y: T): bool
    THeap[T] = object
      cmp: TBinOp[T]

  proc less[T](x,y: T): bool =
    x < y

  proc initHeap[T](cmp: TBinOp[T]): THeap[T] =
    result.cmp = cmp

  var h = initHeap[int](less[int])
  echo h.cmp(2,3)



block tissue1911:
  proc foo(x: int) : auto =

    proc helper() : int = x
    proc bar() : int = helper()
    proc baz() : int = helper()

    return (bar, baz)

# bug #11523
proc foo(): proc =
  let a = 999
  return proc(): (int, int) =
    return (a, 0)

echo foo()()<commit_msg>close #7104 by writing a test<commit_after>discard """
  output: '''true
(999, 0)
ok 0
ok 1
ok 2
'''
"""


block tissue600:
  for i in 1..1:
    var reported = false
    proc report() =
      reported = true



import sequtils
block tissue1502def:
  let xs: seq[tuple[key: string, val: seq[string]]] = @[("foo", @["bar"])]

  let maps = xs.map(
    proc(x: auto): tuple[typ: string, maps: seq[string]] =
      (x.key, x.val.map(proc(x: string): string = x)))



block tissue1642:
  var i = 0
  proc p() = inc(i)



block tissue1846:
  type
    TBinOp[T] = proc (x,y: T): bool
    THeap[T] = object
      cmp: TBinOp[T]

  proc less[T](x,y: T): bool =
    x < y

  proc initHeap[T](cmp: TBinOp[T]): THeap[T] =
    result.cmp = cmp

  var h = initHeap[int](less[int])
  echo h.cmp(2,3)



block tissue1911:
  proc foo(x: int) : auto =

    proc helper() : int = x
    proc bar() : int = helper()
    proc baz() : int = helper()

    return (bar, baz)

# bug #11523
proc foo(): proc =
  let a = 999
  return proc(): (int, int) =
    return (a, 0)

echo foo()()


block tissue7104:
  proc sp(cb: proc())=
      cb()

  sp:
      var i = 0
      echo "ok ", i
      sp():
          inc i
          echo "ok ", i
          sp do:
              inc i
              echo "ok ", i
{'fraction_non_alphanumeric': 0.17029616724738675, 'fraction_numerical': 0.037456445993031356, 'mean_word_length': 2.3979289940828403, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3202882', 'n_tokens_mistral': 981, 'n_tokens_neox': 894, 'n_words': 274}