================================================================================
classes/constraints3
================================================================================

import "pkl:test"

class Person {
  address: Address(street.endsWith("St."))
}

class Address {
  street: String
}

res1 = new Person {
  address {
    street = "Hampton St."
  }
}

res2 = test.catch(() ->
  new Person {
    address {
      street = "Garlic Blvd."
    }
  }.address
)

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

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