================================================================================
classes/constraints8
================================================================================

import "pkl:test"

const function isGreaterThan(n) = (x) -> x > n

class X {
  a: Int(isGreaterThan(5))
  b: Int(isGreaterThan(10))
}

res1 = new X {
  a = 6
  b = 11
}

res2 = test.catch(() ->
  new X {
    a = 5
  }.a
)

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

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