summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-06-15 21:14:14 +0000
committerPaul Phillips <paulp@improving.org>2010-06-15 21:14:14 +0000
commit0c6cbdac433a001f76b1f9afd00f4280d17d1832 (patch)
tree5832b44a587f89cb7d936ae8671333be8881ace0 /src/compiler
parentde7fbb051b280f794cb8d706414191e4d5d08bf9 (diff)
downloadscala-0c6cbdac433a001f76b1f9afd00f4280d17d1832.tar.gz
scala-0c6cbdac433a001f76b1f9afd00f4280d17d1832.tar.bz2
scala-0c6cbdac433a001f76b1f9afd00f4280d17d1832.zip
Disables NotNull checking unless -Ynotnull is g...
Disables NotNull checking unless -Ynotnull is given. Closes #3568, review by odersky.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala1
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala7
2 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index 51b47f87d6..2454d233f4 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -138,6 +138,7 @@ trait ScalaSettings extends AbsScalaSettings with StandardScalaSettings {
val Ycompletion = BooleanSetting ("-Ycompletion-debug", "Trace all tab completion activity.")
val Ypmatnaive = BooleanSetting ("-Ypmat-naive", "Desugar matches as naively as possible..")
val Yjenkins = BooleanSetting ("-Yjenkins-hashCodes", "Use jenkins hash algorithm for case class generated hashCodes.")
+ val Ynotnull = BooleanSetting ("-Ynotnull", "Enable the experimental and incomplete scala.NotNull")
// Warnings
val Ywarndeadcode = BooleanSetting ("-Ywarn-dead-code", "Emit warnings for dead code")
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index c291a391ca..2eca101aab 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -385,9 +385,12 @@ trait Types extends reflect.generic.Types { self: SymbolTable =>
* the empty list for all other types */
def boundSyms: List[Symbol] = List()
- /** Mixin a NotNull trait unless type already has one */
+ /** Mixin a NotNull trait unless type already has one
+ * ...if the option is given, since it is causing typing bugs.
+ */
def notNull: Type =
- if (isNotNull || phase.erasedTypes) this else NotNullType(this)
+ if (!settings.Ynotnull.value || isNotNull || phase.erasedTypes) this
+ else NotNullType(this)
/** Replace formal type parameter symbols with actual type arguments.
*