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

Regression in akka/akka for type inference of partial functions #21676

Closed
WojciechMazur opened this issue Sep 30, 2024 · 1 comment · Fixed by #21684
Closed

Regression in akka/akka for type inference of partial functions #21676

WojciechMazur opened this issue Sep 30, 2024 · 1 comment · Fixed by #21684
Assignees
Labels
area:typer itype:bug regression This worked in a previous version but doesn't anymore
Milestone

Comments

@WojciechMazur
Copy link
Contributor

Based on OpenCB failure in akka/akka - build logs

Compiler version

Last good release: 3.6.0-RC1-bin-20240920-4293a45-NIGHTLY
First bad release: 3.6.0-RC1-bin-20240922-22ed2fb-NIGHTLY
Bisect points to b410f30

Minimized code

@main def Test = 
  val members = collection.immutable.SortedSet.empty[String]
  members.collect {
    var upNumber = 0
    {
      case m => 
        // upNumber += 1
        m
    }
  }

Output

-- [E007] Type Mismatch Error: /Users/wmazur/projects/sandbox/test.scala:3:18 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 3 |  members.collect {
   |                  ^
   |                  Found:    String => String
   |                  Required: PartialFunction[String @uncheckedVariance, Any]
 4 |    var upNumber = 0
 5 |    {
 6 |      case m => 
 7 |        // upNumber += 1
 8 |        m
 9 |    }
10 |  }
   |
   | longer explanation available when compiling with `-explain`

Expectation

Should infer correct type a partial function instead of regular function

@WojciechMazur WojciechMazur added itype:bug area:typer regression This worked in a previous version but doesn't anymore labels Sep 30, 2024
@Gedochao
Copy link
Contributor

Gedochao commented Oct 1, 2024

cc @odersky @dwijnand

@odersky odersky self-assigned this Oct 1, 2024
odersky added a commit to dotty-staging/dotty that referenced this issue Oct 1, 2024
@odersky odersky closed this as completed in 7bbed2b Oct 9, 2024
@WojciechMazur WojciechMazur added this to the 3.6.3 milestone Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typer itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants