The common supertype decides, which members are accessible, so that is the most relevant
If you allow union types to be inferred, the inferred types may run up to enormously complex types pretty quickly, leading to completely incomprehensible error messages
So, let me ask the reverse: why would you want union types to be inferred?
Inferring types which are “too precise” can lead to unintuitive typechecking issues later on. Note: Since this behavior limits the usability of union types, it might be changed in the future.
In a language which has union types and type inference, it would have been awesome if x was Int | String instead of Any. Int | String is more “informative” and more “strongly typed”
Having said that, it allows me to write
val x: Int | String = if condition then 1 else "one"
but then, writing it manually just feels so unintuitive and verbose