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

Open
sjrd opened this issue Jul 24, 2024 · 0 comments
Open

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

sjrd opened this issue Jul 24, 2024 · 0 comments

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. 🫤

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

No branches or pull requests

2 participants