Skip to content

Commit eb6dead

Browse files
committed
Refutable extractor may be an Apply tree
Fixes #15650
1 parent 6efd92d commit eb6dead

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ trait Checking {
832832
val UnApply(fn, _, _) = pat: @unchecked
833833
fn match
834834
case Select(id, _) => id
835+
case Apply(Select(id, _), _) => id
835836
case TypeApply(Select(id, _), _) => id
836837
em"pattern binding uses refutable extractor `$extractor`"
837838

tests/pos/i15650.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Rational
2+
3+
import scala.quoted.*
4+
5+
object meta:
6+
object rationalTE:
7+
def unapply(using Quotes)(tr: quotes.reflect.TypeRepr): Option[Rational] = ???
8+
9+
def foo(using Quotes)(p: quotes.reflect.TypeRepr): Unit =
10+
val rationalTE(e) = p // warn: pattern binding uses refutable extractor `meta.rationalTE`

0 commit comments

Comments
 (0)