@@ -20,7 +20,6 @@ import util.Positions.{Position, NoPosition}
20
20
import util .Stats ._
21
21
import util .{DotClass , SimpleIdentitySet }
22
22
import reporting .diagnostic .Message
23
- import reporting .diagnostic .messages .CyclicReferenceInvolving
24
23
import ast .tpd ._
25
24
import ast .TreeTypeMap
26
25
import printing .Texts ._
@@ -32,10 +31,9 @@ import Uniques._
32
31
import collection .{mutable , Seq , breakOut }
33
32
import config .Config
34
33
import annotation .tailrec
35
- import Flags .FlagSet
36
34
import language .implicitConversions
37
35
import scala .util .hashing .{ MurmurHash3 => hashing }
38
- import config .Printers .{core , typr , cyclicErrors }
36
+ import config .Printers .{core , typr }
39
37
import java .lang .ref .WeakReference
40
38
41
39
object Types {
@@ -647,17 +645,14 @@ object Types {
647
645
}
648
646
649
647
val recCount = ctx.findMemberCount
650
- if (recCount >= Config .LogPendingFindMemberThreshold ) {
651
- if (ctx.findMemberCount > ctx.settings.XmaxMemberRecursions .value)
652
- throw new CyclicFindMember (pre, name)
648
+ if (recCount >= Config .LogPendingFindMemberThreshold )
653
649
ctx.pendingMemberSearches = name :: ctx.pendingMemberSearches
654
- }
655
650
ctx.findMemberCount = recCount + 1
656
651
try go(this )
657
652
catch {
658
653
case ex : Throwable =>
659
654
core.println(s " findMember exception for $this member $name, pre = $pre, recCount = $recCount" )
660
- throw ex // DEBUG
655
+ throw new RecursionOverflow ( " find-member " , pre, name, ex)
661
656
}
662
657
finally {
663
658
if (recCount >= Config .LogPendingFindMemberThreshold )
@@ -4546,56 +4541,6 @@ object Types {
4546
4541
def apply (pre : Type , name : Name )(implicit ctx : Context ): Boolean = true
4547
4542
}
4548
4543
4549
- // ----- Exceptions -------------------------------------------------------------
4550
-
4551
- class TypeError (msg : String ) extends Exception (msg)
4552
-
4553
- class MalformedType (pre : Type , denot : Denotation , absMembers : Set [Name ])
4554
- extends TypeError (
4555
- s " malformed type: $pre is not a legal prefix for $denot because it contains abstract type member ${if (absMembers.size == 1 ) " " else " s" } ${absMembers.mkString(" , " )}" )
4556
-
4557
- class MissingType (pre : Type , name : Name )(implicit ctx : Context ) extends TypeError (
4558
- i """ cannot resolve reference to type $pre. $name
4559
- |the classfile defining the type might be missing from the classpath ${otherReason(pre)}""" ) {
4560
- if (ctx.debug) printStackTrace()
4561
- }
4562
-
4563
- def showPrefixSafely (pre : Type )(implicit ctx : Context ): String = pre.stripTypeVar match {
4564
- case pre : TermRef => i " ${pre.termSymbol.name}. "
4565
- case pre : TypeRef => i " ${pre.typeSymbol.name}# "
4566
- case pre : TypeProxy => showPrefixSafely(pre.underlying)
4567
- case _ => if (pre.typeSymbol.exists) i " ${pre.typeSymbol.name}# " else " ."
4568
- }
4569
-
4570
- class CyclicFindMember (pre : Type , name : Name )(implicit ctx : Context ) extends TypeError (
4571
- i """ member search for ${showPrefixSafely(pre)}$name too deep.
4572
- |searches, from inner to outer: . ${ctx.pendingMemberSearches}% .% """ )
4573
-
4574
- private def otherReason (pre : Type )(implicit ctx : Context ): String = pre match {
4575
- case pre : ThisType if pre.cls.givenSelfType.exists =>
4576
- i " \n or the self type of $pre might not contain all transitive dependencies "
4577
- case _ => " "
4578
- }
4579
-
4580
- class CyclicReference private (val denot : SymDenotation )
4581
- extends TypeError (s " cyclic reference involving $denot" ) {
4582
- def toMessage (implicit ctx : Context ) = CyclicReferenceInvolving (denot)
4583
- }
4584
-
4585
- object CyclicReference {
4586
- def apply (denot : SymDenotation )(implicit ctx : Context ): CyclicReference = {
4587
- val ex = new CyclicReference (denot)
4588
- if (! (ctx.mode is Mode .CheckCyclic )) {
4589
- cyclicErrors.println(ex.getMessage)
4590
- for (elem <- ex.getStackTrace take 200 )
4591
- cyclicErrors.println(elem.toString)
4592
- }
4593
- ex
4594
- }
4595
- }
4596
-
4597
- class MergeError (msg : String , val tp1 : Type , val tp2 : Type ) extends TypeError (msg)
4598
-
4599
4544
// ----- Debug ---------------------------------------------------------
4600
4545
4601
4546
@ sharable var debugTrace = false
0 commit comments