File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -830,10 +830,13 @@ trait Checking {
830830 case RefutableExtractor =>
831831 val extractor =
832832 val UnApply (fn, _, _) = pat : @ unchecked
833- fn match
833+ tpd.funPart(fn) match
834834 case Select (id, _) => id
835- case TypeApply (Select (id, _), _) => id
836- em " pattern binding uses refutable extractor ` $extractor` "
835+ case _ => EmptyTree
836+ if extractor.isEmpty then
837+ em " pattern binding uses refutable extractor "
838+ else
839+ em " pattern binding uses refutable extractor ` $extractor` "
837840
838841 val fix =
839842 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