Skip to content

Commit c74dde2

Browse files
authored
Merge pull request #11429 from dotty-staging/fix-11421
Skip overloaded methods when looking for an extractor
2 parents 2bb42d5 + 3d67ee4 commit c74dde2

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ class Typer extends Namer
158158
*/
159159
def qualifies(denot: Denotation): Boolean =
160160
reallyExists(denot)
161-
&& !(pt.isInstanceOf[UnapplySelectionProto] && denot.symbol.is(Method, butNot = Accessor))
161+
&& (!pt.isInstanceOf[UnapplySelectionProto]
162+
|| denot.hasAltWith(sd => !sd.symbol.is(Method, butNot = Accessor)))
162163
&& !denot.symbol.is(PackageClass)
163164

164165
/** Find the denotation of enclosing `name` in given context `ctx`.

tests/pos/i11421.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Foo {
2+
def ::(hd: String): Foo = ???
3+
def ::(hd: Boolean): Foo = ???
4+
5+
List(1, 2) match {
6+
case x :: tail => ()
7+
case _ => ()
8+
}
9+
}

0 commit comments

Comments
 (0)