File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -1239,7 +1239,11 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
12391239 if (leftRoot.isStable || (ctx.isAfterTyper || ctx.mode.is(Mode .TypevarsMissContext ))
12401240 && leftRoot.member(tparam.name).exists) {
12411241 val captured = TypeRef (leftRoot, tparam)
1242- isSubArg(captured, arg2)
1242+ try isSubArg(captured, arg2)
1243+ catch case ex : TypeError =>
1244+ // The captured reference could be illegal and cause a
1245+ // TypeError to be thrown in argDenot
1246+ false
12431247 }
12441248 else if (v > 0 )
12451249 isSubType(paramBounds(tparam).hi, arg2)
Original file line number Diff line number Diff line change 1+ package example
2+
3+ sealed abstract class Tree [T ]
4+ case class Lam [T ,U ]() extends Tree [Any ]
5+ case class App [T ,U ]() extends Tree [Any ]
6+ case class Var () extends Tree [Any ]
7+
8+ object Branch :
9+ def unapply (branch : Lam [? ,? ] | App [? ,? ]): true = true
10+
11+ private def foo (s : Option [Tree [? ]]) = s match // seems to only occur in a nested pattern
12+ case Some (_ : Var ) => true // must come first
13+ case Some (Branch ()) => true // must be unapply and not direct type check
14+ case _ => false
You can’t perform that action at this time.
0 commit comments