The error message seems strange, but you really can't expect this to work. At compile time, width and height are UILength, not UIAbsLength, so your when tests will fail. You need a template if you want to generate different code depending on the type at the call site. And if you want the decision to be made at run time then you need a discriminated type ... a float32 only contains the 32 value bits, not any type information.
- Problem with default values for a generic parameter doofenstein
- Re: Problem with default values for a generic parameter jibal