Does Ceylon allow explicit Type Casting (downcast)?

56 views Asked by At

I know there's a concept of flow-sensitive typing in Ceylon in which we can narrow down the type of an expression by case. Is there a way to explicitly convert the type of an expression in Ceylon as in Java?

1

There are 1 answers

0
Lucas Werkmeister On

As a statement:

assert(variable is NarrowType);

I don’t remember if there’s a recommended way to do that as an expression, but you could always put the above (plus return variable;) into a generic function and call it with your expression