================================================================================
mappings/mapping2
================================================================================

import "pkl:test"

res1 = new Mapping {
  ["one"] = 1
  ["two"] = 2
}

res2 = new Mapping {
  ["one"] = 1
  ["two"] = this["one"] + 1
}

res3 = new Mapping {
  ["item one"] = 1
  ["two"] = this["item one"] + 1
}

res4 = (res2) {
  ["one"] = 2
}

res5 = new Mapping {
  ["one"] = new Mapping {
    ["a"] = new Mapping {
      ["x"] = 1
    }
    ["b"] = new Mapping {
      ["y"] = 2
    }
  }
  ["two"] = new Mapping {
    ["c"] = new Mapping {
      ["z"] = 3
    }
  }
}
res5a = res5["one"]
res5b = res5["one"]["a"]
res5c = res5["one"]["a"]["x"]
res5d = res5["one"]["b"]
res5e = res5["one"]["b"]["y"]
res5f = res5["two"]
res5g = res5["two"]["c"]
res5h = res5["two"]["c"]["z"]
res5i = test.catch(() -> res5["three"])

res6 = new Mapping {
  ["one"] = List(1, 2, 3)
  ["two"] = this["one"] + List(4, 5, 6)
  ["three"] = 3
}

res7 = (res6) {
  ["one"] = super["one"] + List(4, 5, 6)
  ["three"] = super["three"] * 2
}

res8 = new Mapping {
  default = (key) -> new Dynamic {
    name = key
    age = 42
  }

  ["pigeon"] {}
  ["barn owl"] {}
  ["parrot"] {}
}

res9 = new Mapping {
  default = (key) -> new Dynamic {
    name = key
    age = 42
  }

  ["pigeon"] {}
  ["barn owl"] {}
  ["parrot"] {
    age = 32
  }
}

res10 = (res9) {
  ["parrot"] {}
  ["elf owl"] {}
  ["barn owl"] {
    age = 22
  }
}

res11 = (res1) {}

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

(module
  (importClause
    (stringConstant))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectEntry
          (slStringLiteral)
          (intLiteral))
        (objectEntry
          (slStringLiteral)
          (intLiteral)))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectEntry
          (slStringLiteral)
          (intLiteral))
        (objectEntry
          (slStringLiteral)
          (binaryExpr
            (subscriptExpr
              (thisExpr)
              (slStringLiteral))
            (intLiteral))))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectEntry
          (slStringLiteral)
          (intLiteral))
        (objectEntry
          (slStringLiteral)
          (binaryExpr
            (subscriptExpr
              (thisExpr)
              (slStringLiteral))
            (intLiteral))))))
  (classProperty
    (identifier)
    (objectLiteral
      (parenthesizedExpr
        (variableExpr
          (identifier)))
      (objectBody
        (objectEntry
          (slStringLiteral)
          (intLiteral)))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectEntry
          (slStringLiteral)
          (newExpr
            (type
              (qualifiedIdentifier
                (identifier)))
            (objectBody
              (objectEntry
                (slStringLiteral)
                (newExpr
                  (type
                    (qualifiedIdentifier
                      (identifier)))
                  (objectBody
                    (objectEntry
                      (slStringLiteral)
                      (intLiteral)))))
              (objectEntry
                (slStringLiteral)
                (newExpr
                  (type
                    (qualifiedIdentifier
                      (identifier)))
                  (objectBody
                    (objectEntry
                      (slStringLiteral)
                      (intLiteral))))))))
        (objectEntry
          (slStringLiteral)
          (newExpr
            (type
              (qualifiedIdentifier
                (identifier)))
            (objectBody
              (objectEntry
                (slStringLiteral)
                (newExpr
                  (type
                    (qualifiedIdentifier
                      (identifier)))
                  (objectBody
                    (objectEntry
                      (slStringLiteral)
                      (intLiteral)))))))))))
  (classProperty
    (identifier)
    (subscriptExpr
      (variableExpr
        (identifier))
      (slStringLiteral)))
  (classProperty
    (identifier)
    (subscriptExpr
      (subscriptExpr
        (variableExpr
          (identifier))
        (slStringLiteral))
      (slStringLiteral)))
  (classProperty
    (identifier)
    (subscriptExpr
      (subscriptExpr
        (subscriptExpr
          (variableExpr
            (identifier))
          (slStringLiteral))
        (slStringLiteral))
      (slStringLiteral)))
  (classProperty
    (identifier)
    (subscriptExpr
      (subscriptExpr
        (variableExpr
          (identifier))
        (slStringLiteral))
      (slStringLiteral)))
  (classProperty
    (identifier)
    (subscriptExpr
      (subscriptExpr
        (subscriptExpr
          (variableExpr
            (identifier))
          (slStringLiteral))
        (slStringLiteral))
      (slStringLiteral)))
  (classProperty
    (identifier)
    (subscriptExpr
      (variableExpr
        (identifier))
      (slStringLiteral)))
  (classProperty
    (identifier)
    (subscriptExpr
      (subscriptExpr
        (variableExpr
          (identifier))
        (slStringLiteral))
      (slStringLiteral)))
  (classProperty
    (identifier)
    (subscriptExpr
      (subscriptExpr
        (subscriptExpr
          (variableExpr
            (identifier))
          (slStringLiteral))
        (slStringLiteral))
      (slStringLiteral)))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (subscriptExpr
            (variableExpr
              (identifier))
            (slStringLiteral))))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectEntry
          (slStringLiteral)
          (methodCallExpr
            (identifier)
            (argumentList
              (intLiteral)
              (intLiteral)
              (intLiteral))))
        (objectEntry
          (slStringLiteral)
          (binaryExpr
            (subscriptExpr
              (thisExpr)
              (slStringLiteral))
            (methodCallExpr
              (identifier)
              (argumentList
                (intLiteral)
                (intLiteral)
                (intLiteral)))))
        (objectEntry
          (slStringLiteral)
          (intLiteral)))))
  (classProperty
    (identifier)
    (objectLiteral
      (parenthesizedExpr
        (variableExpr
          (identifier)))
      (objectBody
        (objectEntry
          (slStringLiteral)
          (binaryExpr
            (subscriptExpr
              (slStringLiteral))
            (methodCallExpr
              (identifier)
              (argumentList
                (intLiteral)
                (intLiteral)
                (intLiteral)))))
        (objectEntry
          (slStringLiteral)
          (binaryExpr
            (subscriptExpr
              (slStringLiteral))
            (intLiteral))))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectProperty
          (identifier)
          (functionLiteral
            (parameterList
              (typedIdentifier
                (identifier)))
            (newExpr
              (type
                (qualifiedIdentifier
                  (identifier)))
              (objectBody
                (objectProperty
                  (identifier)
                  (variableExpr
                    (identifier)))
                (objectProperty
                  (identifier)
                  (intLiteral))))))
        (objectEntry
          (slStringLiteral)
          (objectBody))
        (objectEntry
          (slStringLiteral)
          (objectBody))
        (objectEntry
          (slStringLiteral)
          (objectBody)))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectProperty
          (identifier)
          (functionLiteral
            (parameterList
              (typedIdentifier
                (identifier)))
            (newExpr
              (type
                (qualifiedIdentifier
                  (identifier)))
              (objectBody
                (objectProperty
                  (identifier)
                  (variableExpr
                    (identifier)))
                (objectProperty
                  (identifier)
                  (intLiteral))))))
        (objectEntry
          (slStringLiteral)
          (objectBody))
        (objectEntry
          (slStringLiteral)
          (objectBody))
        (objectEntry
          (slStringLiteral)
          (objectBody
            (objectProperty
              (identifier)
              (intLiteral)))))))
  (classProperty
    (identifier)
    (objectLiteral
      (parenthesizedExpr
        (variableExpr
          (identifier)))
      (objectBody
        (objectEntry
          (slStringLiteral)
          (objectBody))
        (objectEntry
          (slStringLiteral)
          (objectBody))
        (objectEntry
          (slStringLiteral)
          (objectBody
            (objectProperty
              (identifier)
              (intLiteral)))))))
  (classProperty
    (identifier)
    (objectLiteral
      (parenthesizedExpr
        (variableExpr
          (identifier)))
      (objectBody))))
