Skip to content

Commit e011862

Browse files
Merge pull request #3926 from dotty-staging/cleanup-tests
Cleanup tests
2 parents d2d7d99 + 8547e85 commit e011862

File tree

2,218 files changed

+427
-1083
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,218 files changed

+427
-1083
lines changed

compiler/src/dotty/tools/dotc/core/CheckRealizable.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ object CheckRealizable {
4040
extends Realizability(i" has conflicting base types $base1 and $base2")
4141

4242
class HasProblemField(fld: SingleDenotation, problem: Realizability)(implicit ctx: Context)
43-
extends Realizability(i" has a member $fld which is not a legal path\n since ${fld.symbol.name}: ${fld.info}${problem.msg}")
43+
extends Realizability(i" has a member $fld which is not a legal path\nsince ${fld.symbol.name}: ${fld.info}${problem.msg}")
4444

4545
class ProblemInUnderlying(tp: Type, problem: Realizability)(implicit ctx: Context)
4646
extends Realizability(i"s underlying type ${tp}${problem.msg}") {

compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ trait ConstraintHandling {
234234
typr.println(s"approx ${param.show}, from below = $fromBelow, bound = ${bound.show}, inst = ${inst.show}")
235235
inst
236236
case inst =>
237-
assert(inst.exists, i"param = $param\n constraint = $constraint")
237+
assert(inst.exists, i"param = $param\nconstraint = $constraint")
238238
inst
239239
}
240240
}

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ trait SymDenotations { this: Context =>
8282
}
8383
denot match {
8484
case denot: SymDenotation =>
85-
def explainSym(msg: String) = explain(s"$msg\n defined = ${denot.definedPeriodsString}")
85+
def explainSym(msg: String) = explain(s"$msg\ndefined = ${denot.definedPeriodsString}")
8686
if (denot.is(ValidForever) || denot.isRefinementClass) true
8787
else {
8888
implicit val ctx = this

compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ abstract class SymbolLoader extends LazyType {
311311
val msg = ex.getMessage()
312312
ctx.error(
313313
if (msg eq null) "i/o error while loading " + root.name
314-
else "error while loading " + root.name + ",\n " + msg)
314+
else "error while loading " + root.name + ",\n" + msg)
315315
}
316316
try {
317317
val start = currentTime

compiler/src/dotty/tools/dotc/transform/LazyVals.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class LazyVals extends MiniPhase with IdentityDenotTransformer {
160160
ref(initSymbol).ensureApplied).ensureConforms(tpe)
161161

162162
val methodTree = DefDef(x.symbol.asTerm, methodBody)
163-
ctx.debuglog(s"found a lazy val ${x.show},\n rewrote with ${holderTree.show}")
163+
ctx.debuglog(s"found a lazy val ${x.show},\nrewrote with ${holderTree.show}")
164164
Thicket(holderTree, initTree, methodTree)
165165
}
166166

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ object Applications {
9494
def fail = {
9595
val addendum =
9696
if (ctx.scala2Mode && unapplyName == nme.unapplySeq)
97-
"\n You might want to try to rewrite the extractor to use `unapply` instead."
97+
"\nYou might want to try to rewrite the extractor to use `unapply` instead."
9898
ctx.error(em"$unapplyResult is not a valid result type of an $unapplyName method of an extractor$addendum", pos)
9999
Nil
100100
}
@@ -785,7 +785,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
785785

786786
/** Overridden in ReTyper to handle primitive operations that can be generated after erasure */
787787
protected def handleUnexpectedFunType(tree: untpd.Apply, fun: Tree)(implicit ctx: Context): Tree =
788-
throw new Error(i"unexpected type.\n fun = $fun,\n methPart(fun) = ${methPart(fun)},\n methPart(fun).tpe = ${methPart(fun).tpe},\n tpe = ${fun.tpe}")
788+
throw new Error(i"unexpected type.\n fun = $fun,\n methPart(fun) = ${methPart(fun)},\n methPart(fun).tpe = ${methPart(fun).tpe},\n tpe = ${fun.tpe}")
789789

790790
def typedNamedArgs(args: List[untpd.Tree])(implicit ctx: Context) =
791791
for (arg @ NamedArg(id, argtpt) <- args) yield {
@@ -971,7 +971,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
971971
args.init :+ argSeq
972972
case _ =>
973973
val (regularArgs, varArgs) = args.splitAt(argTypes.length - 1)
974-
regularArgs :+ untpd.SeqLiteral(varArgs, untpd.TypeTree())
974+
regularArgs :+ untpd.SeqLiteral(varArgs, untpd.TypeTree()).withPos(tree.pos)
975975
}
976976
else if (argTypes.lengthCompare(1) == 0 && args.lengthCompare(1) > 0 && ctx.canAutoTuple)
977977
untpd.Tuple(args) :: Nil

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ object Checking {
147147
def checkRealizable(tp: Type, pos: Position)(implicit ctx: Context): Unit = {
148148
val rstatus = realizability(tp)
149149
if (rstatus ne Realizable)
150-
ctx.errorOrMigrationWarning(em"$tp is not a legal path\n since it${rstatus.msg}", pos)
150+
ctx.errorOrMigrationWarning(em"$tp is not a legal path\nsince it${rstatus.msg}", pos)
151151
}
152152

153153
/** A type map which checks that the only cycles in a type are F-bounds
@@ -434,7 +434,7 @@ object Checking {
434434
var tp1 =
435435
if (isLeaked(tp.symbol)) {
436436
errors =
437-
(() => em"non-private $sym refers to private ${tp.symbol}\n in its type signature ${sym.info}") :: errors
437+
(() => em"non-private $sym refers to private ${tp.symbol}\nin its type signature ${sym.info}") :: errors
438438
tp
439439
}
440440
else mapOver(tp)
@@ -623,7 +623,7 @@ trait Checking {
623623
def ofType = if (decl.isType) "" else em": ${other.info}"
624624
def explanation =
625625
if (!decl.isRealMethod) ""
626-
else "\n (the definitions have matching type signatures)"
626+
else "\n(the definitions have matching type signatures)"
627627
ctx.error(em"$decl is already defined as $other$ofType$explanation", decl.pos)
628628
}
629629
if (decl is Synthetic) doubleDefError(other, decl)

compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ object ErrorReporting {
120120
val found1 = dropJavaMethod(found)
121121
val expected1 = dropJavaMethod(expected)
122122
if ((found1 eq found) != (expected eq expected1) && (found1 <:< expected1))
123-
"\n (Note that Scala's and Java's representation of this type differs)"
123+
"\n(Note that Scala's and Java's representation of this type differs)"
124124
else if (found.topType != expected.topType)
125-
"\n (Note that the types are in different universes, see Phantom types)"
125+
"\n(Note that the types are in different universes, see Phantom types)"
126126
else if (ctx.settings.explainTypes.value)
127127
"\n" + ctx.typerState.show + "\n" + TypeComparer.explained((found <:< expected)(_))
128128
else

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ object Implicits {
336336
em"both ${err.refStr(alt1.ref)} and ${err.refStr(alt2.ref)} $qualify"
337337
override def whyNoConversion(implicit ctx: Context) =
338338
"\nNote that implicit conversions cannot be applied because they are ambiguous;" +
339-
"\n " + explanation
339+
"\n" + explanation
340340
}
341341

342342
class MismatchedImplicit(ref: TermRef,
@@ -788,7 +788,7 @@ trait Implicits { self: Typer =>
788788
inferImplicit(pt, argument, pos)(ctx.addMode(Mode.OldOverloadingResolution)) match {
789789
case altResult: SearchSuccess =>
790790
ctx.migrationWarning(
791-
s"According to new implicit resolution rules, this will be ambiguous:\n ${result.reason.explanation}",
791+
s"According to new implicit resolution rules, this will be ambiguous:\n${result.reason.explanation}",
792792
pos)
793793
altResult
794794
case _ =>

compiler/src/dotty/tools/dotc/typer/RefChecks.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ object RefChecks {
177177
.filter(_.name != member.name)
178178
.map(_.show).distinct
179179
if (others1.isEmpty) ""
180-
else i";\n other members with override errors are:: $others1%, %"
180+
else i";\nother members with override errors are:: $others1%, %"
181181
}
182182
ctx.error(msg + othersMsg, clazz.pos)
183183
}
@@ -216,14 +216,14 @@ object RefChecks {
216216
(other.owner isSubClass member.owner) && other.is(Deferred) && !member.is(Deferred)
217217
val addendum =
218218
if (isConcreteOverAbstract)
219-
";\n (Note that %s is abstract,\n and is therefore overridden by concrete %s)".format(
219+
";\n (Note that %s is abstract,\n and is therefore overridden by concrete %s)".format(
220220
infoStringWithLocation(other),
221221
infoStringWithLocation(member))
222222
else if (ctx.settings.Ydebug.value)
223223
err.typeMismatchMsg(memberTp(self), otherTp(self))
224224
else ""
225225

226-
"error overriding %s;\n %s %s%s".format(
226+
"error overriding %s;\n %s %s%s".format(
227227
infoStringWithLocation(other), infoString(member), msg, addendum)
228228
}
229229

compiler/test/dotc/tests.scala

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class tests extends CompilerTest {
2222
// tests that match regex '(pos|dotc|run|java|compileStdLib)\.*' would be
2323
// executed as benchmarks.
2424

25-
val defaultOutputDir = "../out/"
25+
val defaultOutputDir = "out/"
2626

2727
val noCheckOptions = List(
2828
// "-verbose",
@@ -85,7 +85,7 @@ class tests extends CompilerTest {
8585
val explicitUTF8 = List("-encoding", "UTF8")
8686
val explicitUTF16 = List("-encoding", "UTF16")
8787

88-
val testsDir = "../tests/"
88+
val testsDir = "tests/"
8989
val posDir = testsDir + "pos/"
9090
val posSpecialDir = testsDir + "pos-special/"
9191
val posScala2Dir = testsDir + "pos-scala2/"
@@ -94,7 +94,7 @@ class tests extends CompilerTest {
9494
val newDir = testsDir + "new/"
9595
val javaDir = testsDir + "pos-java-interop/"
9696

97-
val sourceDir = "./src/"
97+
val sourceDir = "compiler/src/"
9898
val dottyDir = sourceDir + "dotty/"
9999
val toolsDir = dottyDir + "tools/"
100100
val backendDir = toolsDir + "backend/"
@@ -103,7 +103,7 @@ class tests extends CompilerTest {
103103
val parsingDir = dotcDir + "parsing/"
104104
val dottyReplDir = dotcDir + "repl/"
105105
val typerDir = dotcDir + "typer/"
106-
val libDir = "../library/src/"
106+
val libDir = "library/src/"
107107

108108
def dottyBootedLib = compileDir(libDir, ".", List("-deep", "-Ycheck-reentrant", "-strict"))(allowDeepSubtypes) // note the -deep argument
109109
def dottyDependsOnBootedLib = compileDir(dottyDir, ".", List("-deep", "-Ycheck-reentrant"))(allowDeepSubtypes) // note the -deep argument
@@ -187,13 +187,14 @@ class tests extends CompilerTest {
187187
@Test def negVarargsT1625 = compileFiles(negDir + "varargsInMethodsT1625/")
188188

189189
val negCustomArgs = testsDir + "neg-custom-args/"
190+
val negAllowDoubleBindings = negCustomArgs + "allow-double-bindings/"
190191

191-
@Test def neg_typers() = compileFile(negCustomArgs, "typers")(allowDoubleBindings)
192+
@Test def neg_typers() = compileFile(negAllowDoubleBindings, "typers")(allowDoubleBindings)
192193
@Test def neg_overrideClass = compileFile(negCustomArgs, "overrideClass", scala2mode)
193194
@Test def neg_autoTupling = compileFile(negCustomArgs, "autoTuplingTest", args = "-language:noAutoTupling" :: Nil)
194195
@Test def neg_i1050 = compileFile(negCustomArgs, "i1050", List("-strict"))
195-
@Test def neg_i1240 = compileFile(negCustomArgs, "i1240")(allowDoubleBindings)
196-
@Test def neg_i2002 = compileFile(negCustomArgs, "i2002")(allowDoubleBindings)
196+
@Test def neg_i1240 = compileFile(negAllowDoubleBindings, "i1240")(allowDoubleBindings)
197+
@Test def neg_i2002 = compileFile(negAllowDoubleBindings, "i2002")(allowDoubleBindings)
197198
@Test def neg_valueclasses_doubledefs = compileFile(negCustomArgs, "valueclasses-doubledefs")(allowDoubleBindings)
198199
@Test def neg_valueclasses_pavlov = compileFile(negCustomArgs, "valueclasses-pavlov")(allowDoubleBindings)
199200
@Test def neg_trailingUnderscore = compileFile(negCustomArgs, "trailingUnderscore", args = "-strict" :: Nil)
@@ -218,19 +219,19 @@ class tests extends CompilerTest {
218219
compileList("compileStdLib", stdlibFiles, "-migration" :: "-Yno-inline" :: scala2mode)
219220

220221
@Test def compileMixed = compileLine(
221-
"""../tests/pos/B.scala
222-
|../scala2-library/src/library/scala/collection/immutable/Seq.scala
223-
|../scala2-library/src/library/scala/collection/parallel/ParSeq.scala
224-
|../scala2-library/src/library/scala/package.scala
225-
|../scala2-library/src/library/scala/collection/GenSeqLike.scala
226-
|../scala2-library/src/library/scala/collection/SeqLike.scala
227-
|../scala2-library/src/library/scala/collection/generic/GenSeqFactory.scala""".stripMargin)(scala2mode ++ defaultOptions)
228-
@Test def compileIndexedSeq = compileLine("../scala2-library/src/library/scala/collection/immutable/IndexedSeq.scala")
229-
@Test def compileParSetLike = compileLine("../scala2-library/src/library/scala/collection/parallel/mutable/ParSetLike.scala")
222+
"""tests/pos/B.scala
223+
|scala2-library/src/library/scala/collection/immutable/Seq.scala
224+
|scala2-library/src/library/scala/collection/parallel/ParSeq.scala
225+
|scala2-library/src/library/scala/package.scala
226+
|scala2-library/src/library/scala/collection/GenSeqLike.scala
227+
|scala2-library/src/library/scala/collection/SeqLike.scala
228+
|scala2-library/src/library/scala/collection/generic/GenSeqFactory.scala""".stripMargin)(scala2mode ++ defaultOptions)
229+
@Test def compileIndexedSeq = compileLine("scala2-library/src/library/scala/collection/immutable/IndexedSeq.scala")
230+
@Test def compileParSetLike = compileLine("scala2-library/src/library/scala/collection/parallel/mutable/ParSetLike.scala")
230231
@Test def compileParSetSubset = compileLine(
231-
"""../scala2-library/src/library/scala/collection/parallel/mutable/ParSetLike.scala
232-
|../scala2-library/src/library/scala/collection/parallel/mutable/ParSet.scala
233-
|../scala2-library/src/library/scala/collection/mutable/SetLike.scala""".stripMargin)(scala2mode ++ defaultOptions)
232+
"""scala2-library/src/library/scala/collection/parallel/mutable/ParSetLike.scala
233+
|scala2-library/src/library/scala/collection/parallel/mutable/ParSet.scala
234+
|scala2-library/src/library/scala/collection/mutable/SetLike.scala""".stripMargin)(scala2mode ++ defaultOptions)
234235

235236
@Test def dottyBooted = {
236237
dottyBootedLib

compiler/test/dotty/tools/StdLibSources.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ object StdLibSources {
1010
/* For debug only */
1111
private val useExplicitWhiteList = false
1212

13-
private final val stdLibPath = "../scala2-library/src/library/"
13+
private final val stdLibPath = "scala2-library/src/library/"
1414

15-
def blacklistFile: String = "../compiler/test/dotc/scala-collections.blacklist"
16-
private def whitelistFile: String = "../compiler/test/dotc/scala-collections.whitelist"
15+
def blacklistFile: String = "compiler/test/dotc/scala-collections.blacklist"
16+
private def whitelistFile: String = "compiler/test/dotc/scala-collections.whitelist"
1717

1818
def whitelisted: List[String] = {
1919
lazy val whitelistBasedOnBlacklist = all.diff(blacklisted)

0 commit comments

Comments
 (0)