Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add case in for comprehension. prepare Scala 3.4 #363

Merged
merged 1 commit into from
Dec 26, 2023

Conversation

xuwei-k
Copy link
Member

@xuwei-k xuwei-k commented Dec 26, 2023

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()

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()
```
Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@eed3si9n eed3si9n merged commit be7a2e3 into sbt:develop Dec 26, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants