summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project/ScalaOptionParser.scala2
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala1
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala6
-rw-r--r--test/files/run/t7899-regression.check1
-rw-r--r--test/files/run/t7899-regression.flags1
-rw-r--r--test/files/run/t7899-regression.scala24
6 files changed, 3 insertions, 32 deletions
diff --git a/project/ScalaOptionParser.scala b/project/ScalaOptionParser.scala
index bcc561cb0d..dfc9d481a9 100644
--- a/project/ScalaOptionParser.scala
+++ b/project/ScalaOptionParser.scala
@@ -83,7 +83,7 @@ object ScalaOptionParser {
private def booleanSettingNames = List("-X", "-Xcheckinit", "-Xdev", "-Xdisable-assertions", "-Xexperimental", "-Xfatal-warnings", "-Xfull-lubs", "-Xfuture", "-Xlog-free-terms", "-Xlog-free-types", "-Xlog-implicit-conversions", "-Xlog-implicits", "-Xlog-reflective-calls",
"-Xno-forwarders", "-Xno-patmat-analysis", "-Xno-uescape", "-Xnojline", "-Xprint-pos", "-Xprint-types", "-Xprompt", "-Xresident", "-Xshow-phases", "-Xstrict-inference", "-Xverify", "-Y",
"-Ybreak-cycles", "-Ydebug", "-Ycompact-trees", "-YdisableFlatCpCaching", "-Ydoc-debug",
- "-Yide-debug", "-Yinfer-argument-types", "-Yinfer-by-name",
+ "-Yide-debug", "-Yinfer-argument-types",
"-Yissue-debug", "-Ylog-classpath", "-Ymacro-debug-lite", "-Ymacro-debug-verbose", "-Ymacro-no-expand",
"-Yno-completion", "-Yno-generic-signatures", "-Yno-imports", "-Yno-predef",
"-Yoverride-objects", "-Yoverride-vars", "-Ypatmat-debug", "-Yno-adapted-args", "-Ypartial-unification", "-Ypos-debug", "-Ypresentation-debug",
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index 4e69c35f96..9ec2db6d06 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -211,7 +211,6 @@ trait ScalaSettings extends AbsScalaSettings
val Yreplclassbased = BooleanSetting ("-Yrepl-class-based", "Use classes to wrap REPL snippets instead of objects")
val Yreploutdir = StringSetting ("-Yrepl-outdir", "path", "Write repl-generated classfiles to given output directory (use \"\" to generate a temporary dir)" , "")
val YmethodInfer = BooleanSetting ("-Yinfer-argument-types", "Infer types for arguments of overridden methods.")
- val inferByName = BooleanSetting ("-Yinfer-by-name", "Allow inference of by-name types. This is a temporary option to ease transition. See SI-7899.").withDeprecationMessage(removalIn212)
val YdisableFlatCpCaching = BooleanSetting ("-YdisableFlatCpCaching", "Do not cache flat classpath representation of classpath elements from jars across compiler instances.")
val YpartialUnification = BooleanSetting ("-Ypartial-unification", "Enable partial unification in type constructor inference")
val Yvirtpatmat = BooleanSetting ("-Yvirtpatmat", "Enable pattern matcher virtualization")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 0071d66eb9..e8147dbf3a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -936,10 +936,8 @@ trait Infer extends Checkable {
def infer_s = map3(tparams, tvars, targs)((tparam, tvar, targ) => s"$tparam=$tvar/$targ") mkString ","
printTyping(tree, s"infer expr instance from pt=$pt, $infer_s")
- // SI-7899 inferring by-name types is unsound. The correct behaviour is conditional because the hole is
- // exploited in Scalaz (Free.scala), as seen in: run/t7899-regression.
- def dropByNameIfStrict(tp: Type): Type = if (settings.inferByName) tp else dropByName(tp)
- def targsStrict = if (targs eq null) null else targs mapConserve dropByNameIfStrict
+ // SI-7899 inferring by-name types is unsound
+ def targsStrict = if (targs eq null) null else targs mapConserve dropByName
if (keepNothings || (targs eq null)) { //@M: adjustTypeArgs fails if targs==null, neg/t0226
substExpr(tree, tparams, targsStrict, pt)
diff --git a/test/files/run/t7899-regression.check b/test/files/run/t7899-regression.check
deleted file mode 100644
index 602b03a1d1..0000000000
--- a/test/files/run/t7899-regression.check
+++ /dev/null
@@ -1 +0,0 @@
-warning: -Yinfer-by-name is deprecated: This flag is scheduled for removal in 2.12. If you have a case where you need this flag then please report a bug.
diff --git a/test/files/run/t7899-regression.flags b/test/files/run/t7899-regression.flags
deleted file mode 100644
index 553a27eafd..0000000000
--- a/test/files/run/t7899-regression.flags
+++ /dev/null
@@ -1 +0,0 @@
--Yinfer-by-name -deprecation
diff --git a/test/files/run/t7899-regression.scala b/test/files/run/t7899-regression.scala
deleted file mode 100644
index 67d38cdd1d..0000000000
--- a/test/files/run/t7899-regression.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-import language.higherKinds
-
-object Test {
- trait Monad[M[_]] {
- def foo[A](ma: M[A])(f: M[A] => Any) = f(ma)
- }
- implicit def function1Covariant[T]: Monad[({type l[a] = (T => a)})#l] =
- new Monad[({type l[a] = (T => a)})#l] {}
-
- def main(args: Array[String]) {
- // inference of T = (=> Any) here was outlawed by SI-7899 / 8ed7099
- // but this pattern is used in Scalaz in just a few places and caused
- // a regression.
- //
- // Inference of a by-name type doesn't *always* lead to a ClassCastException,
- // it only gets there if a method in generic code accepts a parameter of
- // that type.
- //
- // We need to introduce the stricter inference rules gradually, probably
- // with a warning.
- val m = implicitly[Monad[({type f[+x] = (=> Any) => x})#f]]
- assert(m.foo[Int]((x => 0))(f => f(???)) == 0)
- }
-}