File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -680,7 +680,7 @@ class Typer extends Namer
680680 * @pre We are in pattern-matching mode (Mode.Pattern)
681681 */
682682 def tryWithClassTag (tree : Typed , pt : Type )(implicit ctx : Context ): Tree = tree.tpt.tpe.dealias match {
683- case tref : TypeRef if ! tref.symbol.isClass && ! ctx.isAfterTyper =>
683+ case tref : TypeRef if ! tref.symbol.isClass && ! ctx.isAfterTyper && ! (tref =:= pt) =>
684684 require(ctx.mode.is(Mode .Pattern ))
685685 inferImplicit(defn.ClassTagClass .typeRef.appliedTo(tref),
686686 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