Skip to content

Unhelpful messages on badly formed unapplySeq #9538

@scabug

Description

@scabug
scala> object X { def unapplySeq(x: Any): Option[String] = { Some(x.toString.toUpperCase) }}
defined object X

scala> val X(z) = "hi"
<console>:11: error: too many patterns for object X offering Boolean: expected 0, found 1
       val X(z) = "hi"
           ^

scala> val X() = "hi"
<console>:11: error: error during expansion of this match (this is a scalac bug).
The underlying error was: type mismatch;
 found   : Option[String]
 required: Boolean
       val X() = "hi"
            ^

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions