The included test case was broken by D111509 since now
those types can have sugar.
Replace dyn_casts / cast and small refactor to preserve sugar by
not stripping it down when type is already Complex.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Can you collapse this check with the next line? It just looks weird checking RHSComplexType twice and having RHSType on the opposite side of each one. It took me a while to understand what was going on.
This comment also applies a few lines down.