================================================================================
basic/letTyped
================================================================================

import "pkl:test"

res1 =
  let (x: Int = 42)
    x + 1

res2 =
  let (str: String(endsWith("P")) = "Pigeon".reverse())
    str.reverse()

res3 =
  let (x: Duration(unit == "min") = 3.min + 2.min)
    let (y: Float(isPositive) = 1.2 + 1.3)
      x * y

res4 =
  let (xs: List<Null|Boolean|"Pigeon"> = List("Pigeon", true, null))
    xs

res5 = test.catch(() ->
  let (x: String = 42)
    x + 1)

res6 = test.catch(() ->
  let (str: String(endsWith("A")) = "Pigeon".reverse())
    str.reverse())

res7 = test.catch(() ->
  let (x: Duration(unit == "min") = 3.min + 2.min)
    let (y: Float(!isPositive) = 1.2 + 1.3)
      x * y)

res8 = test.catch(() ->
  let (xs: List<Null|Boolean|"Pigeon"> = List("Barn Owl", true, null))
    xs)

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

(module
  (importClause
    (stringConstant))
  (classProperty
    (identifier)
    (letExpr
      (typedIdentifier
        (identifier)
        (typeAnnotation
          (type
            (qualifiedIdentifier
              (identifier)))))
      (intLiteral)
      (binaryExpr
        (variableExpr
          (identifier))
        (intLiteral))))
  (classProperty
    (identifier)
    (letExpr
      (typedIdentifier
        (identifier)
        (typeAnnotation
          (type
            (type
              (qualifiedIdentifier
                (identifier)))
            (methodCallExpr
              (identifier)
              (argumentList
                (slStringLiteral))))))
      (methodCallExpr
        (slStringLiteral)
        (identifier)
        (argumentList))
      (methodCallExpr
        (variableExpr
          (identifier))
        (identifier)
        (argumentList))))
  (classProperty
    (identifier)
    (letExpr
      (typedIdentifier
        (identifier)
        (typeAnnotation
          (type
            (type
              (qualifiedIdentifier
                (identifier)))
            (binaryExpr
              (variableExpr
                (identifier))
              (slStringLiteral)))))
      (propertyCallExpr
        (binaryExpr
          (propertyCallExpr
            (intLiteral)
            (identifier))
          (intLiteral))
        (identifier))
      (letExpr
        (typedIdentifier
          (identifier)
          (typeAnnotation
            (type
              (type
                (qualifiedIdentifier
                  (identifier)))
              (variableExpr
                (identifier)))))
        (binaryExpr
          (floatLiteral)
          (floatLiteral))
        (binaryExpr
          (variableExpr
            (identifier))
          (variableExpr
            (identifier))))))
  (classProperty
    (identifier)
    (letExpr
      (typedIdentifier
        (identifier)
        (typeAnnotation
          (type
            (qualifiedIdentifier
              (identifier))
            (typeArgumentList
              (type
                (type
                  (type
                    (qualifiedIdentifier
                      (identifier)))
                  (type
                    (qualifiedIdentifier
                      (identifier))))
                (type
                  (stringConstant)))))))
      (methodCallExpr
        (identifier)
        (argumentList
          (slStringLiteral)
          (trueLiteral)
          (nullLiteral)))
      (variableExpr
        (identifier))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (letExpr
            (typedIdentifier
              (identifier)
              (typeAnnotation
                (type
                  (qualifiedIdentifier
                    (identifier)))))
            (intLiteral)
            (binaryExpr
              (variableExpr
                (identifier))
              (intLiteral)))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (letExpr
            (typedIdentifier
              (identifier)
              (typeAnnotation
                (type
                  (type
                    (qualifiedIdentifier
                      (identifier)))
                  (methodCallExpr
                    (identifier)
                    (argumentList
                      (slStringLiteral))))))
            (methodCallExpr
              (slStringLiteral)
              (identifier)
              (argumentList))
            (methodCallExpr
              (variableExpr
                (identifier))
              (identifier)
              (argumentList)))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (letExpr
            (typedIdentifier
              (identifier)
              (typeAnnotation
                (type
                  (type
                    (qualifiedIdentifier
                      (identifier)))
                  (binaryExpr
                    (variableExpr
                      (identifier))
                    (slStringLiteral)))))
            (propertyCallExpr
              (binaryExpr
                (propertyCallExpr
                  (intLiteral)
                  (identifier))
                (intLiteral))
              (identifier))
            (letExpr
              (typedIdentifier
                (identifier)
                (typeAnnotation
                  (type
                    (type
                      (qualifiedIdentifier
                        (identifier)))
                    (unaryExpr
                      (variableExpr
                        (identifier))))))
              (binaryExpr
                (floatLiteral)
                (floatLiteral))
              (binaryExpr
                (variableExpr
                  (identifier))
                (variableExpr
                  (identifier)))))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (letExpr
            (typedIdentifier
              (identifier)
              (typeAnnotation
                (type
                  (qualifiedIdentifier
                    (identifier))
                  (typeArgumentList
                    (type
                      (type
                        (type
                          (qualifiedIdentifier
                            (identifier)))
                        (type
                          (qualifiedIdentifier
                            (identifier))))
                      (type
                        (stringConstant)))))))
            (methodCallExpr
              (identifier)
              (argumentList
                (slStringLiteral)
                (trueLiteral)
                (nullLiteral)))
            (variableExpr
              (identifier))))))))
