File tree 5 files changed +26
-12
lines changed
compiler/src/dotty/tools/dotc
5 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -542,16 +542,17 @@ object Types {
542
542
* Inherited by all type proxies. Overridden for And and Or types.
543
543
* `Nil` for all other types.
544
544
*/
545
- def baseClasses (using Context ): List [ClassSymbol ] = {
545
+ def baseClasses (using Context ): List [ClassSymbol ] =
546
546
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)
555
556
556
557
// ----- Member access -------------------------------------------------
557
558
Original file line number Diff line number Diff line change @@ -1345,8 +1345,11 @@ class Namer { typer: Typer =>
1345
1345
// TODO: Look only at member of supertype instead?
1346
1346
lazy val schema = paramFn(WildcardType )
1347
1347
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) =>
1350
1353
def instantiatedResType (info : Type , paramss : List [List [Symbol ]]): Type = info match
1351
1354
case info : PolyType =>
1352
1355
paramss match
Original file line number Diff line number Diff line change @@ -1320,7 +1320,9 @@ class Typer extends Namer
1320
1320
EmptyTree
1321
1321
}
1322
1322
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 )
1324
1326
}
1325
1327
else typed(tree.tpt)
1326
1328
// 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