================================================================================
types/currentModuleType1
================================================================================

import "pkl:test"

x: Int = 1

res1: module = module

res2: module = this

res3: module = (this) { x = 2 }

res4: module? = null

res5: List<module> = List(module, (module) { x = 2 })

res6: List<module> = fun(this)

res6a: module = res6[0]

function fun(m: module): List<module> = List((m) { x = 2 })

class Bad {
  res7: module = "abc"

  res8: module = new Person {}

  res9: module? = new Person {}

  res10: List<module> = List(new Person {})
}

class Person

res7 = test.catch(() -> new Bad {}.res7)

res8 = test.catch(() -> new Bad {}.res8)

res9 = test.catch(() -> new Bad {}.res9)

res10 = test.catch(() -> new Bad {}.res10)

output {
  // force eval but don't render to prevent recursion
  value =
    let (r1 = res1)
      let (r2 = res2)
        let (r3 = res3)
          let (r4 = res4)
            let (r5 = res5)
              let (r6 = res6)
                let (r6a = res6a)
                  let (r7 = res7)
                    let (r8 = res8)
                      let (r9 = res9)
                        let (r10 = res10)
                          new Dynamic { result = "ok" }
}

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

(module
  (importClause
    (stringConstant))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))))
    (intLiteral))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))))
    (moduleExpr))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))))
    (thisExpr))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))))
    (objectLiteral
      (parenthesizedExpr
        (thisExpr))
      (objectBody
        (objectProperty
          (identifier)
          (intLiteral)))))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (type
          (qualifiedIdentifier
            (identifier)))))
    (nullLiteral))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))
        (typeArgumentList
          (type
            (qualifiedIdentifier
              (identifier))))))
    (methodCallExpr
      (identifier)
      (argumentList
        (moduleExpr)
        (objectLiteral
          (parenthesizedExpr
            (moduleExpr))
          (objectBody
            (objectProperty
              (identifier)
              (intLiteral)))))))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))
        (typeArgumentList
          (type
            (qualifiedIdentifier
              (identifier))))))
    (methodCallExpr
      (identifier)
      (argumentList
        (thisExpr))))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))))
    (subscriptExpr
      (variableExpr
        (identifier))
      (intLiteral)))
  (classMethod
    (methodHeader
      (identifier)
      (parameterList
        (typedIdentifier
          (identifier)
          (typeAnnotation
            (type
              (qualifiedIdentifier
                (identifier))))))
      (typeAnnotation
        (type
          (qualifiedIdentifier
            (identifier))
          (typeArgumentList
            (type
              (qualifiedIdentifier
                (identifier)))))))
    (methodCallExpr
      (identifier)
      (argumentList
        (objectLiteral
          (parenthesizedExpr
            (variableExpr
              (identifier)))
          (objectBody
            (objectProperty
              (identifier)
              (intLiteral)))))))
  (clazz
    (identifier)
    (classBody
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (qualifiedIdentifier
              (identifier))))
        (slStringLiteral))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (qualifiedIdentifier
              (identifier))))
        (newExpr
          (type
            (qualifiedIdentifier
              (identifier)))
          (objectBody)))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (qualifiedIdentifier
                (identifier)))))
        (newExpr
          (type
            (qualifiedIdentifier
              (identifier)))
          (objectBody)))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (qualifiedIdentifier
              (identifier))
            (typeArgumentList
              (type
                (qualifiedIdentifier
                  (identifier))))))
        (methodCallExpr
          (identifier)
          (argumentList
            (newExpr
              (type
                (qualifiedIdentifier
                  (identifier)))
              (objectBody)))))))
  (clazz
    (identifier))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (propertyCallExpr
            (newExpr
              (type
                (qualifiedIdentifier
                  (identifier)))
              (objectBody))
            (identifier))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (propertyCallExpr
            (newExpr
              (type
                (qualifiedIdentifier
                  (identifier)))
              (objectBody))
            (identifier))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (propertyCallExpr
            (newExpr
              (type
                (qualifiedIdentifier
                  (identifier)))
              (objectBody))
            (identifier))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (propertyCallExpr
            (newExpr
              (type
                (qualifiedIdentifier
                  (identifier)))
              (objectBody))
            (identifier))))))
  (classProperty
    (identifier)
    (objectBody
      (lineComment)
      (objectProperty
        (identifier)
        (letExpr
          (typedIdentifier
            (identifier))
          (variableExpr
            (identifier))
          (letExpr
            (typedIdentifier
              (identifier))
            (variableExpr
              (identifier))
            (letExpr
              (typedIdentifier
                (identifier))
              (variableExpr
                (identifier))
              (letExpr
                (typedIdentifier
                  (identifier))
                (variableExpr
                  (identifier))
                (letExpr
                  (typedIdentifier
                    (identifier))
                  (variableExpr
                    (identifier))
                  (letExpr
                    (typedIdentifier
                      (identifier))
                    (variableExpr
                      (identifier))
                    (letExpr
                      (typedIdentifier
                        (identifier))
                      (variableExpr
                        (identifier))
                      (letExpr
                        (typedIdentifier
                          (identifier))
                        (variableExpr
                          (identifier))
                        (letExpr
                          (typedIdentifier
                            (identifier))
                          (variableExpr
                            (identifier))
                          (letExpr
                            (typedIdentifier
                              (identifier))
                            (variableExpr
                              (identifier))
                            (letExpr
                              (typedIdentifier
                                (identifier))
                              (variableExpr
                                (identifier))
                              (newExpr
                                (type
                                  (qualifiedIdentifier
                                    (identifier)))
                                (objectBody
                                  (objectProperty
                                    (identifier)
                                    (slStringLiteral)))))))))))))))))))
