================================================================================
classes/unionTypes
================================================================================

class X {
  a: Boolean|String
  b: (Boolean|String)?
  c: Boolean|String(length >= 3)
  d: (Boolean|String)(this != false)
}

class Y {
  hidden a: (Int|Float) -> String
  hidden b: (Int) -> Float|String
  c: ((Int) -> Float)|String
}

class Z {
  a: String|List<String>
  b: List<Int|Float>
  c: List<Int|List<Float>>
  d: Boolean|Map<Int|List<Int>, String|Set<String>>
  e: Duration|Duration|Duration
  f: DataSize|DataSize?
  g: Pair<Int, Int>|Null
}

class Defaults {
  a: Set|List|Map
  b: "Pigeon"|"Parrot"|"Barn Owl"
}

res1 = new X {
  a = true
  b = null
  c = true
  d = true
}

res2 = new X {
  a = "foo"
  b = "foo"
  c = "longer"
  d = "foo"
}

res3 = new Y {
  a = (x) -> "foo"
  b = (x) -> 3.14
  c = "foo"
}

res4 = new Z {
  a = "foo"
  b = List(1, 3.14, 2)
  c = List(1, List(3.12), 2)
  d = true
  e = 5.s
  f = 3.gb
  g = Pair(1, 2)
}

res5 = new Z {
  a = List("foo", "bar")
  b = List(3.14, 1)
  c = List()
  d = Map(
    1, "foo",
    2, Set("foo", "bar"),
    List(1, 2, 3), "foo",
    List(1, 2, 3), Set("foo", "bar")
  )
  e = 1.s
  f = null
  g = null
}

res6 = new Defaults {}

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

(module
  (clazz
    (identifier)
    (classBody
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (qualifiedIdentifier
                (identifier)))
            (type
              (qualifiedIdentifier
                (identifier))))))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (type
                (type
                  (qualifiedIdentifier
                    (identifier)))
                (type
                  (qualifiedIdentifier
                    (identifier))))))))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (qualifiedIdentifier
                (identifier)))
            (type
              (type
                (qualifiedIdentifier
                  (identifier)))
              (binaryExpr
                (variableExpr
                  (identifier))
                (intLiteral))))))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (type
                (type
                  (qualifiedIdentifier
                    (identifier)))
                (type
                  (qualifiedIdentifier
                    (identifier)))))
            (binaryExpr
              (thisExpr)
              (falseLiteral)))))))
  (clazz
    (identifier)
    (classBody
      (classProperty
        (modifier)
        (identifier)
        (typeAnnotation
          (type
            (type
              (type
                (qualifiedIdentifier
                  (identifier)))
              (type
                (qualifiedIdentifier
                  (identifier))))
            (type
              (qualifiedIdentifier
                (identifier))))))
      (classProperty
        (modifier)
        (identifier)
        (typeAnnotation
          (type
            (type
              (type
                (qualifiedIdentifier
                  (identifier)))
              (type
                (qualifiedIdentifier
                  (identifier))))
            (type
              (qualifiedIdentifier
                (identifier))))))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (type
                (type
                  (qualifiedIdentifier
                    (identifier)))
                (type
                  (qualifiedIdentifier
                    (identifier)))))
            (type
              (qualifiedIdentifier
                (identifier))))))))
  (clazz
    (identifier)
    (classBody
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (qualifiedIdentifier
                (identifier)))
            (type
              (qualifiedIdentifier
                (identifier))
              (typeArgumentList
                (type
                  (qualifiedIdentifier
                    (identifier))))))))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (qualifiedIdentifier
              (identifier))
            (typeArgumentList
              (type
                (type
                  (qualifiedIdentifier
                    (identifier)))
                (type
                  (qualifiedIdentifier
                    (identifier))))))))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (qualifiedIdentifier
              (identifier))
            (typeArgumentList
              (type
                (type
                  (qualifiedIdentifier
                    (identifier)))
                (type
                  (qualifiedIdentifier
                    (identifier))
                  (typeArgumentList
                    (type
                      (qualifiedIdentifier
                        (identifier))))))))))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (qualifiedIdentifier
                (identifier)))
            (type
              (qualifiedIdentifier
                (identifier))
              (typeArgumentList
                (type
                  (type
                    (qualifiedIdentifier
                      (identifier)))
                  (type
                    (qualifiedIdentifier
                      (identifier))
                    (typeArgumentList
                      (type
                        (qualifiedIdentifier
                          (identifier))))))
                (type
                  (type
                    (qualifiedIdentifier
                      (identifier)))
                  (type
                    (qualifiedIdentifier
                      (identifier))
                    (typeArgumentList
                      (type
                        (qualifiedIdentifier
                          (identifier)))))))))))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (type
                (qualifiedIdentifier
                  (identifier)))
              (type
                (qualifiedIdentifier
                  (identifier))))
            (type
              (qualifiedIdentifier
                (identifier))))))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (qualifiedIdentifier
                (identifier)))
            (type
              (type
                (qualifiedIdentifier
                  (identifier)))))))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (qualifiedIdentifier
                (identifier))
              (typeArgumentList
                (type
                  (qualifiedIdentifier
                    (identifier)))
                (type
                  (qualifiedIdentifier
                    (identifier)))))
            (type
              (qualifiedIdentifier
                (identifier))))))))
  (clazz
    (identifier)
    (classBody
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (type
                (qualifiedIdentifier
                  (identifier)))
              (type
                (qualifiedIdentifier
                  (identifier))))
            (type
              (qualifiedIdentifier
                (identifier))))))
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (type
              (type
                (stringConstant))
              (type
                (stringConstant)))
            (type
              (stringConstant)))))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectProperty
          (identifier)
          (trueLiteral))
        (objectProperty
          (identifier)
          (nullLiteral))
        (objectProperty
          (identifier)
          (trueLiteral))
        (objectProperty
          (identifier)
          (trueLiteral)))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectProperty
          (identifier)
          (slStringLiteral))
        (objectProperty
          (identifier)
          (slStringLiteral))
        (objectProperty
          (identifier)
          (slStringLiteral))
        (objectProperty
          (identifier)
          (slStringLiteral)))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectProperty
          (identifier)
          (functionLiteral
            (parameterList
              (typedIdentifier
                (identifier)))
            (slStringLiteral)))
        (objectProperty
          (identifier)
          (functionLiteral
            (parameterList
              (typedIdentifier
                (identifier)))
            (floatLiteral)))
        (objectProperty
          (identifier)
          (slStringLiteral)))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectProperty
          (identifier)
          (slStringLiteral))
        (objectProperty
          (identifier)
          (methodCallExpr
            (identifier)
            (argumentList
              (intLiteral)
              (floatLiteral)
              (intLiteral))))
        (objectProperty
          (identifier)
          (methodCallExpr
            (identifier)
            (argumentList
              (intLiteral)
              (methodCallExpr
                (identifier)
                (argumentList
                  (floatLiteral)))
              (intLiteral))))
        (objectProperty
          (identifier)
          (trueLiteral))
        (objectProperty
          (identifier)
          (propertyCallExpr
            (intLiteral)
            (identifier)))
        (objectProperty
          (identifier)
          (propertyCallExpr
            (intLiteral)
            (identifier)))
        (objectProperty
          (identifier)
          (methodCallExpr
            (identifier)
            (argumentList
              (intLiteral)
              (intLiteral)))))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectProperty
          (identifier)
          (methodCallExpr
            (identifier)
            (argumentList
              (slStringLiteral)
              (slStringLiteral))))
        (objectProperty
          (identifier)
          (methodCallExpr
            (identifier)
            (argumentList
              (floatLiteral)
              (intLiteral))))
        (objectProperty
          (identifier)
          (methodCallExpr
            (identifier)
            (argumentList)))
        (objectProperty
          (identifier)
          (methodCallExpr
            (identifier)
            (argumentList
              (intLiteral)
              (slStringLiteral)
              (intLiteral)
              (methodCallExpr
                (identifier)
                (argumentList
                  (slStringLiteral)
                  (slStringLiteral)))
              (methodCallExpr
                (identifier)
                (argumentList
                  (intLiteral)
                  (intLiteral)
                  (intLiteral)))
              (slStringLiteral)
              (methodCallExpr
                (identifier)
                (argumentList
                  (intLiteral)
                  (intLiteral)
                  (intLiteral)))
              (methodCallExpr
                (identifier)
                (argumentList
                  (slStringLiteral)
                  (slStringLiteral))))))
        (objectProperty
          (identifier)
          (propertyCallExpr
            (intLiteral)
            (identifier)))
        (objectProperty
          (identifier)
          (nullLiteral))
        (objectProperty
          (identifier)
          (nullLiteral)))))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody))))
