Skip to content

Issues with unapply signature help #15248

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

Closed
tgodzik opened this issue May 20, 2022 · 0 comments · Fixed by #15278
Closed

Issues with unapply signature help #15248

tgodzik opened this issue May 20, 2022 · 0 comments · Fixed by #15278
Assignees

Comments

@tgodzik
Copy link
Contributor

tgodzik commented May 20, 2022

Compiler version

3.2.0-RC1-bin-20220519-ee9cc8f-NIGHTLY

Minimized code

  1. Actual unapply invocation.
object And {
  def unapply[A](a: A): Some[(A, A)] = Some((a, a))
}
object a {
  And.unapply(@@)
}
  1. Option returned in unapply.
object OpenBrowserCommand {
  def unapply(command: String): Option[Option[Int]] = {
    Some(Some(1))
  }

  "" match {
    case OpenBrowserCommand(@@) =>
  }
}
  1. Unknown type
case class Two[T](a: T, b: T)
object Main {
  (null: Any) match {
    case Two(@@) =>
  }
}

Output

(A, A)
 ^
(String)
 ^^^^^^
(a: T$1, b: T$1)
 ^^^^^^

Expectation

unapply[A](a: A): Some[(A, A)]
           ^^^^
(Option[Int])
 ^^^^^^^^^^^
(Any, Any)
 ^^^
@tgodzik tgodzik added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label area:ide and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 20, 2022
@rochala rochala self-assigned this May 23, 2022
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.

2 participants