================================================================================
basic/localMethodTyped
================================================================================

local function f1(): Int = 1
local function f2(x: Int): Int = x + 1
local function f3(x: Int, y: Int): Int = x + y + 1

res1 = f1()
res2 = f2(42)
res3 = f3(42, 21)

foo1 {
  res4 = f1()
  res5 = f2(42)
  res6 = f3(42, 21)
  bar1 {
    res7 = f1()
    res8 = f2(42)
    res9 = f3(42, 21)
    baz1 {
      res10 = f1()
      res11 = f2(42)
      res12 = f3(42, 21)
    }
  }
}

foo2 {
  local function f1(): Int = 2
  local function f2(x: Int) = x + 2
  local function f3(x: Int, y: Int) = x + y + 2

  res13 = f1()
  res14 = f2(42)
  res15 = f3(42, 21)
  bar2 {
    res16 = f1()
    res17 = f2(42)
    res18 = f3(42, 21)
    baz2 {
      res19 = f1()
      res20 = f2(42)
      res21 = f3(42, 21)
    }
  }
}

foo3 {
  res22 = f1()
  res23 = f2(42)
  res24 = f3(42, 21)
  bar3 {
    local function f1(): Int = 3
    local function f2(x: Int) = x + 3
    local function f3(x: Int, y: Int) = x + y + 3

    res25 = f1()
    res26 = f2(42)
    res27 = f3(42, 21)
    baz3 {
      res28 = f1()
      res29 = f2(42)
      res30 = f3(42, 21)
    }
  }
}

foo4 {
  res22 = f1()
  res23 = f2(42)
  res24 = f3(42, 21)
  bar4 {
    res25 = f1()
    res26 = f2(42)
    res27 = f3(42, 21)
    baz4 {
      local function f1(): Int = 4
      local function f2(x: Int) = x + 4
      local function f3(x: Int, y: Int) = x + y + 4

      res28 = f1()
      res29 = f2(42)
      res30 = f3(42, 21)
    }
  }
}

--------------------------------------------------------------------------------

(module
  (classMethod
    (methodHeader
      (modifier)
      (identifier)
      (parameterList)
      (typeAnnotation
        (type
          (qualifiedIdentifier
            (identifier)))))
    (intLiteral))
  (classMethod
    (methodHeader
      (modifier)
      (identifier)
      (parameterList
        (typedIdentifier
          (identifier)
          (typeAnnotation
            (type
              (qualifiedIdentifier
                (identifier))))))
      (typeAnnotation
        (type
          (qualifiedIdentifier
            (identifier)))))
    (binaryExpr
      (variableExpr
        (identifier))
      (intLiteral)))
  (classMethod
    (methodHeader
      (modifier)
      (identifier)
      (parameterList
        (typedIdentifier
          (identifier)
          (typeAnnotation
            (type
              (qualifiedIdentifier
                (identifier)))))
        (typedIdentifier
          (identifier)
          (typeAnnotation
            (type
              (qualifiedIdentifier
                (identifier))))))
      (typeAnnotation
        (type
          (qualifiedIdentifier
            (identifier)))))
    (binaryExpr
      (binaryExpr
        (variableExpr
          (identifier))
        (variableExpr
          (identifier)))
      (intLiteral)))
  (classProperty
    (identifier)
    (methodCallExpr
      (identifier)
      (argumentList)))
  (classProperty
    (identifier)
    (methodCallExpr
      (identifier)
      (argumentList
        (intLiteral))))
  (classProperty
    (identifier)
    (methodCallExpr
      (identifier)
      (argumentList
        (intLiteral)
        (intLiteral))))
  (classProperty
    (identifier)
    (objectBody
      (objectProperty
        (identifier)
        (methodCallExpr
          (identifier)
          (argumentList)))
      (objectProperty
        (identifier)
        (methodCallExpr
          (identifier)
          (argumentList
            (intLiteral))))
      (objectProperty
        (identifier)
        (methodCallExpr
          (identifier)
          (argumentList
            (intLiteral)
            (intLiteral))))
      (objectProperty
        (identifier)
        (objectBody
          (objectProperty
            (identifier)
            (methodCallExpr
              (identifier)
              (argumentList)))
          (objectProperty
            (identifier)
            (methodCallExpr
              (identifier)
              (argumentList
                (intLiteral))))
          (objectProperty
            (identifier)
            (methodCallExpr
              (identifier)
              (argumentList
                (intLiteral)
                (intLiteral))))
          (objectProperty
            (identifier)
            (objectBody
              (objectProperty
                (identifier)
                (methodCallExpr
                  (identifier)
                  (argumentList)))
              (objectProperty
                (identifier)
                (methodCallExpr
                  (identifier)
                  (argumentList
                    (intLiteral))))
              (objectProperty
                (identifier)
                (methodCallExpr
                  (identifier)
                  (argumentList
                    (intLiteral)
                    (intLiteral))))))))))
  (classProperty
    (identifier)
    (objectBody
      (objectMethod
        (methodHeader
          (modifier)
          (identifier)
          (parameterList)
          (typeAnnotation
            (type
              (qualifiedIdentifier
                (identifier)))))
        (intLiteral))
      (objectMethod
        (methodHeader
          (modifier)
          (identifier)
          (parameterList
            (typedIdentifier
              (identifier)
              (typeAnnotation
                (type
                  (qualifiedIdentifier
                    (identifier)))))))
        (binaryExpr
          (variableExpr
            (identifier))
          (intLiteral)))
      (objectMethod
        (methodHeader
          (modifier)
          (identifier)
          (parameterList
            (typedIdentifier
              (identifier)
              (typeAnnotation
                (type
                  (qualifiedIdentifier
                    (identifier)))))
            (typedIdentifier
              (identifier)
              (typeAnnotation
                (type
                  (qualifiedIdentifier
                    (identifier)))))))
        (binaryExpr
          (binaryExpr
            (variableExpr
              (identifier))
            (variableExpr
              (identifier)))
          (intLiteral)))
      (objectProperty
        (identifier)
        (methodCallExpr
          (identifier)
          (argumentList)))
      (objectProperty
        (identifier)
        (methodCallExpr
          (identifier)
          (argumentList
            (intLiteral))))
      (objectProperty
        (identifier)
        (methodCallExpr
          (identifier)
          (argumentList
            (intLiteral)
            (intLiteral))))
      (objectProperty
        (identifier)
        (objectBody
          (objectProperty
            (identifier)
            (methodCallExpr
              (identifier)
              (argumentList)))
          (objectProperty
            (identifier)
            (methodCallExpr
              (identifier)
              (argumentList
                (intLiteral))))
          (objectProperty
            (identifier)
            (methodCallExpr
              (identifier)
              (argumentList
                (intLiteral)
                (intLiteral))))
          (objectProperty
            (identifier)
            (objectBody
              (objectProperty
                (identifier)
                (methodCallExpr
                  (identifier)
                  (argumentList)))
              (objectProperty
                (identifier)
                (methodCallExpr
                  (identifier)
                  (argumentList
                    (intLiteral))))
              (objectProperty
                (identifier)
                (methodCallExpr
                  (identifier)
                  (argumentList
                    (intLiteral)
                    (intLiteral))))))))))
  (classProperty
    (identifier)
    (objectBody
      (objectProperty
        (identifier)
        (methodCallExpr
          (identifier)
          (argumentList)))
      (objectProperty
        (identifier)
        (methodCallExpr
          (identifier)
          (argumentList
            (intLiteral))))
      (objectProperty
        (identifier)
        (methodCallExpr
          (identifier)
          (argumentList
            (intLiteral)
            (intLiteral))))
      (objectProperty
        (identifier)
        (objectBody
          (objectMethod
            (methodHeader
              (modifier)
              (identifier)
              (parameterList)
              (typeAnnotation
                (type
                  (qualifiedIdentifier
                    (identifier)))))
            (intLiteral))
          (objectMethod
            (methodHeader
              (modifier)
              (identifier)
              (parameterList
                (typedIdentifier
                  (identifier)
                  (typeAnnotation
                    (type
                      (qualifiedIdentifier
                        (identifier)))))))
            (binaryExpr
              (variableExpr
                (identifier))
              (intLiteral)))
          (objectMethod
            (methodHeader
              (modifier)
              (identifier)
              (parameterList
                (typedIdentifier
                  (identifier)
                  (typeAnnotation
                    (type
                      (qualifiedIdentifier
                        (identifier)))))
                (typedIdentifier
                  (identifier)
                  (typeAnnotation
                    (type
                      (qualifiedIdentifier
                        (identifier)))))))
            (binaryExpr
              (binaryExpr
                (variableExpr
                  (identifier))
                (variableExpr
                  (identifier)))
              (intLiteral)))
          (objectProperty
            (identifier)
            (methodCallExpr
              (identifier)
              (argumentList)))
          (objectProperty
            (identifier)
            (methodCallExpr
              (identifier)
              (argumentList
                (intLiteral))))
          (objectProperty
            (identifier)
            (methodCallExpr
              (identifier)
              (argumentList
                (intLiteral)
                (intLiteral))))
          (objectProperty
            (identifier)
            (objectBody
              (objectProperty
                (identifier)
                (methodCallExpr
                  (identifier)
                  (argumentList)))
              (objectProperty
                (identifier)
                (methodCallExpr
                  (identifier)
                  (argumentList
                    (intLiteral))))
              (objectProperty
                (identifier)
                (methodCallExpr
                  (identifier)
                  (argumentList
                    (intLiteral)
                    (intLiteral))))))))))
  (classProperty
    (identifier)
    (objectBody
      (objectProperty
        (identifier)
        (methodCallExpr
          (identifier)
          (argumentList)))
      (objectProperty
        (identifier)
        (methodCallExpr
          (identifier)
          (argumentList
            (intLiteral))))
      (objectProperty
        (identifier)
        (methodCallExpr
          (identifier)
          (argumentList
            (intLiteral)
            (intLiteral))))
      (objectProperty
        (identifier)
        (objectBody
          (objectProperty
            (identifier)
            (methodCallExpr
              (identifier)
              (argumentList)))
          (objectProperty
            (identifier)
            (methodCallExpr
              (identifier)
              (argumentList
                (intLiteral))))
          (objectProperty
            (identifier)
            (methodCallExpr
              (identifier)
              (argumentList
                (intLiteral)
                (intLiteral))))
          (objectProperty
            (identifier)
            (objectBody
              (objectMethod
                (methodHeader
                  (modifier)
                  (identifier)
                  (parameterList)
                  (typeAnnotation
                    (type
                      (qualifiedIdentifier
                        (identifier)))))
                (intLiteral))
              (objectMethod
                (methodHeader
                  (modifier)
                  (identifier)
                  (parameterList
                    (typedIdentifier
                      (identifier)
                      (typeAnnotation
                        (type
                          (qualifiedIdentifier
                            (identifier)))))))
                (binaryExpr
                  (variableExpr
                    (identifier))
                  (intLiteral)))
              (objectMethod
                (methodHeader
                  (modifier)
                  (identifier)
                  (parameterList
                    (typedIdentifier
                      (identifier)
                      (typeAnnotation
                        (type
                          (qualifiedIdentifier
                            (identifier)))))
                    (typedIdentifier
                      (identifier)
                      (typeAnnotation
                        (type
                          (qualifiedIdentifier
                            (identifier)))))))
                (binaryExpr
                  (binaryExpr
                    (variableExpr
                      (identifier))
                    (variableExpr
                      (identifier)))
                  (intLiteral)))
              (objectProperty
                (identifier)
                (methodCallExpr
                  (identifier)
                  (argumentList)))
              (objectProperty
                (identifier)
                (methodCallExpr
                  (identifier)
                  (argumentList
                    (intLiteral))))
              (objectProperty
                (identifier)
                (methodCallExpr
                  (identifier)
                  (argumentList
                    (intLiteral)
                    (intLiteral)))))))))))
