diff options
Diffstat (limited to 'src')
22 files changed, 29 insertions, 33 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/Constants.scala b/src/dotty/tools/dotc/core/Constants.scala index b04ec0e89..48c832c4b 100644 --- a/src/dotty/tools/dotc/core/Constants.scala +++ b/src/dotty/tools/dotc/core/Constants.scala @@ -85,7 +85,7 @@ object Constants { def booleanValue: Boolean = if (tag == BooleanTag) value.asInstanceOf[Boolean] - else throw new Error("value " + value + " is not a boolean"); + else throw new Error("value " + value + " is not a boolean") def byteValue: Byte = tag match { case ByteTag => value.asInstanceOf[Byte] diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index 1793a1938..dd96023d7 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -411,7 +411,7 @@ object Contexts { /** Allocate and return next free superclass id */ private[core] def nextSuperId: Int = { - lastSuperId += 1; + lastSuperId += 1 if (lastSuperId >= classOfId.length) { val tmp = new Array[ClassSymbol](classOfId.length * 2) classOfId.copyToArray(tmp) 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/Names.scala b/src/dotty/tools/dotc/core/Names.scala index 09fa6cf19..7585e1f37 100644 --- a/src/dotty/tools/dotc/core/Names.scala +++ b/src/dotty/tools/dotc/core/Names.scala @@ -251,7 +251,7 @@ object Names { private def equals(index: Int, cs: Array[Char], offset: Int, len: Int): Boolean = { var i = 0 while ((i < len) && (chrs(index + i) == cs(offset + i))) - i += 1; + i += 1 i == len } diff --git a/src/dotty/tools/dotc/core/Scopes.scala b/src/dotty/tools/dotc/core/Scopes.scala index a20433b1f..367713d11 100644 --- a/src/dotty/tools/dotc/core/Scopes.scala +++ b/src/dotty/tools/dotc/core/Scopes.scala @@ -231,7 +231,7 @@ object Scopes { if (e1 == e) hashTable(index) = e.tail else { - while (e1.tail != e) e1 = e1.tail; + while (e1.tail != e) e1 = e1.tail e1.tail = e.tail } } @@ -243,7 +243,7 @@ object Scopes { final def unlink(sym: Symbol)(implicit ctx: Context): Unit = { var e = lookupEntry(sym.name) while (e ne null) { - if (e.sym == sym) unlink(e); + if (e.sym == sym) unlink(e) e = lookupNextEntry(e) } } 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..bebad60cc 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 } @@ -120,7 +120,7 @@ class SymbolLoaders { */ def binaryOnly(owner: Symbol, name: String)(implicit ctx: Context): Boolean = name == "package" && - (owner.fullName == "scala" || owner.fullName == "scala.reflect") + (owner.fullName.toString == "scala" || owner.fullName.toString == "scala.reflect") /** Initialize toplevel class and module symbols in `owner` from class path representation `classRep` */ 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/TyperState.scala b/src/dotty/tools/dotc/core/TyperState.scala index e0c7481c8..6e17767d2 100644 --- a/src/dotty/tools/dotc/core/TyperState.scala +++ b/src/dotty/tools/dotc/core/TyperState.scala @@ -31,7 +31,7 @@ class TyperState(val reporter: Reporter) extends DotClass with Showable { } /** A fresh typer state with the same constraint as this one. - * @param isCommittable The constraint can be committed to an exclosing context. + * @param isCommittable The constraint can be committed to an enclosing context. */ def fresh(isCommittable: Boolean): TyperState = this diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 4d26a6735..f9c8aad5c 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/core/pickling/PickleBuffer.scala b/src/dotty/tools/dotc/core/pickling/PickleBuffer.scala index 72007758c..2bedcab92 100644 --- a/src/dotty/tools/dotc/core/pickling/PickleBuffer.scala +++ b/src/dotty/tools/dotc/core/pickling/PickleBuffer.scala @@ -110,7 +110,7 @@ class PickleBuffer(data: Array[Byte], from: Int, to: Int) { do { b = readByte() x = (x << 7) + (b & 0x7f) - } while ((b & 0x80) != 0L); + } while ((b & 0x80) != 0L) x } @@ -158,7 +158,7 @@ class PickleBuffer(data: Array[Byte], from: Int, to: Int) { * @return ... */ def until[T](end: Int, op: () => T): List[T] = - if (readIndex == end) List() else op() :: until(end, op); + if (readIndex == end) List() else op() :: until(end, op) /** Perform operation <code>op</code> the number of * times specified. Concatenate the results into a list. diff --git a/src/dotty/tools/dotc/printing/PlainPrinter.scala b/src/dotty/tools/dotc/printing/PlainPrinter.scala index 84936fbac..e5f85d11b 100644 --- a/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -23,11 +23,11 @@ class PlainPrinter(_ctx: Context) extends Printer { ctx.toTextRecursions -= 1 } else { - recursionLimitExceeeded() + recursionLimitExceeded() "..." } - protected def recursionLimitExceeeded() = { + protected def recursionLimitExceeded() = { ctx.warning("Exceeded recursion depth attempting to print type.") (new Throwable).printStackTrace } diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala index cb0780ae3..eb5d8bdb6 100644 --- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -13,7 +13,7 @@ import scala.annotation.switch class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { - override protected def recursionLimitExceeeded() = {} + override protected def recursionLimitExceeded() = {} protected val PrintableFlags = (ModifierFlags | Label | Module).toCommonFlags diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 4d7bc8976..ce3198c64 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -213,7 +213,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) } } diff --git a/src/dotty/tools/dotc/util/HashSet.scala b/src/dotty/tools/dotc/util/HashSet.scala index 3c8ffa251..1c132378b 100644 --- a/src/dotty/tools/dotc/util/HashSet.scala +++ b/src/dotty/tools/dotc/util/HashSet.scala @@ -1,6 +1,6 @@ package dotty.tools.dotc.util -/** A hash set that allows some priviliged protected access to its internals +/** A hash set that allows some privileged protected access to its internals */ class HashSet[T >: Null <: AnyRef](initialCapacity: Int, loadFactor: Float = 0.25f) extends Set[T] with scala.collection.generic.Clearable { private var used: Int = _ diff --git a/src/dotty/tools/dotc/util/NameTransformer.scala b/src/dotty/tools/dotc/util/NameTransformer.scala index ecb480549..2c3520236 100644 --- a/src/dotty/tools/dotc/util/NameTransformer.scala +++ b/src/dotty/tools/dotc/util/NameTransformer.scala @@ -99,7 +99,7 @@ object NameTransformer { def decode(name0: String): String = { //System.out.println("decode: " + name);//DEBUG val name = if (name0.endsWith("<init>")) name0.substring(0, name0.length() - ("<init>").length()) + "this" - else name0; + else name0 var buf: StringBuilder = null val len = name.length() var i = 0 diff --git a/src/dotty/tools/dotc/util/Positions.scala b/src/dotty/tools/dotc/util/Positions.scala index 293bb4a4c..46e4f4ee7 100644 --- a/src/dotty/tools/dotc/util/Positions.scala +++ b/src/dotty/tools/dotc/util/Positions.scala @@ -17,7 +17,7 @@ object Positions { /** A position indicates a range between a start offset and an end offset. * Positions can be synthetic or source-derived. A source-derived position - * has in addition a pointlies somewhere between start and end. The point + * has in addition a point lies somewhere between start and end. The point * is roughly where the ^ would go if an error was diagnosed at that position. * All quantities are encoded opaquely in a Long. */ diff --git a/src/dotty/tools/dotc/util/ShowPickled.scala b/src/dotty/tools/dotc/util/ShowPickled.scala index 1a9da23d5..4278f2ec3 100644 --- a/src/dotty/tools/dotc/util/ShowPickled.scala +++ b/src/dotty/tools/dotc/util/ShowPickled.scala @@ -239,7 +239,7 @@ object ShowPickled { case SYMANNOT => printSymbolRef(); printTypeRef(); buf.until(end, printAnnotArgRef) case ANNOTATEDtpe => - printTypeRef(); buf.until(end, printAnnotInfoRef); + printTypeRef(); buf.until(end, printAnnotInfoRef) case ANNOTINFO => printTypeRef(); buf.until(end, printAnnotArgRef) case ANNOTARGARRAY => |