================================================================================
api/typeConverters
================================================================================

open class Animal {
  name: String
}

open class Bird extends Animal {}

open class Cat extends Animal {}

class Goose extends Bird {}

class Swallow extends Bird {}

class Robin extends Bird {}

animals = new Listing {
  new Animal {
    name = "Wolf"
  }
  new Bird {
    name = "Tweet"
  }
  new Cat {
    name = "Whiskers"
  }
  new Goose {
    name = "Neck"
  }
  new Swallow {
    name = "Snow"
  }
  new Robin {
    name = "Rainbow"
  }
}

output {
  renderer = new PcfRenderer {
    converters {
      [Animal] = (a) -> "\(a.name) Animal"
      [Goose] = (a) -> "Angry \(a.name)"
      [Bird] = (a) -> "Mr. \(a.name)"
    }
  }
}

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

(module
  (clazz
    (modifier)
    (identifier)
    (classBody
      (classProperty
        (identifier)
        (typeAnnotation
          (type
            (qualifiedIdentifier
              (identifier)))))))
  (clazz
    (modifier)
    (identifier)
    (classExtendsClause
      (qualifiedIdentifier
        (identifier)))
    (classBody))
  (clazz
    (modifier)
    (identifier)
    (classExtendsClause
      (qualifiedIdentifier
        (identifier)))
    (classBody))
  (clazz
    (identifier)
    (classExtendsClause
      (qualifiedIdentifier
        (identifier)))
    (classBody))
  (clazz
    (identifier)
    (classExtendsClause
      (qualifiedIdentifier
        (identifier)))
    (classBody))
  (clazz
    (identifier)
    (classExtendsClause
      (qualifiedIdentifier
        (identifier)))
    (classBody))
  (classProperty
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)))
      (objectBody
        (objectElement
          (newExpr
            (type
              (qualifiedIdentifier
                (identifier)))
            (objectBody
              (objectProperty
                (identifier)
                (slStringLiteral)))))
        (objectElement
          (newExpr
            (type
              (qualifiedIdentifier
                (identifier)))
            (objectBody
              (objectProperty
                (identifier)
                (slStringLiteral)))))
        (objectElement
          (newExpr
            (type
              (qualifiedIdentifier
                (identifier)))
            (objectBody
              (objectProperty
                (identifier)
                (slStringLiteral)))))
        (objectElement
          (newExpr
            (type
              (qualifiedIdentifier
                (identifier)))
            (objectBody
              (objectProperty
                (identifier)
                (slStringLiteral)))))
        (objectElement
          (newExpr
            (type
              (qualifiedIdentifier
                (identifier)))
            (objectBody
              (objectProperty
                (identifier)
                (slStringLiteral)))))
        (objectElement
          (newExpr
            (type
              (qualifiedIdentifier
                (identifier)))
            (objectBody
              (objectProperty
                (identifier)
                (slStringLiteral))))))))
  (classProperty
    (identifier)
    (objectBody
      (objectProperty
        (identifier)
        (newExpr
          (type
            (qualifiedIdentifier
              (identifier)))
          (objectBody
            (objectProperty
              (identifier)
              (objectBody
                (objectEntry
                  (variableExpr
                    (identifier))
                  (functionLiteral
                    (parameterList
                      (typedIdentifier
                        (identifier)))
                    (slStringLiteral
                      (interpolationExpr
                        (propertyCallExpr
                          (variableExpr
                            (identifier))
                          (identifier))))))
                (objectEntry
                  (variableExpr
                    (identifier))
                  (functionLiteral
                    (parameterList
                      (typedIdentifier
                        (identifier)))
                    (slStringLiteral
                      (interpolationExpr
                        (propertyCallExpr
                          (variableExpr
                            (identifier))
                          (identifier))))))
                (objectEntry
                  (variableExpr
                    (identifier))
                  (functionLiteral
                    (parameterList
                      (typedIdentifier
                        (identifier)))
                    (slStringLiteral
                      (interpolationExpr
                        (propertyCallExpr
                          (variableExpr
                            (identifier))
                          (identifier))))))))))))))
