File tree 2 files changed +24
-3
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -816,10 +816,13 @@ trait Checking {
816
816
case RefutableExtractor =>
817
817
val extractor =
818
818
val UnApply (fn, _, _) = pat : @ unchecked
819
- fn match
819
+ tpd.funPart(fn) match
820
820
case Select (id, _) => id
821
- case TypeApply (Select (id, _), _) => id
822
- em " pattern binding uses refutable extractor ` $extractor` "
821
+ case _ => EmptyTree
822
+ if extractor.isEmpty then
823
+ em " pattern binding uses refutable extractor "
824
+ else
825
+ em " pattern binding uses refutable extractor ` $extractor` "
823
826
824
827
val fix =
825
828
if isPatDef then " adding `: @unchecked` after the expression"
Original file line number Diff line number Diff line change
1
+ class Rational
2
+
3
+ import scala .quoted .*
4
+
5
+ class TC
6
+
7
+ object meta :
8
+ object rationalTE :
9
+ def unapply (using Quotes )(tr : quotes.reflect.TypeRepr ): Option [Rational ] = ???
10
+
11
+ object rationalTC :
12
+ def unapply (using Quotes )(using TC )(tr : quotes.reflect.TypeRepr ): Option [Rational ] = ???
13
+
14
+ def foo (using Quotes )(p : quotes.reflect.TypeRepr ): Unit =
15
+ val rationalTE(e) = p // warn: pattern binding uses refutable extractor `meta.rationalTE`
16
+
17
+ def bar (using Quotes )(using TC )(p : quotes.reflect.TypeRepr ): Unit =
18
+ val rationalTC(c) = p // warn: pattern binding uses refutable extractor `meta.rationalTC`
You can’t perform that action at this time.
0 commit comments