summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--test/files/buildmanager/t2650_3/t2650_3.check1
-rw-r--r--test/files/buildmanager/t2650_4/t2650_4.check1
-rw-r--r--test/files/neg/depmet_1.flags1
-rw-r--r--test/files/neg/structural.check5
-rw-r--r--test/files/neg/t3873.flags1
-rw-r--r--test/files/pos/depmet_1_pos.flags1
-rw-r--r--test/files/pos/depmet_implicit_chaining_zw.flags1
-rw-r--r--test/files/pos/depmet_implicit_norm_ret.flags1
-rw-r--r--test/files/pos/depmet_implicit_oopsla_session.flags1
-rw-r--r--test/files/pos/depmet_implicit_oopsla_session_2.flags1
-rw-r--r--test/files/pos/depmet_implicit_oopsla_session_simpler.flags1
-rw-r--r--test/files/pos/depmet_implicit_oopsla_zipwith.flags1
-rw-r--r--test/files/pos/depmet_implicit_tpbetareduce.flags1
-rw-r--r--test/files/pos/t1569.flags1
22 files changed, 19 insertions, 45 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)
diff --git a/test/files/buildmanager/t2650_3/t2650_3.check b/test/files/buildmanager/t2650_3/t2650_3.check
index 5c6326d59f..c109800d9c 100644
--- a/test/files/buildmanager/t2650_3/t2650_3.check
+++ b/test/files/buildmanager/t2650_3/t2650_3.check
@@ -10,5 +10,6 @@ B.scala:2: error: type mismatch;
found : a.T
(which expands to) Long
required: Int
+ possible cause: missing arguments for method or constructor
def x(a: A): Int = a.x
^
diff --git a/test/files/buildmanager/t2650_4/t2650_4.check b/test/files/buildmanager/t2650_4/t2650_4.check
index a4aeaddfbb..89536776bd 100644
--- a/test/files/buildmanager/t2650_4/t2650_4.check
+++ b/test/files/buildmanager/t2650_4/t2650_4.check
@@ -10,5 +10,6 @@ B.scala:2: error: type mismatch;
found : a.T2
(which expands to) Long
required: Int
+ possible cause: missing arguments for method or constructor
def x(a: A): Int = a.x
^
diff --git a/test/files/neg/depmet_1.flags b/test/files/neg/depmet_1.flags
deleted file mode 100644
index 1c26b24745..0000000000
--- a/test/files/neg/depmet_1.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ydependent-method-types \ No newline at end of file
diff --git a/test/files/neg/structural.check b/test/files/neg/structural.check
index 100b989a2f..6ef57db1b4 100644
--- a/test/files/neg/structural.check
+++ b/test/files/neg/structural.check
@@ -1,9 +1,6 @@
structural.scala:47: error: Parameter type in structural refinement may not refer to the type of that refinement (self type)
val s1 = new { def f(p: this.type): Unit = () }
^
-structural.scala:19: error: illegal dependent method type
- def f9[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: Object): D }) = x.m[Tata](null) //fail
- ^
structural.scala:10: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
def f1[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: A): Object; val x: A }) = x.m[Tata](x.x) //fail
^
@@ -28,4 +25,4 @@ structural.scala:49: error: Parameter type in structural refinement may not refe
structural.scala:52: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
def s3[U >: Null <: Object](p: { def f(p: U): Unit; def u: U }) = ()
^
-10 errors found
+9 errors found
diff --git a/test/files/neg/t3873.flags b/test/files/neg/t3873.flags
deleted file mode 100644
index 1c26b24745..0000000000
--- a/test/files/neg/t3873.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ydependent-method-types \ No newline at end of file
diff --git a/test/files/pos/depmet_1_pos.flags b/test/files/pos/depmet_1_pos.flags
deleted file mode 100644
index 1c26b24745..0000000000
--- a/test/files/pos/depmet_1_pos.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ydependent-method-types \ No newline at end of file
diff --git a/test/files/pos/depmet_implicit_chaining_zw.flags b/test/files/pos/depmet_implicit_chaining_zw.flags
deleted file mode 100644
index 1c26b24745..0000000000
--- a/test/files/pos/depmet_implicit_chaining_zw.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ydependent-method-types \ No newline at end of file
diff --git a/test/files/pos/depmet_implicit_norm_ret.flags b/test/files/pos/depmet_implicit_norm_ret.flags
deleted file mode 100644
index 1c26b24745..0000000000
--- a/test/files/pos/depmet_implicit_norm_ret.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ydependent-method-types \ No newline at end of file
diff --git a/test/files/pos/depmet_implicit_oopsla_session.flags b/test/files/pos/depmet_implicit_oopsla_session.flags
deleted file mode 100644
index 1c26b24745..0000000000
--- a/test/files/pos/depmet_implicit_oopsla_session.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ydependent-method-types \ No newline at end of file
diff --git a/test/files/pos/depmet_implicit_oopsla_session_2.flags b/test/files/pos/depmet_implicit_oopsla_session_2.flags
deleted file mode 100644
index 1c26b24745..0000000000
--- a/test/files/pos/depmet_implicit_oopsla_session_2.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ydependent-method-types \ No newline at end of file
diff --git a/test/files/pos/depmet_implicit_oopsla_session_simpler.flags b/test/files/pos/depmet_implicit_oopsla_session_simpler.flags
deleted file mode 100644
index 1c26b24745..0000000000
--- a/test/files/pos/depmet_implicit_oopsla_session_simpler.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ydependent-method-types \ No newline at end of file
diff --git a/test/files/pos/depmet_implicit_oopsla_zipwith.flags b/test/files/pos/depmet_implicit_oopsla_zipwith.flags
deleted file mode 100644
index 1c26b24745..0000000000
--- a/test/files/pos/depmet_implicit_oopsla_zipwith.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ydependent-method-types \ No newline at end of file
diff --git a/test/files/pos/depmet_implicit_tpbetareduce.flags b/test/files/pos/depmet_implicit_tpbetareduce.flags
deleted file mode 100644
index 1c26b24745..0000000000
--- a/test/files/pos/depmet_implicit_tpbetareduce.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ydependent-method-types \ No newline at end of file
diff --git a/test/files/pos/t1569.flags b/test/files/pos/t1569.flags
deleted file mode 100644
index 1c26b24745..0000000000
--- a/test/files/pos/t1569.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ydependent-method-types \ No newline at end of file