diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/ast/Trees.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Flags.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/NameOps.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymbolLoaders.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Symbols.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/util/Attachment.scala | 2 |
10 files changed, 13 insertions, 17 deletions
diff --git a/src/dotty/tools/dotc/ast/Trees.scala b/src/dotty/tools/dotc/ast/Trees.scala index 12a635ce6..c1cb474a3 100644 --- a/src/dotty/tools/dotc/ast/Trees.scala +++ b/src/dotty/tools/dotc/ast/Trees.scala @@ -787,10 +787,6 @@ object Trees { def flatten[T >: Untyped](trees: List[Tree[T]]): List[Tree[T]] = { var buf: ListBuffer[Tree[T]] = null - def add(tree: Tree[T]) = { - assert(!tree.isInstanceOf[Thicket[_]]) - buf += tree - } var xs = trees while (xs.nonEmpty) { xs.head match { diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 06ab17a52..9c8de3829 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -466,7 +466,7 @@ object Denotations { */ private def bringForward()(implicit ctx: Context): SingleDenotation = this match { case denot: SymDenotation if ctx.stillValid(denot) => - if (denot.exists) assert(ctx.runId > validFor.runId) + if (denot.exists) assert(ctx.runId > validFor.runId, s"denotation $denot invalid in run ${ctx.runId}. ValidFor: $validFor") var d: SingleDenotation = denot do { d.validFor = Period(ctx.period.runId, d.validFor.firstPhaseId, d.validFor.lastPhaseId) @@ -527,7 +527,7 @@ object Denotations { while (!(cur.validFor contains currentPeriod)) { cur = cur.nextInRun cnt += 1 - assert(cnt <= MaxPossiblePhaseId) + assert(cnt <= MaxPossiblePhaseId, "seems to be a loop in Denotations") } } cur @@ -704,7 +704,7 @@ object Denotations { } case class DenotUnion(denots1: PreDenotation, denots2: PreDenotation) extends PreDenotation { - assert(denots1.exists && denots2.exists) + assert(denots1.exists && denots2.exists, s"Union of non-existing denotations ($denots1) and ($denots2)") def exists = true def first = denots1.first def toDenot(pre: Type)(implicit ctx: Context) = diff --git a/src/dotty/tools/dotc/core/Flags.scala b/src/dotty/tools/dotc/core/Flags.scala index ab17c7176..0678b79be 100644 --- a/src/dotty/tools/dotc/core/Flags.scala +++ b/src/dotty/tools/dotc/core/Flags.scala @@ -166,7 +166,7 @@ object Flags { /** The conjunction of all flags in given flag set */ def allOf(flagss: FlagSet*) = { - assert(flagss forall (_.numFlags == 1)) + assert(flagss forall (_.numFlags == 1), "Flags.allOf doesn't support flag " + flagss.find(_.numFlags != 1)) FlagConjunction(union(flagss: _*).bits) } diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala index de9bc0e5e..1a9e5eddb 100644 --- a/src/dotty/tools/dotc/core/NameOps.scala +++ b/src/dotty/tools/dotc/core/NameOps.scala @@ -198,7 +198,7 @@ object NameOps { if (p >= 0) (name drop (p + TRAIT_SETTER_SEPARATOR.length)).asTermName.setterToGetter else { - assert(name endsWith SETTER_SUFFIX, name) + assert(name.endsWith(SETTER_SUFFIX), name + " is referenced as a setter but has wrong name format") name.take(name.length - SETTER_SUFFIX.length).asTermName } } diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index ebe52d522..5fbf6c2c4 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -754,7 +754,7 @@ object SymDenotations { // ----- denotation fields and accessors ------------------------------ - if (initFlags is (Module, butNot = Package)) assert(name.isModuleClassName) + if (initFlags is (Module, butNot = Package)) assert(name.isModuleClassName, s"module naming inconsistency: $name") /** The symbol asserted to have type ClassSymbol */ def classSymbol: ClassSymbol = symbol.asInstanceOf[ClassSymbol] diff --git a/src/dotty/tools/dotc/core/SymbolLoaders.scala b/src/dotty/tools/dotc/core/SymbolLoaders.scala index 2484165f3..530d084c7 100644 --- a/src/dotty/tools/dotc/core/SymbolLoaders.scala +++ b/src/dotty/tools/dotc/core/SymbolLoaders.scala @@ -28,7 +28,7 @@ class SymbolLoaders { protected def enterNew( owner: Symbol, member: Symbol, completer: SymbolLoader, scope: Scope = EmptyScope)(implicit ctx: Context): Symbol = { - assert(scope.lookup(member.name) == NoSymbol, owner.fullName + "." + member.name) + assert(scope.lookup(member.name) == NoSymbol, s"${owner.fullName}.${member.name} already has a symbol") owner.asClass.enter(member, scope) member } diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index 5bba99c9c..408142ede 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -355,8 +355,8 @@ object Symbols { final def isType(implicit ctx: Context): Boolean = denot.isType final def isClass: Boolean = isInstanceOf[ClassSymbol] - final def asTerm(implicit ctx: Context): TermSymbol = { assert(isTerm); asInstanceOf[TermSymbol] } - final def asType(implicit ctx: Context): TypeSymbol = { assert(isType); asInstanceOf[TypeSymbol] } + final def asTerm(implicit ctx: Context): TermSymbol = { assert(isTerm, s"asTerm called on not-a-Term $this" ); asInstanceOf[TermSymbol] } + final def asType(implicit ctx: Context): TypeSymbol = { assert(isType, s"isType called on not-a-Type $this"); asInstanceOf[TypeSymbol] } final def asClass: ClassSymbol = asInstanceOf[ClassSymbol] /** A unique, densely packed integer tag for each class symbol, -1 @@ -367,7 +367,7 @@ object Symbols { /** This symbol entered into owner's scope (owner must be a class). */ final def entered(implicit ctx: Context): this.type = { - assert(this.owner.isClass) // !!! DEBUG + assert(this.owner.isClass, s"symbol ($this) entered the scope of non-class owner ${this.owner}") // !!! DEBUG this.owner.asClass.enter(this) if (this is Module) this.owner.asClass.enter(this.moduleClass) this diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index bc8d7dfd2..9185c6c63 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -986,7 +986,7 @@ object Types { val prefix: Type val name: Name - assert(prefix.isValueType || (prefix eq NoPrefix)) + assert(prefix.isValueType || (prefix eq NoPrefix), s"invalid prefix $prefix") private[this] var lastDenotation: Denotation = _ private[this] var lastSymbol: Symbol = _ diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 4b43aa8b7..588d1b3ea 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -212,7 +212,7 @@ trait Applications extends Compatibility { self: Typer => else if (cx.scope != cx.outer.scope && cx.denotNamed(methRef.name).hasAltWith(_.symbol == meth)) { val denot = cx.denotNamed(getterName) - assert(denot.exists) + assert(denot.exists, s"non-existent getter denotation ($denot) for getter($getterName)") cx.owner.thisType.select(getterName, denot) } else findDefault(cx.outer) } diff --git a/src/dotty/tools/dotc/util/Attachment.scala b/src/dotty/tools/dotc/util/Attachment.scala index 061438bb4..d9e88a135 100644 --- a/src/dotty/tools/dotc/util/Attachment.scala +++ b/src/dotty/tools/dotc/util/Attachment.scala @@ -91,7 +91,7 @@ object Attachment { private[Attachment] var next: Link[_] = null final def pushAttachment[V](key: Key[V], value: V): Unit = { - assert(!getAttachment(key).isDefined) + assert(!getAttachment(key).isDefined, s"duplicate attachment for key $key") next = new Link(key, value, next) } } |