Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
case
in for comprehension. prepare Scala 3.4
scala/scala3@849ee9c ``` Welcome to Scala 3.4.0-RC1 (1.8.0_392, Java OpenJDK 64-Bit Server VM). Type in expressions for evaluation. Or try :help. scala> for((f, true) <- List.empty[(Int, Boolean)]) yield f -- Error: ---------------------------------------------------------------------- 1 |for((f, true) <- List.empty[(Int, Boolean)]) yield f | ^^^^ |pattern's type (true : Boolean) is more specialized than the right hand side expression's type Boolean | |If the narrowing is intentional, this can be communicated by adding the `case` keyword before the full pattern, |which will result in a filtering for expression (using `withFilter`). 1 error found ``` ``` Welcome to Scala 3.3.1 (1.8.0_392, Java OpenJDK 64-Bit Server VM). Type in expressions for evaluation. Or try :help. scala> for((f, true) <- List.empty[(Int, Boolean)]) yield f 1 warning found -- Warning: -------------------------------------------------------------------- 1 |for((f, true) <- List.empty[(Int, Boolean)]) yield f | ^^^^ |pattern's type (true : Boolean) is more specialized than the right hand side expression's type Boolean | |If the narrowing is intentional, this can be communicated by adding the `case` keyword before the full pattern, |which will result in a filtering for expression (using `withFilter`). val res0: List[Int] = List() ```
- Loading branch information