Skip to content

Commit a3328cb

Browse files
authored
Merge branch 'master' into fix-strawman-compile
2 parents 1ebff50 + 9567fc4 commit a3328cb

File tree

594 files changed

+1446
-1530
lines changed

Some content is hidden

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

594 files changed

+1446
-1530
lines changed

.drone.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ matrix:
4242
CI_PUBLISH: false
4343
- CI_TEST: test
4444
CI_PUBLISH: false
45-
- CI_TEST: ;publishLocal ;dotty-bootstrapped/test
45+
- CI_TEST: ;dotty-sbt-bridge/publishLocal ;dotty-bootstrapped/test
4646
CI_PUBLISH: false

.drone.yml.sig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
eyJhbGciOiJIUzI1NiJ9.IyBBZnRlciB1cGRhdGluZyB0aGlzIGZpbGUsIHlvdSBuZWVkIHRvIHJlLXNpZ24gaXQ6CiMKIyAtIEluc3RhbGwgW2Ryb25lLWNsaV0oaHR0cDovL3JlYWRtZS5kcm9uZS5pby91c2FnZS9nZXR0aW5nLXN0YXJ0ZWQtY2xpLykKIyAtIENvcHkgeW91ciB0b2tlbiBmcm9tICBodHRwOi8vZG90dHktY2kuZXBmbC5jaC9hY2NvdW50IChDbGljayBTSE9XIFRPS0VOKQojIC0gKGV4cG9ydCBEUk9ORV9UT0tFTj15b3VyLXRva2VuOyBleHBvcnQgRFJPTkVfU0VSVkVSPWh0dHA6Ly9kb3R0eS1jaS5lcGZsLmNoOyBkcm9uZSBzaWduIGxhbXBlcGZsL2RvdHR5KQojCiMgUGxlYXNlIG5vdGUgdGhhdCB0aGUgc2lnbmluZyBjYW4gb25seSBiZSBkb25lIGJ5IGNvbGxhYm9yYXRvcnMuCgpwaXBlbGluZToKICB0ZXN0OgogICAgaW1hZ2U6IGxhbXBlcGZsL2RvdHR5OjI0LTA0LTIwMTcKICAgIHB1bGw6IHRydWUKICAgIGNvbW1h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bmUubWVtPTQwOTZtICIke0NJX1RFU1R9IgogICAgd2hlbjoKICAgICAgYnJhbmNoOgogICAgICAgIGV4Y2x1ZGU6IGdoLXBhZ2VzCgogIGRvY3VtZW50YXRpb246CiAgICBpbWFnZTogbGFtcGVwZmwvZG90dHk6MjQtMDQtMjAxNwogICAgcHVsbDogdHJ1ZQogICAgY29tbWFuZHM6CiAgICAgIC0gLi9wcm9qZWN0L3NjcmlwdHMvZ2VuRG9jcyAiJHtDSV9QVUJMSVNIfSIgJEJPVF9QQVNTCiAgICB3aGVuOgogICAgICBicmFuY2g6IG1hc3RlcgoKICBzbGFjazoKICAgIGltYWdlOiBwbHVnaW5zL3NsYWNrCiAgICBjaGFubmVsOiBkb3R0eQogICAgd2hlbjoKICAgICAgYnJhbmNoOiBtYXN0ZXIKICAgICAgc3RhdHVzOiBjaGFuZ2VkCgptYXRyaXg6CiAgaW5jbHVkZToKICAgIC0gQ0lfVEVTVDogZG90dHktYmluLXRlc3RzL3Rlc3QKICAgICAgQ0lfUFVCTElTSDogdHJ1ZQogICAgLSBDSV9URVNUOiBsZWdhY3lUZXN0cwogICAgICBDSV9QVUJMSVNIOiBmYWxzZQogICAgLSBDSV9URVNUOiB0ZXN0CiAgICAgIENJX1BVQkxJU0g6IGZhbHNlCiAgICAtIENJX1RFU1Q6IDtkb3R0eS1zYnQtYnJpZGdlL3B1Ymxpc2hMb2NhbCA7ZG90dHktYm9vdHN0cmFwcGVkL3Rlc3QKICAgICAgQ0lfUFVCTElTSDogZmFsc2UK.oGDqInSbkSMvrUuLat_UdKNbHNTTvv0yK7WGdsnOdMc

build.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ val `dotty-bin-tests` = Build.`dotty-bin-tests`
1010
val `dotty-library` = Build.`dotty-library`
1111
val `dotty-library-bootstrapped` = Build.`dotty-library-bootstrapped`
1212
val `dotty-sbt-bridge` = Build.`dotty-sbt-bridge`
13+
val `dotty-sbt-bridge-bootstrapped` = Build.`dotty-sbt-bridge-bootstrapped`
14+
val `dotty-sbt-scripted-tests` = Build.`dotty-sbt-scripted-tests`
1315
val sjsSandbox = Build.sjsSandbox
1416
val `dotty-bench` = Build.`dotty-bench`
1517
val `scala-library` = Build.`scala-library`

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class ScalaSettings extends Settings.SettingGroup {
5858
val mainClass = StringSetting("-Xmain-class", "path", "Class for manifest's Main-Class entry (only useful with -d <jar>)", "")
5959
val XnoValueClasses = BooleanSetting("-Xno-value-classes", "Do not use value classes. Helps debugging.")
6060
val XreplLineWidth = IntSetting("-Xrepl-line-width", "Maximial number of columns per line for REPL output", 390)
61+
val XfatalWarnings = BooleanSetting("-Xfatal-warnings", "Fail the compilation if there are any warnings.")
6162

6263
/** -Y "Private" settings */
6364
val overrideVars = BooleanSetting("-Yoverride-vars", "Allow vars to be overridden.")

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,7 +2248,7 @@ object Types {
22482248

22492249
def derivedAndType(tp1: Type, tp2: Type)(implicit ctx: Context): Type =
22502250
if ((tp1 eq this.tp1) && (tp2 eq this.tp2)) this
2251-
else AndType.make(tp1, tp2)
2251+
else AndType.make(tp1, tp2, checkValid = true)
22522252

22532253
def derived_& (tp1: Type, tp2: Type)(implicit ctx: Context): Type =
22542254
if ((tp1 eq this.tp1) && (tp2 eq this.tp2)) this
@@ -2263,21 +2263,26 @@ object Types {
22632263
final class CachedAndType(tp1: Type, tp2: Type) extends AndType(tp1, tp2)
22642264

22652265
object AndType {
2266-
def apply(tp1: Type, tp2: Type)(implicit ctx: Context) = {
2266+
def apply(tp1: Type, tp2: Type)(implicit ctx: Context): AndType = {
22672267
assert(tp1.isValueType && tp2.isValueType, i"$tp1 & $tp2 / " + s"$tp1 & $tp2")
22682268
unchecked(tp1, tp2)
22692269
}
2270-
def unchecked(tp1: Type, tp2: Type)(implicit ctx: Context) = {
2270+
2271+
def unchecked(tp1: Type, tp2: Type)(implicit ctx: Context): AndType = {
22712272
assertUnerased()
22722273
unique(new CachedAndType(tp1, tp2))
22732274
}
2274-
def make(tp1: Type, tp2: Type)(implicit ctx: Context): Type =
2275+
2276+
/** Make an AndType using `op` unless clearly unnecessary (i.e. without
2277+
* going through `&`).
2278+
*/
2279+
def make(tp1: Type, tp2: Type, checkValid: Boolean = false)(implicit ctx: Context): Type =
22752280
if ((tp1 eq tp2) || (tp2 eq defn.AnyType))
22762281
tp1
22772282
else if (tp1 eq defn.AnyType)
22782283
tp2
22792284
else
2280-
apply(tp1, tp2)
2285+
if (checkValid) apply(tp1, tp2) else unchecked(tp1, tp2)
22812286
}
22822287

22832288
abstract case class OrType(tp1: Type, tp2: Type) extends CachedGroundType with AndOrType {
@@ -3023,7 +3028,7 @@ object Types {
30233028
// ----- Skolem types -----------------------------------------------
30243029

30253030
/** A skolem type reference with underlying type `binder`. */
3026-
abstract case class SkolemType(info: Type) extends UncachedProxyType with ValueType with SingletonType {
3031+
case class SkolemType(info: Type) extends UncachedProxyType with ValueType with SingletonType {
30273032
override def underlying(implicit ctx: Context) = info
30283033
def derivedSkolemType(info: Type)(implicit ctx: Context) =
30293034
if (info eq this.info) this else SkolemType(info)
@@ -3041,13 +3046,6 @@ object Types {
30413046
override def toString = s"Skolem($hashCode)"
30423047
}
30433048

3044-
final class CachedSkolemType(info: Type) extends SkolemType(info)
3045-
3046-
object SkolemType {
3047-
def apply(info: Type)(implicit ctx: Context) =
3048-
unique(new CachedSkolemType(info))
3049-
}
3050-
30513049
// ------------ Type variables ----------------------------------------
30523050

30533051
/** In a TypeApply tree, a TypeVar is created for each argument type to be inferred.

compiler/src/dotty/tools/dotc/repl/ammonite/Protocol.scala

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,21 @@ case class TermState(
1515
) extends TermAction
1616

1717
object TermState {
18+
// Using unapply instead exposes a dotty/scalac variation. Because
19+
// `TermState` is a case class, scalac generate an unapply with this exact
20+
// signature, that is used by the `TermInfo` and `TermAction` unapplies.
21+
// With dotty, the generated unapply has type `TermState => TermState`
22+
// instead, `unapply(ti: TermAction)` thus becomes a infinite tail
23+
// recursion. See #2335.
24+
def unapplyWorkaround(ti: TermState): Option[(LazyList[Int], Vector[Char], Int, Ansi.Str)] =
25+
Some((ti.inputs, ti.buffer, ti.cursor, ti.msg))
26+
1827
def unapply(ti: TermInfo): Option[(LazyList[Int], Vector[Char], Int, Ansi.Str)] =
19-
TermState.unapply(ti.ts)
28+
TermState.unapplyWorkaround(ti.ts)
2029

2130
def unapply(ti: TermAction): Option[(LazyList[Int], Vector[Char], Int, Ansi.Str)] =
2231
ti match {
23-
case ts: TermState => TermState.unapply(ts)
32+
case ts: TermState => TermState.unapplyWorkaround(ts)
2433
case _ => None
2534
}
2635
}

compiler/src/dotty/tools/dotc/reporting/Reporter.scala

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,21 @@ trait Reporting { this: Context =>
3737
def echo(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
3838
reporter.report(new Info(msg, pos))
3939

40+
def reportWarning(warning:Warning):Unit =
41+
if(this.settings.XfatalWarnings.value) error(warning.contained, warning.pos)
42+
else reporter.report(warning)
43+
4044
def deprecationWarning(msg: => Message, pos: SourcePosition = NoSourcePosition): Unit =
41-
reporter.report(new DeprecationWarning(msg, pos))
45+
reportWarning(new DeprecationWarning(msg, pos))
4246

4347
def migrationWarning(msg: => Message, pos: SourcePosition = NoSourcePosition): Unit =
44-
reporter.report(new MigrationWarning(msg, pos))
48+
reportWarning(new MigrationWarning(msg, pos))
4549

4650
def uncheckedWarning(msg: => Message, pos: SourcePosition = NoSourcePosition): Unit =
47-
reporter.report(new UncheckedWarning(msg, pos))
51+
reportWarning(new UncheckedWarning(msg, pos))
4852

4953
def featureWarning(msg: => Message, pos: SourcePosition = NoSourcePosition): Unit =
50-
reporter.report(new FeatureWarning(msg, pos))
54+
reportWarning(new FeatureWarning(msg, pos))
5155

5256
def featureWarning(feature: String, featureDescription: String, isScala2Feature: Boolean,
5357
featureUseSite: Symbol, required: Boolean, pos: SourcePosition): Unit = {
@@ -69,17 +73,15 @@ trait Reporting { this: Context =>
6973

7074
val msg = s"$featureDescription $req be enabled\nby making the implicit value $fqname visible.$explain"
7175
if (required) error(msg, pos)
72-
else reporter.report(new FeatureWarning(msg, pos))
76+
else reportWarning(new FeatureWarning(msg, pos))
7377
}
7478

7579
def warning(msg: => Message, pos: SourcePosition = NoSourcePosition): Unit =
76-
reporter.report(new Warning(msg, pos))
80+
reportWarning(new Warning(msg, pos))
7781

7882
def strictWarning(msg: => Message, pos: SourcePosition = NoSourcePosition): Unit =
7983
if (this.settings.strict.value) error(msg, pos)
80-
else reporter.report {
81-
new ExtendMessage(() => msg)(_ + "\n(This would be an error under strict mode)").warning(pos)
82-
}
84+
else reportWarning(new ExtendMessage(() => msg)(_ + "\n(This would be an error under strict mode)").warning(pos))
8385

8486
def error(msg: => Message, pos: SourcePosition = NoSourcePosition): Unit =
8587
reporter.report(new Error(msg, pos))

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,8 @@ object RefChecks {
656656
// If symbol is deprecated, and the point of reference is not enclosed
657657
// in either a deprecated member or a scala bridge method, issue a warning.
658658
if (sym.isDeprecated && !ctx.owner.ownersIterator.exists(_.isDeprecated)) {
659-
ctx.deprecationWarning("%s%s is deprecated%s".format(
660-
sym, sym.showLocated, sym.deprecationMessage map (": " + _) getOrElse "", pos))
659+
ctx.deprecationWarning("%s is deprecated%s".format(
660+
sym.showLocated, sym.deprecationMessage map (": " + _) getOrElse ""), pos)
661661
}
662662
// Similar to deprecation: check if the symbol is marked with @migration
663663
// indicating it has changed semantics between versions.

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ class CompilationTests extends ParallelTesting {
145145
compileFile("../tests/neg/customArgs/noimports.scala", defaultOptions.and("-Yno-imports")) +
146146
compileFile("../tests/neg/customArgs/noimports2.scala", defaultOptions.and("-Yno-imports")) +
147147
compileFile("../tests/neg/customArgs/overloadsOnAbstractTypes.scala", allowDoubleBindings) +
148+
compileFile("../tests/neg/customArgs/xfatalWarnings.scala", defaultOptions.and("-Xfatal-warnings")) +
148149
compileFile("../tests/neg/tailcall/t1672b.scala", defaultOptions) +
149150
compileFile("../tests/neg/tailcall/t3275.scala", defaultOptions) +
150151
compileFile("../tests/neg/tailcall/t6574.scala", defaultOptions) +

0 commit comments

Comments
 (0)