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

The auto-approximated bound for match types leaks type captures #21256

Closed
sjrd opened this issue Jul 24, 2024 · 1 comment · Fixed by #22142
Closed

The auto-approximated bound for match types leaks type captures #21256

sjrd opened this issue Jul 24, 2024 · 1 comment · Fixed by #22142

Comments

@sjrd
Copy link
Member

sjrd commented Jul 24, 2024

Compiler version

since 3.4.2, still present in main

Minimized code

object Test {
  type MTWithBind[X] = X match {
    case List[t] => t
  }
}

Output

With -Xprint:typer:

    type MTWithBind[X >: Nothing <: Any] =
      X match 
        {
          case List[t @ _] => t
        }
       <: t

Expectation

t should not appear in the inferred bound of the match type, since it is outside of its declaring scope.

Overall I'm getting increasingly uneasy about #19761. 🫤

@mbovel
Copy link
Member

mbovel commented Dec 1, 2024

This issue was picked for the Scala Issue Spree of tomorrow, Monday, December 2nd. @dwijnand, @bracevac and @HarrisL2 will be working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants