================================================================================
listings2/wrongIndex
================================================================================

import "pkl:test"

local x = new Listing {
  when (false) { 0 }
  "pigeon"
}

res1 = test.catch(() -> (x) {
  when (false) { 0 }
  [3] = "barn owl"
})

res2 = test.catch(() -> (x) {
  when (false) { 0 }
  [2 + 1] = "barn owl"
})

res3 = test.catch(() -> (x) {
  when (false) { 0 }
  [-1] = "barn owl"
})

res4 = test.catch(() -> (x) {
  when (false) { 0 }
  [-1 * 1] = "barn owl"
})

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

(module
  (importClause
    (stringConstant))
  (classProperty
    (modifier)
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (whenGenerator
          (falseLiteral)
          (objectBody
            (objectElement
              (intLiteral))))
        (objectElement
          (slStringLiteral)))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (objectLiteral
            (parenthesizedExpr
              (variableExpr
                (identifier)))
            (objectBody
              (whenGenerator
                (falseLiteral)
                (objectBody
                  (objectElement
                    (intLiteral))))
              (objectEntry
                (intLiteral)
                (slStringLiteral))))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (objectLiteral
            (parenthesizedExpr
              (variableExpr
                (identifier)))
            (objectBody
              (whenGenerator
                (falseLiteral)
                (objectBody
                  (objectElement
                    (intLiteral))))
              (objectEntry
                (binaryExpr
                  (intLiteral)
                  (intLiteral))
                (slStringLiteral))))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (objectLiteral
            (parenthesizedExpr
              (variableExpr
                (identifier)))
            (objectBody
              (whenGenerator
                (falseLiteral)
                (objectBody
                  (objectElement
                    (intLiteral))))
              (objectEntry
                (unaryExpr
                  (intLiteral))
                (slStringLiteral))))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (functionLiteral
          (parameterList)
          (objectLiteral
            (parenthesizedExpr
              (variableExpr
                (identifier)))
            (objectBody
              (whenGenerator
                (falseLiteral)
                (objectBody
                  (objectElement
                    (intLiteral))))
              (objectEntry
                (binaryExpr
                  (unaryExpr
                    (intLiteral))
                  (intLiteral))
                (slStringLiteral)))))))))
