diff options
author | odersky <odersky@gmail.com> | 2014-12-13 17:52:53 +0100 |
---|---|---|
committer | odersky <odersky@gmail.com> | 2014-12-13 17:52:53 +0100 |
commit | f3d887f079efbe7dbb53abd22bd212eee8e1c67a (patch) | |
tree | 82f0ec11b9d6837f495e60bf345112907053f680 /src | |
parent | 1466e88efacd7247d426974160fd8968f8921b0b (diff) | |
parent | 35ba97ca7ac92761cad1a0be43fbe52d9bcb3c92 (diff) | |
download | dotty-f3d887f079efbe7dbb53abd22bd212eee8e1c67a.tar.gz dotty-f3d887f079efbe7dbb53abd22bd212eee8e1c67a.tar.bz2 dotty-f3d887f079efbe7dbb53abd22bd212eee8e1c67a.zip |
Merge pull request #277 from dotty-staging/change/drop-not-null
Change/drop not null
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/TypeErasure.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/config/ScalaSettings.scala | 1 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Definitions.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 10 |
5 files changed, 10 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/TypeErasure.scala b/src/dotty/tools/dotc/TypeErasure.scala index 162c869b4..39eb7a254 100644 --- a/src/dotty/tools/dotc/TypeErasure.scala +++ b/src/dotty/tools/dotc/TypeErasure.scala @@ -253,7 +253,7 @@ class TypeErasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wild * - otherwise, if T is a type paramter coming from Java, []Object * - otherwise, Object * - For a term ref p.x, the type <noprefix> # x. - * - For a typeref scala.Any, scala.AnyVal, scala.Singleon or scala.NotNull: |java.lang.Object| + * - For a typeref scala.Any, scala.AnyVal or scala.Singleton: |java.lang.Object| * - For a typeref scala.Unit, |scala.runtime.BoxedUnit|. * - For a typeref P.C where C refers to a class, <noprefix> # C. * - For a typeref P.C where C refers to an alias type, the erasure of C's alias. @@ -374,7 +374,7 @@ class TypeErasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wild private def normalizeClass(cls: ClassSymbol)(implicit ctx: Context): ClassSymbol = { if (cls.owner == defn.ScalaPackageClass) { - if (cls == defn.AnyClass || cls == defn.AnyValClass || cls == defn.SingletonClass || cls == defn.NotNullClass) + if (cls == defn.AnyClass || cls == defn.AnyValClass || cls == defn.SingletonClass) return defn.ObjectClass if (cls == defn.UnitClass) return defn.BoxedUnitClass diff --git a/src/dotty/tools/dotc/config/ScalaSettings.scala b/src/dotty/tools/dotc/config/ScalaSettings.scala index 05b936136..9afe96c96 100644 --- a/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -140,7 +140,6 @@ class ScalaSettings extends Settings.SettingGroup { val Ybuilderdebug = ChoiceSetting("-Ybuilder-debug", "manager", "Compile using the specified build manager.", List("none", "refined", "simple"), "none") val Yreifycopypaste = BooleanSetting("-Yreify-copypaste", "Dump the reified trees in copypasteable representation.") val Yreplsync = BooleanSetting("-Yrepl-sync", "Do not use asynchronous code for repl startup") - val Ynotnull = BooleanSetting("-Ynotnull", "Enable (experimental and incomplete) scala.NotNull.") val YmethodInfer = BooleanSetting("-Yinfer-argument-types", "Infer types for arguments of overriden methods.") val etaExpandKeepsStar = BooleanSetting("-Yeta-expand-keeps-star", "Eta-expand varargs methods to T* rather than Seq[T]. This is a temporary option to ease transition.") val Yinvalidate = StringSetting("-Yinvalidate", "classpath-entry", "Invalidate classpath entry before run", "") diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala index 311b27717..19d175088 100644 --- a/src/dotty/tools/dotc/core/Definitions.scala +++ b/src/dotty/tools/dotc/core/Definitions.scala @@ -177,8 +177,6 @@ class Definitions { RootClass, nme.dummyApply, 1, pt => MethodType(List(FunctionType(Nil, PolyParam(pt, 0))), PolyParam(pt, 0))) - lazy val NotNullClass = ctx.requiredClass("scala.NotNull") - lazy val NothingClass: ClassSymbol = newCompleteClassSymbol( ScalaPackageClass, tpnme.Nothing, AbstractFinal, List(AnyClass.typeRef)) lazy val NullClass: ClassSymbol = newCompleteClassSymbol( @@ -348,7 +346,6 @@ class Definitions { def AnyValType: Type = AnyValClass.typeRef def ObjectType: Type = ObjectClass.typeRef def AnyRefType: Type = AnyRefAlias.typeRef - def NotNullType: Type = NotNullClass.typeRef def NothingType: Type = NothingClass.typeRef def NullType: Type = NullClass.typeRef def SeqType: Type = SeqClass.typeRef diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index 592a4ff45..841d94b74 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -466,7 +466,7 @@ object SymDenotations { /** Is this symbol a class references to which that are supertypes of null? */ final def isNullableClass(implicit ctx: Context): Boolean = - isNonValueClass && !(this is ModuleClass) // todo: check that class does not derive from NotNull? + isNonValueClass && !(this is ModuleClass) /** Is this definition accessible as a member of tree with type `pre`? * @param pre The type of the tree from which the selection is made diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala index 2140f9bfe..a7f50c369 100644 --- a/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/src/dotty/tools/dotc/core/TypeComparer.scala @@ -648,8 +648,7 @@ class TypeComparer(initctx: Context) extends DotClass { if (cls2.isClass) { val base = tp1.baseTypeRef(cls2) if (base.exists && (base ne tp1)) return isSubType(base, tp2) - if ( cls2 == defn.SingletonClass && tp1.isStable - || cls2 == defn.NotNullClass && tp1.isNotNull) return true + if (cls2 == defn.SingletonClass && tp1.isStable) return true } tryRebase3rd } @@ -777,8 +776,13 @@ class TypeComparer(initctx: Context) extends DotClass { case TypeBounds(lo1, hi1) => isSubType(hi1, tp2) case _ => + def isNullable(tp: Type): Boolean = tp.dealias match { + case tp: TypeRef => tp.symbol.isNullableClass + case RefinedType(parent, _) => isNullable(parent) + case _ => false + } (tp1.symbol eq NothingClass) && tp2.isInstanceOf[ValueType] || - (tp1.symbol eq NullClass) && tp2.dealias.typeSymbol.isNullableClass + (tp1.symbol eq NullClass) && isNullable(tp2) } case tp1: SingletonType => isNewSubType(tp1.underlying.widenExpr, tp2) || { |