5.22 type check
It is possible to employ compile-time type checks using the following syntax:
(expr : type)
The parentheses are mandatory. Unlike safe casts this construct has no run-time impact. It has two compile-time implications:
- Top-down inference is used to type
expr with type
- The resulting typed expression is unified with type
This has the usual effect of both operations such as the given type being used as expected type when performing unqualified identifier resolution and the unification checking for abstract casts.