if myBool: 2 else: "X"
    
    
    Run

is invalid because it is only determined at _runtime_ which type it will be. 
Hence the compiler can't know at compile-time which type the expression has. If 
you can use `when` instead of `if` I think it could work, but the `myBool` 
needs to be known at compile-time.

If you only know the value of it at runtime, then you have to do something 
along a case object or write a macro that rewrites the if-statement to 
something the compiler can predict the types of. 

Reply via email to