File tree 2 files changed +19
-1
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -679,7 +679,7 @@ class Typer extends Namer
679
679
* @pre We are in pattern-matching mode (Mode.Pattern)
680
680
*/
681
681
def tryWithClassTag (tree : Typed , pt : Type )(implicit ctx : Context ): Tree = tree.tpt.tpe.dealias match {
682
- case tref : TypeRef if ! tref.symbol.isClass && ! ctx.isAfterTyper =>
682
+ case tref : TypeRef if ! tref.symbol.isClass && ! ctx.isAfterTyper && ! (tref =:= pt) =>
683
683
require(ctx.mode.is(Mode .Pattern ))
684
684
inferImplicit(defn.ClassTagClass .typeRef.appliedTo(tref),
685
685
EmptyTree , tree.tpt.span)(ctx.retractMode(Mode .Pattern )) match {
Original file line number Diff line number Diff line change
1
+
2
+ class Tasty {
3
+ type Term
4
+ type Select <: Term
5
+
6
+ given scala .reflect.ClassTag [Term ] = ???
7
+ given scala .reflect.ClassTag [Select ] = ???
8
+ object Select {
9
+ def unapply (x : Select ): Boolean = ???
10
+ }
11
+ }
12
+
13
+ object Foo {
14
+ def impl (given tasty : Tasty ): Unit = {
15
+ import tasty .{_ , given }
16
+ val Select () = (??? : Term )
17
+ }
18
+ }
You can’t perform that action at this time.
0 commit comments