tryCast

fun Type.tryCast(targetType: Type, hint: HasType? = null, targetHint: HasType? = null): CastResult

This function checks, if this Type can be cast into targetType. Note, this also takes the TypeOperations of the type into account, which means that pointer types of derived types will not match with a non-pointer type of its base type. But, if both are pointer types, they will match.

Optionally, the nodes that hold the respective type can be supplied as hint and targetHint.