File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -1440,7 +1440,7 @@ object desugar {
14401440 def collect (tree : Tree ): Unit = tree match {
14411441 case Bind (nme.WILDCARD , tree1) =>
14421442 collect(tree1)
1443- case tree @ Bind (_, Typed (tree1, tpt)) if ! mayBeTypePat(tpt) =>
1443+ case tree @ Bind (_, Typed (tree1, tpt)) =>
14441444 add(tree, tpt)
14451445 collect(tree1)
14461446 case tree @ Bind (_, tree1) =>
Original file line number Diff line number Diff line change @@ -164,15 +164,6 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] =>
164164 /** Is name a left-associative operator? */
165165 def isLeftAssoc (operator : Name ): Boolean = ! operator.isEmpty && (operator.toSimpleName.last != ':' )
166166
167- /** can this type be a type pattern? */
168- def mayBeTypePat (tree : Tree ): Boolean = unsplice(tree) match {
169- case RefinedTypeTree (tpt, refinements) => mayBeTypePat(tpt) || refinements.exists(_.isInstanceOf [Bind ])
170- case AppliedTypeTree (tpt, args) => mayBeTypePat(tpt) || args.exists(_.isInstanceOf [Bind ])
171- case Select (tpt, _) => mayBeTypePat(tpt)
172- case Annotated (tpt, _) => mayBeTypePat(tpt)
173- case _ => false
174- }
175-
176167 /** Is this argument node of the form <expr> : _*, or is it a reference to
177168 * such an argument ? The latter case can happen when an argument is lifted.
178169 */
Original file line number Diff line number Diff line change 1+ object Test {
2+
3+ (??? : Any ) match {
4+
5+ case x1 | y1 => ??? // error // error
6+
7+ case _ : List [t2] | y2 => ??? // error // error
8+
9+ case x3 : Int | y3 : String => ??? // error // error
10+
11+ }
12+ }
You can’t perform that action at this time.
0 commit comments