Skip to content

Commit 3e72e33

Browse files
committed
Don't bind wildcards as type symbols in type patterns
1 parent e4e073b commit 3e72e33

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Symbols._
1111
import Types._
1212
import Decorators._
1313
import Constants._
14-
import StdNames.nme
14+
import StdNames._
1515
import Contexts.Context
1616
import Names.{Name, TermName, EmptyTermName}
1717
import NameOps._
@@ -658,8 +658,10 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
658658
val getBoundVars = new TreeAccumulator[List[TypeSymbol]] {
659659
def apply(syms: List[TypeSymbol], t: Tree)(implicit ctx: Context) = {
660660
val syms1 = t match {
661-
case t: Bind if t.symbol.isType => t.symbol.asType :: syms
662-
case _ => syms
661+
case t: Bind if t.symbol.isType && t.name != tpnme.WILDCARD =>
662+
t.symbol.asType :: syms
663+
case _ =>
664+
syms
663665
}
664666
foldOver(syms1, t)
665667
}

tests/run/TupleAbstract.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object Tuples {
1919

2020
transparent def _size(xs: typelevel.Tuple): Int = xs match {
2121
case _: typelevel.Empty => 0
22-
case _: typelevel.Pair[x1, xs1] => _size(erasedValue[xs1]) + 1
22+
case _: typelevel.Pair[_, xs1] => _size(erasedValue[xs1]) + 1
2323
}
2424

2525
val x = _size(erasedValue[Pair[Int, Pair[String, Empty]]])

0 commit comments

Comments
 (0)