aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/config/ScalaSettings.scala1
-rw-r--r--src/dotty/tools/dotc/reporting/Reporter.scala4
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala2
-rw-r--r--tests/pos/variances-local.scala (renamed from tests/pending/pos/variances-local.scala)0
-rw-r--r--tests/pos/viewtest1.scala (renamed from tests/pending/pos/viewtest1.scala)0
5 files changed, 6 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/config/ScalaSettings.scala b/src/dotty/tools/dotc/config/ScalaSettings.scala
index 281a4b6c7..51fccd8a8 100644
--- a/src/dotty/tools/dotc/config/ScalaSettings.scala
+++ b/src/dotty/tools/dotc/config/ScalaSettings.scala
@@ -39,6 +39,7 @@ class ScalaSettings extends Settings.SettingGroup {
val defines = PrefixSetting("-Dproperty=value", "-D", "Pass -Dproperty=value directly to the runtime system.")
val toolcp = PathSetting("-toolcp", "Add to the runner classpath.", "")
val nobootcp = BooleanSetting("-nobootcp", "Do not use the boot classpath for the scala jars.")
+ val strict = BooleanSetting("-strict", "Use strict type rules, which means some formerly legal code does not typecheck anymore.")
val argfiles = BooleanSetting("@<file>", "A text file containing compiler arguments (options and source files)")
val classpath = PathSetting("-classpath", "Specify where to find user class files.", defaultClasspath) withAbbreviation "-cp"
diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala
index 41f007e66..5bb660cdb 100644
--- a/src/dotty/tools/dotc/reporting/Reporter.scala
+++ b/src/dotty/tools/dotc/reporting/Reporter.scala
@@ -89,6 +89,10 @@ trait Reporting { this: Context =>
def warning(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
reporter.report(new Warning(msg, pos))
+
+ def strictWarning(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
+ if (this.settings.strict.value) error(msg, pos)
+ else warning(msg + "\n(This would be an error under strict mode)", pos)
def error(msg: => String, pos: SourcePosition = NoSourcePosition): Unit = {
// println("*** ERROR: " + msg) // !!! DEBUG
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index c012e8837..47dfe157d 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -716,7 +716,7 @@ trait Applications extends Compatibility { self: Typer =>
if (ctx.settings.verbose.value) ctx.warning(msg, tree.pos)
} else {
unapp.println(s" ${unapplyFn.symbol.owner} ${unapplyFn.symbol.owner is Scala2x}")
- ctx.error(msg, tree.pos)
+ ctx.strictWarning(msg, tree.pos)
}
case _ =>
}
diff --git a/tests/pending/pos/variances-local.scala b/tests/pos/variances-local.scala
index 35e395095..35e395095 100644
--- a/tests/pending/pos/variances-local.scala
+++ b/tests/pos/variances-local.scala
diff --git a/tests/pending/pos/viewtest1.scala b/tests/pos/viewtest1.scala
index 38945ad2f..38945ad2f 100644
--- a/tests/pending/pos/viewtest1.scala
+++ b/tests/pos/viewtest1.scala