================================================================================
classes/lambdaConstraints1
================================================================================

import "pkl:test"

class X {
  hidden f: () -> Int
  hidden g: (String) -> Int
  hidden h: (String, String) -> Int
}

res1 = new X {
  f = () -> 42
  g = (str) -> str.length
  h = (str1, str2) -> str1.length + str2.length
}

res2 = test.catch(() ->
  new X {
    f = (str) -> str.length
  }.f
)

res3 = test.catch(() ->
  new X {
    g = () -> 42
  }.g
)

res4 = test.catch(() ->
  new X {
    h = (str) -> str.length
  }.h
)

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

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