File tree Expand file tree Collapse file tree 5 files changed +26
-12
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 5 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -542,16 +542,17 @@ object Types {
542542 * Inherited by all type proxies. Overridden for And and Or types.
543543 * `Nil` for all other types.
544544 */
545- def baseClasses (using Context ): List [ClassSymbol ] = {
545+ def baseClasses (using Context ): List [ClassSymbol ] =
546546 record(" baseClasses" )
547- this match {
548- case tp : TypeProxy =>
549- tp.underlying.baseClasses
550- case tp : ClassInfo =>
551- tp.cls.classDenot.baseClasses
552- case _ => Nil
553- }
554- }
547+ try
548+ this match
549+ case tp : TypeProxy =>
550+ tp.underlying.baseClasses
551+ case tp : ClassInfo =>
552+ tp.cls.classDenot.baseClasses
553+ case _ => Nil
554+ catch case ex : Throwable =>
555+ handleRecursive(" base classes of" , this .show, ex)
555556
556557// ----- Member access -------------------------------------------------
557558
Original file line number Diff line number Diff line change @@ -1345,8 +1345,11 @@ class Namer { typer: Typer =>
13451345 // TODO: Look only at member of supertype instead?
13461346 lazy val schema = paramFn(WildcardType )
13471347 val site = sym.owner.thisType
1348-
1349- sym.owner.info.baseClasses.tail.foldLeft(NoType : Type ) { (tp, cls) =>
1348+ val bcs = sym.owner.info.baseClasses
1349+ if bcs.isEmpty then
1350+ assert(ctx.reporter.errorsReported)
1351+ NoType
1352+ else bcs.tail.foldLeft(NoType : Type ) { (tp, cls) =>
13501353 def instantiatedResType (info : Type , paramss : List [List [Symbol ]]): Type = info match
13511354 case info : PolyType =>
13521355 paramss match
Original file line number Diff line number Diff line change @@ -1320,7 +1320,9 @@ class Typer extends Namer
13201320 EmptyTree
13211321 }
13221322 case tp =>
1323- throw new java.lang.Error (i " internal error: closing over non-method $tp, pos = ${tree.span}" )
1323+ if ! tp.isErroneous then
1324+ throw new java.lang.Error (i " internal error: closing over non-method $tp, pos = ${tree.span}" )
1325+ TypeTree (defn.AnyType )
13241326 }
13251327 else typed(tree.tpt)
13261328 // println(i"typing closure $tree : ${meth1.tpe.widen}")
Original file line number Diff line number Diff line change 1+ type F <: F = 1 match { // error
2+ case _ => foo.foo // error // error
3+ }
4+ def foo (a : Int ): Unit = ???
Original file line number Diff line number Diff line change 1+ type T <: foo.a = Int match { // error
2+ case " " => foo.b // error
3+ }
4+ def foo (x : Int ): Unit = ???
You can’t perform that action at this time.
0 commit comments