You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refine criterion when to skip identifiers in pattern constructors
There's a strange and almost forgotten rule that disqualifies method symbols
from direct lookup when the identifier is the constructor of a pattern. This
is done to make code like this work:
```
class List[T]:
def :: (that: T): List[T]
def f(...) = this match
case x :: xs => ...
object `::`:
def unapply...
```
Without the rule, the `::` in the pattern would resolve to the `::` method
in `List` which does not have an `unapply`. We need to skip that method to get
to the outer `::` object.
The rule plays badly with export forwarders, which are methods, and therefore
were ineligible for pattern constructurs. We now change the rule so that methods
are also accepted as unqualified `unapply` prefixes as long as they are parameterless.
Fixes#15347
0 commit comments