Is there a way to assert the compile time type of an expression?
(I don't want a test that passes because the runtime type of the result of the expression is a subtype of the requested type - I want to assert exactly what type the compiler decided the expression had. When doing overloading with subtypes and overriding with more specific return types it's important.)
c
christophsturm
03/24/2022, 10:51 AM
why not
val x: ExpectedType = expression
? that will fail at compile time
r
Rob Elliot
03/24/2022, 10:53 AM
If
expression
returns a subtype of
ExpectedType
that will pass. So in order to prove the compile time return type is