Skip to content

Unclear warning in pattern match #23028

New issue

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

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

Already on GitHub? # to your account

Open
tgodzik opened this issue Apr 22, 2025 · 0 comments
Open

Unclear warning in pattern match #23028

tgodzik opened this issue Apr 22, 2025 · 0 comments
Labels
itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label

Comments

@tgodzik
Copy link
Contributor

tgodzik commented Apr 22, 2025

Compiler version

3.3.6-RC1 and 3.7.0-RC1 both display the issue.

Minimized code

case class RequestLogsOuter(streamId: Int)
@main def Test = {
  case class RequestLogs(streamId: Int)
  var x: List[Any] = List(RequestLogsOuter(12), RequestLogs(36), RequestLogs(42), 42)
  x.collect{
    case outer @ RequestLogsOuter(id) => println(1)
    case RequestLogs(42) => println(2) // warns in 3.3.6
    case v: RequestLogs => println(3) // warned in 3.3.5 if above is commented out
  }
}

Output

the type test for RequestLogs cannot be checked at runtime because it's a local class

Expectation

The code work correctly despite the warning, is that expected? Most likely showed up after #22099

@tgodzik tgodzik added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 22, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label
Projects
None yet
Development

No branches or pull requests

1 participant