Closed
Description
Compiler version
3.0.0-RC3
Minimized code
enum Func[-A, +B] {
case Double extends Func[Int, Int]
case ToString extends Func[Float, String]
def run: A => B = this match {
case Double => (x: Int) => x * 2
case ToString => (x: Float) => x.toString
}
}
Output
// The compiler complains at each case:
Found: Int
Required: B
// and
Fount: String
Required: B
Expectation
The compiler should be able to unify B
with Int
or String
depending on the case being evaluated.