summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2011-10-20 22:28:44 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2011-10-20 22:28:44 +0000
commit3921e5be742ff9523825037056e82b7b82db5932 (patch)
tree046e7f6ff585ba66c80825132974f52f5a3638e0 /src/compiler
parent24eb4c5bb5b3ed0e6bb4ede3e68876cdbe7d18fc (diff)
downloadscala-3921e5be742ff9523825037056e82b7b82db5932.tar.gz
scala-3921e5be742ff9523825037056e82b7b82db5932.tar.bz2
scala-3921e5be742ff9523825037056e82b7b82db5932.zip
dependent methods types are now always enabled
for now, left the old if(settings.YdepMethTpes.value) guards in comments removed *.flags containing -Ydependent-method-types also updated one check file with one fewer error no review
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/reflect/internal/Types.scala6
-rw-r--r--src/compiler/scala/reflect/internal/settings/MutableSettings.scala1
-rw-r--r--src/compiler/scala/reflect/internal/transform/Erasure.scala13
-rw-r--r--src/compiler/scala/reflect/runtime/Settings.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala1
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala5
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala10
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala8
8 files changed, 16 insertions, 30 deletions
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala
index 7b77c8addf..1f238d666a 100644
--- a/src/compiler/scala/reflect/internal/Types.scala
+++ b/src/compiler/scala/reflect/internal/Types.scala
@@ -400,7 +400,7 @@ trait Types extends api.Types { self: SymbolTable =>
def resultType(actuals: List[Type]) = this
/** Only used for dependent method types. */
- def resultApprox: Type = if (settings.YdepMethTpes.value) ApproximateDependentMap(resultType) else resultType
+ def resultApprox: Type = ApproximateDependentMap(resultType) // if (!settings.YdepMethTpes.value) resultType else
/** If this is a TypeRef `clazz`[`T`], return the argument `T`
* otherwise return this type
@@ -2079,7 +2079,7 @@ A type's typeSymbol should never be inspected directly.
override def isTrivial: Boolean = isTrivial0 && (resultType eq resultType.withoutAnnotations)
private lazy val isTrivial0 =
resultType.isTrivial && params.forall{p => p.tpe.isTrivial && (
- !settings.YdepMethTpes.value || !(params.exists(_.tpe.contains(p)) || resultType.contains(p)))
+ /*!settings.YdepMethTpes.value ||*/ !(params.exists(_.tpe.contains(p)) || resultType.contains(p)))
}
def isImplicit = params.nonEmpty && params.head.isImplicit
@@ -2104,7 +2104,7 @@ A type's typeSymbol should never be inspected directly.
else existentialAbstraction(params, resultType)
// implicit args can only be depended on in result type: TODO this may be generalised so that the only constraint is dependencies are acyclic
- def approximate: MethodType = MethodType(params, resultApprox)
+ def approximate: MethodType = MethodType(params, resultApprox) // if (!settings.YdepMethTpes.value) this else
override def finalResultType: Type = resultType.finalResultType
diff --git a/src/compiler/scala/reflect/internal/settings/MutableSettings.scala b/src/compiler/scala/reflect/internal/settings/MutableSettings.scala
index b756408541..3310b5d80b 100644
--- a/src/compiler/scala/reflect/internal/settings/MutableSettings.scala
+++ b/src/compiler/scala/reflect/internal/settings/MutableSettings.scala
@@ -34,7 +34,6 @@ abstract class MutableSettings extends AbsSettings {
def overrideObjects: BooleanSetting
def printtypes: BooleanSetting
def debug: BooleanSetting
- def YdepMethTpes: BooleanSetting
def Ynotnull: BooleanSetting
def explaintypes: BooleanSetting
def verbose: BooleanSetting
diff --git a/src/compiler/scala/reflect/internal/transform/Erasure.scala b/src/compiler/scala/reflect/internal/transform/Erasure.scala
index f6d94a3949..cac60deaf7 100644
--- a/src/compiler/scala/reflect/internal/transform/Erasure.scala
+++ b/src/compiler/scala/reflect/internal/transform/Erasure.scala
@@ -89,14 +89,11 @@ trait Erasure {
case mt @ MethodType(params, restpe) =>
MethodType(
cloneSymbols(params) map (p => p.setInfo(apply(p.tpe))),
- if (restpe.typeSymbol == UnitClass)
- erasedTypeRef(UnitClass)
- else if (settings.YdepMethTpes.value)
- // this replaces each typeref that refers to an argument
- // by the type `p.tpe` of the actual argument p (p in params)
- apply(mt.resultType(params map (_.tpe)))
- else
- apply(restpe))
+ if (restpe.typeSymbol == UnitClass) erasedTypeRef(UnitClass)
+ // else if (!settings.YdepMethTpes.value) apply(restpe)
+ // this replaces each typeref that refers to an argument
+ // by the type `p.tpe` of the actual argument p (p in params)
+ else apply(mt.resultType(params map (_.tpe))))
case RefinedType(parents, decls) =>
apply(mergeParents(parents))
case AnnotatedType(_, atp, _) =>
diff --git a/src/compiler/scala/reflect/runtime/Settings.scala b/src/compiler/scala/reflect/runtime/Settings.scala
index 86e8457850..bb5399870b 100644
--- a/src/compiler/scala/reflect/runtime/Settings.scala
+++ b/src/compiler/scala/reflect/runtime/Settings.scala
@@ -23,7 +23,7 @@ class Settings extends internal.settings.MutableSettings {
val overrideObjects = new BooleanSetting(false)
val debug = new BooleanSetting(false)
- val YdepMethTpes = new BooleanSetting(false)
+ // val YdepMethTpes = new BooleanSetting(true)
val Ynotnull = new BooleanSetting(false)
val explaintypes = new BooleanSetting(false)
val verbose = new BooleanSetting(false)
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 57aedb5169..a32e4bff61 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -267,7 +267,6 @@ class Global(var currentSettings: Settings, var reporter: Reporter) extends Symb
}
// behavior
- def dependentMethodTypes = settings.YdepMethTpes.value
// debugging
def checkPhase = wasActive(settings.check)
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index 5cf5767257..ef60dc32d4 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -92,7 +92,8 @@ trait ScalaSettings extends AbsScalaSettings
// Experimental Extensions
val Xexperimental = BooleanSetting ("-Xexperimental", "Enable experimental extensions.") .
- withPostSetHook(set => List(YdepMethTpes, YmethodInfer, overrideObjects) foreach (_.value = set.value)) //YvirtClasses,
+ withPostSetHook(set => List(YmethodInfer, overrideObjects) foreach (_.value = set.value))
+ // YdepMethTpes, YvirtClasses,
/** Compatibility stubs for options whose value name did
* not previously match the option name.
@@ -166,7 +167,7 @@ trait ScalaSettings extends AbsScalaSettings
val Ydocdebug = BooleanSetting ("-Ydoc-debug", "Trace all scaladoc activity.")
val Ypmatnaive = BooleanSetting ("-Ypmat-naive", "Desugar matches as naively as possible.")
val Ynotnull = BooleanSetting ("-Ynotnull", "Enable (experimental and incomplete) scala.NotNull.")
- val YdepMethTpes = BooleanSetting ("-Ydependent-method-types", "Allow dependent method types.")
+ // val YdepMethTpes = BooleanSetting ("-Ydependent-method-types", "Allow dependent method types.")
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 noSelfCheck = BooleanSetting ("-Yno-self-type-checks", "Suppress check for self-type conformance among inherited members.")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 874d1149a0..1b2b737074 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -1459,15 +1459,11 @@ trait Namers { self: Analyzer =>
this(p.info)
// can only refer to symbols in earlier parameter sections
// (if the extension is enabled)
- if (opt.dependentMethodTypes)
- okParams ++= vps
+ okParams ++= vps
}
}
- private def errorAddendum = (
- if (opt.dependentMethodTypes)
- ": parameter appears in the type of another parameter in the same section or an earlier one"
- else ""
- )
+ private def errorAddendum =
+ ": parameter appears in the type of another parameter in the same section or an earlier one"
}
@deprecated("Use underlyingSymbol instead", "2.10.0")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 3cdfca9cf4..097def8390 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -724,7 +724,7 @@ trait Typers extends Modes with Adaptations {
context.undetparams =
inferExprInstance(tree, context.extractUndetparams(), pt,
// approximate types that depend on arguments since dependency on implicit argument is like dependency on type parameter
- if (settings.YdepMethTpes.value) mt.approximate else mt,
+ mt.approximate,
// if we are looking for a manifest, instantiate type to Nothing anyway,
// as we would get ambiguity errors otherwise. Example
// Looking for a manifest of Nil: This has many potential types,
@@ -1792,12 +1792,6 @@ trait Typers extends Modes with Adaptations {
error(vparam1.pos, "*-parameter must come last")
var tpt1 = checkNoEscaping.privates(meth, typedType(ddef.tpt))
- if (!settings.YdepMethTpes.value) {
- for (vparams <- vparamss1; vparam <- vparams) {
- checkNoEscaping.locals(context.scope, WildcardType, vparam.tpt); ()
- }
- checkNoEscaping.locals(context.scope, WildcardType, tpt1)
- }
checkNonCyclic(ddef, tpt1)
ddef.tpt.setType(tpt1.tpe)
val typedMods = removeAnnotations(ddef.mods)