Skip to content

Unclear warning in pattern match #23028

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

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
area:pattern-matching area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug

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
@Gedochao Gedochao added area:reporting Error reporting including formatting, implicit suggestions, etc area:pattern-matching and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:pattern-matching area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Projects
None yet
Development

No branches or pull requests

2 participants