================================================================================
basic/localMethodTyped4
================================================================================

import "pkl:test"

class C {
  local function f1(): Int = "wrong type"
  local function f2(x: Int): Int = x
  local function f3(x: Int, y: Int): Int = x + y

  foo {
    res1 = test.catch(() -> f1())
    res2 = test.catch(() -> f2("wrong type"))
    res3 = test.catch(() -> f3(42, "wrong type"))
    bar {
      res4 = test.catch(() -> f1())
      res5 = test.catch(() -> f2("wrong type"))
      res6 = test.catch(() -> f3(42, "wrong type"))
      baz {
        res7 = test.catch(() -> f1())
        res8 = test.catch(() -> f2("wrong type"))
        res9 = test.catch(() -> f3(42, "wrong type"))
      }
    }
  }
}

c = new C {}

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

(module
  (importClause
    (stringConstant))
  (clazz
    (identifier)
    (classBody
      (classMethod
        (methodHeader
          (modifier)
          (identifier)
          (parameterList)
          (typeAnnotation
            (type
              (qualifiedIdentifier
                (identifier)))))
        (slStringLiteral))
      (classMethod
        (methodHeader
          (modifier)
          (identifier)
          (parameterList
            (typedIdentifier
              (identifier)
              (typeAnnotation
                (type
                  (qualifiedIdentifier
                    (identifier))))))
          (typeAnnotation
            (type
              (qualifiedIdentifier
                (identifier)))))
        (variableExpr
          (identifier)))
      (classMethod
        (methodHeader
          (modifier)
          (identifier)
          (parameterList
            (typedIdentifier
              (identifier)
              (typeAnnotation
                (type
                  (qualifiedIdentifier
                    (identifier)))))
            (typedIdentifier
              (identifier)
              (typeAnnotation
                (type
                  (qualifiedIdentifier
                    (identifier))))))
          (typeAnnotation
            (type
              (qualifiedIdentifier
                (identifier)))))
        (binaryExpr
          (variableExpr
            (identifier))
          (variableExpr
            (identifier))))
      (classProperty
        (identifier)
        (objectBody
          (objectProperty
            (identifier)
            (methodCallExpr
              (variableExpr
                (identifier))
              (identifier)
              (argumentList
                (functionLiteral
                  (parameterList)
                  (methodCallExpr
                    (identifier)
                    (argumentList))))))
          (objectProperty
            (identifier)
            (methodCallExpr
              (variableExpr
                (identifier))
              (identifier)
              (argumentList
                (functionLiteral
                  (parameterList)
                  (methodCallExpr
                    (identifier)
                    (argumentList
                      (slStringLiteral)))))))
          (objectProperty
            (identifier)
            (methodCallExpr
              (variableExpr
                (identifier))
              (identifier)
              (argumentList
                (functionLiteral
                  (parameterList)
                  (methodCallExpr
                    (identifier)
                    (argumentList
                      (intLiteral)
                      (slStringLiteral)))))))
          (objectProperty
            (identifier)
            (objectBody
              (objectProperty
                (identifier)
                (methodCallExpr
                  (variableExpr
                    (identifier))
                  (identifier)
                  (argumentList
                    (functionLiteral
                      (parameterList)
                      (methodCallExpr
                        (identifier)
                        (argumentList))))))
              (objectProperty
                (identifier)
                (methodCallExpr
                  (variableExpr
                    (identifier))
                  (identifier)
                  (argumentList
                    (functionLiteral
                      (parameterList)
                      (methodCallExpr
                        (identifier)
                        (argumentList
                          (slStringLiteral)))))))
              (objectProperty
                (identifier)
                (methodCallExpr
                  (variableExpr
                    (identifier))
                  (identifier)
                  (argumentList
                    (functionLiteral
                      (parameterList)
                      (methodCallExpr
                        (identifier)
                        (argumentList
                          (intLiteral)
                          (slStringLiteral)))))))
              (objectProperty
                (identifier)
                (objectBody
                  (objectProperty
                    (identifier)
                    (methodCallExpr
                      (variableExpr
                        (identifier))
                      (identifier)
                      (argumentList
                        (functionLiteral
                          (parameterList)
                          (methodCallExpr
                            (identifier)
                            (argumentList))))))
                  (objectProperty
                    (identifier)
                    (methodCallExpr
                      (variableExpr
                        (identifier))
                      (identifier)
                      (argumentList
                        (functionLiteral
                          (parameterList)
                          (methodCallExpr
                            (identifier)
                            (argumentList
                              (slStringLiteral)))))))
                  (objectProperty
                    (identifier)
                    (methodCallExpr
                      (variableExpr
                        (identifier))
                      (identifier)
                      (argumentList
                        (functionLiteral
                          (parameterList)
                          (methodCallExpr
                            (identifier)
                            (argumentList
                              (intLiteral)
                              (slStringLiteral)))))))))))))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody))))
