================================================================================
basic/list
================================================================================

amends "../snippetTest.pkl"

local list1 = List(1, "two", 3)
local list2 = List(1, "two", 4)

examples {
  ["equality"] {
    list1 == list1
    list1 == list2
    list1 == list1.toSet()
    list1 == list2.toSet()
  }

  ["inequality"] {
    list1 != list1
    list1 != list2
    list1 != list1.toSet()
    list1 != list2.toSet()
  }

  ["addition"] {
    list1 + list2
    List() + List()
    list1 + List()
    List() + list2
    list1 + list2.toSet()
    List() + Set()
    list1 + Set()
    List() + list2.toSet()
  }

  ["subscript"] {
    list1[0]
    list1[1]
    list1[2]
    module.catch(() -> list1[-1])
    module.catch(() -> list1[3])
  }
}

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

(module
  (moduleHeader
    (extendsOrAmendsClause
      (stringConstant)))
  (classProperty
    (modifier)
    (identifier)
    (methodCallExpr
      (identifier)
      (argumentList
        (intLiteral)
        (slStringLiteral)
        (intLiteral))))
  (classProperty
    (modifier)
    (identifier)
    (methodCallExpr
      (identifier)
      (argumentList
        (intLiteral)
        (slStringLiteral)
        (intLiteral))))
  (classProperty
    (identifier)
    (objectBody
      (objectEntry
        (slStringLiteral)
        (objectBody
          (objectElement
            (binaryExpr
              (variableExpr
                (identifier))
              (variableExpr
                (identifier))))
          (objectElement
            (binaryExpr
              (variableExpr
                (identifier))
              (variableExpr
                (identifier))))
          (objectElement
            (methodCallExpr
              (binaryExpr
                (variableExpr
                  (identifier))
                (variableExpr
                  (identifier)))
              (identifier)
              (argumentList)))
          (objectElement
            (methodCallExpr
              (binaryExpr
                (variableExpr
                  (identifier))
                (variableExpr
                  (identifier)))
              (identifier)
              (argumentList)))))
      (objectEntry
        (slStringLiteral)
        (objectBody
          (objectElement
            (binaryExpr
              (variableExpr
                (identifier))
              (variableExpr
                (identifier))))
          (objectElement
            (binaryExpr
              (variableExpr
                (identifier))
              (variableExpr
                (identifier))))
          (objectElement
            (methodCallExpr
              (binaryExpr
                (variableExpr
                  (identifier))
                (variableExpr
                  (identifier)))
              (identifier)
              (argumentList)))
          (objectElement
            (methodCallExpr
              (binaryExpr
                (variableExpr
                  (identifier))
                (variableExpr
                  (identifier)))
              (identifier)
              (argumentList)))))
      (objectEntry
        (slStringLiteral)
        (objectBody
          (objectElement
            (binaryExpr
              (variableExpr
                (identifier))
              (variableExpr
                (identifier))))
          (objectElement
            (binaryExpr
              (methodCallExpr
                (identifier)
                (argumentList))
              (methodCallExpr
                (identifier)
                (argumentList))))
          (objectElement
            (binaryExpr
              (variableExpr
                (identifier))
              (methodCallExpr
                (identifier)
                (argumentList))))
          (objectElement
            (binaryExpr
              (methodCallExpr
                (identifier)
                (argumentList))
              (variableExpr
                (identifier))))
          (objectElement
            (methodCallExpr
              (binaryExpr
                (variableExpr
                  (identifier))
                (variableExpr
                  (identifier)))
              (identifier)
              (argumentList)))
          (objectElement
            (binaryExpr
              (methodCallExpr
                (identifier)
                (argumentList))
              (methodCallExpr
                (identifier)
                (argumentList))))
          (objectElement
            (binaryExpr
              (variableExpr
                (identifier))
              (methodCallExpr
                (identifier)
                (argumentList))))
          (objectElement
            (methodCallExpr
              (binaryExpr
                (methodCallExpr
                  (identifier)
                  (argumentList))
                (variableExpr
                  (identifier)))
              (identifier)
              (argumentList)))))
      (objectEntry
        (slStringLiteral)
        (objectBody
          (objectElement
            (subscriptExpr
              (variableExpr
                (identifier))
              (intLiteral)))
          (objectElement
            (subscriptExpr
              (variableExpr
                (identifier))
              (intLiteral)))
          (objectElement
            (subscriptExpr
              (variableExpr
                (identifier))
              (intLiteral)))
          (objectElement
            (methodCallExpr
              (moduleExpr)
              (identifier)
              (argumentList
                (functionLiteral
                  (parameterList)
                  (subscriptExpr
                    (variableExpr
                      (identifier))
                    (unaryExpr
                      (intLiteral)))))))
          (objectElement
            (methodCallExpr
              (moduleExpr)
              (identifier)
              (argumentList
                (functionLiteral
                  (parameterList)
                  (subscriptExpr
                    (variableExpr
                      (identifier))
                    (intLiteral)))))))))))
