================================================================================
types/typeAlias2
================================================================================

import "pkl:test"

typealias List2<E> = List<E>

res1: List2<Int> = List(1, 2, 3)

res2: List2<List2<String>> = List(List("Pigeon"), List("Barn Owl"))

typealias Map2<V, K> = Map<K, V>

res3: Map2<String, Int> = Map(42, "Pigeon", 21, "Barn Owl")

typealias StringMap<V> = Map<String, V>

res4: StringMap<Duration> = Map("Pigeon", 3.min, "Barn Owl", 5.s)

typealias MMap<X> = Map<X, X>

class Person { name: String }

res5: MMap<Person?> = Map(null, new Person { name = "Pigeon" }, new Person { name = "Barn Owl" }, null)

typealias Mixin<Object> = (Object) -> Object

local mixin: Mixin<Person> = (p: Person) -> (p) { name = "Other" }

res6 = mixin.apply(new Person { name = "Pigeon" })

open class Foo {
  value: Int = 42
}

typealias Bar = Foo

class Baz extends Bar {}

res7 = (new Baz {}).value

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

(module
  (importClause
    (stringConstant))
  (typeAlias
    (identifier)
    (typeParameterList
      (typeParameter
        (identifier)))
    (type
      (qualifiedIdentifier
        (identifier))
      (typeArgumentList
        (type
          (qualifiedIdentifier
            (identifier))))))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))
        (typeArgumentList
          (type
            (qualifiedIdentifier
              (identifier))))))
    (methodCallExpr
      (identifier)
      (argumentList
        (intLiteral)
        (intLiteral)
        (intLiteral))))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))
        (typeArgumentList
          (type
            (qualifiedIdentifier
              (identifier))
            (typeArgumentList
              (type
                (qualifiedIdentifier
                  (identifier))))))))
    (methodCallExpr
      (identifier)
      (argumentList
        (methodCallExpr
          (identifier)
          (argumentList
            (slStringLiteral)))
        (methodCallExpr
          (identifier)
          (argumentList
            (slStringLiteral))))))
  (typeAlias
    (identifier)
    (typeParameterList
      (typeParameter
        (identifier))
      (typeParameter
        (identifier)))
    (type
      (qualifiedIdentifier
        (identifier))
      (typeArgumentList
        (type
          (qualifiedIdentifier
            (identifier)))
        (type
          (qualifiedIdentifier
            (identifier))))))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))
        (typeArgumentList
          (type
            (qualifiedIdentifier
              (identifier)))
          (type
            (qualifiedIdentifier
              (identifier))))))
    (methodCallExpr
      (identifier)
      (argumentList
        (intLiteral)
        (slStringLiteral)
        (intLiteral)
        (slStringLiteral))))
  (typeAlias
    (identifier)
    (typeParameterList
      (typeParameter
        (identifier)))
    (type
      (qualifiedIdentifier
        (identifier))
      (typeArgumentList
        (type
          (qualifiedIdentifier
            (identifier)))
        (type
          (qualifiedIdentifier
            (identifier))))))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))
        (typeArgumentList
          (type
            (qualifiedIdentifier
              (identifier))))))
    (methodCallExpr
      (identifier)
      (argumentList
        (slStringLiteral)
        (propertyCallExpr
          (intLiteral)
          (identifier))
        (slStringLiteral)
        (propertyCallExpr
          (intLiteral)
          (identifier)))))
  (typeAlias
    (identifier)
    (typeParameterList
      (typeParameter
        (identifier)))
    (type
      (qualifiedIdentifier
        (identifier))
      (typeArgumentList
        (type
          (qualifiedIdentifier
            (identifier)))
        (type
          (qualifiedIdentifier
            (identifier))))))
  (clazz
    (identifier)
    (classBody
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (qualifiedIdentifier
              (identifier)))))))
  (classProperty
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))
        (typeArgumentList
          (type
            (type
              (qualifiedIdentifier
                (identifier)))))))
    (methodCallExpr
      (identifier)
      (argumentList
        (nullLiteral)
        (newExpr
          (type
            (qualifiedIdentifier
              (identifier)))
          (objectBody
            (objectProperty
              (identifier)
              (slStringLiteral))))
        (newExpr
          (type
            (qualifiedIdentifier
              (identifier)))
          (objectBody
            (objectProperty
              (identifier)
              (slStringLiteral))))
        (nullLiteral))))
  (typeAlias
    (identifier)
    (typeParameterList
      (typeParameter
        (identifier)))
    (type
      (type
        (qualifiedIdentifier
          (identifier)))
      (type
        (qualifiedIdentifier
          (identifier)))))
  (classProperty
    (modifier)
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier))
        (typeArgumentList
          (type
            (qualifiedIdentifier
              (identifier))))))
    (functionLiteral
      (parameterList
        (typedIdentifier
          (identifier)
          (typeAnnotation
            (type
              (qualifiedIdentifier
                (identifier))))))
      (objectLiteral
        (parenthesizedExpr
          (variableExpr
            (identifier)))
        (objectBody
          (objectProperty
            (identifier)
            (slStringLiteral))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (newExpr
          (type
            (qualifiedIdentifier
              (identifier)))
          (objectBody
            (objectProperty
              (identifier)
              (slStringLiteral)))))))
  (clazz
    (modifier)
    (identifier)
    (classBody
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (qualifiedIdentifier
              (identifier))))
        (intLiteral))))
  (typeAlias
    (identifier)
    (type
      (qualifiedIdentifier
        (identifier))))
  (clazz
    (identifier)
    (classExtendsClause
      (qualifiedIdentifier
        (identifier)))
    (classBody))
  (classProperty
    (identifier)
    (propertyCallExpr
      (parenthesizedExpr
        (newExpr
          (type
            (qualifiedIdentifier
              (identifier)))
          (objectBody)))
      (identifier))))
