diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 20 | ||||
-rw-r--r-- | src/eclipse/partest/.classpath | 2 | ||||
-rw-r--r-- | src/library/scala/util/Properties.scala | 4 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Types.scala | 3 | ||||
-rw-r--r-- | src/reflect/scala/reflect/runtime/JavaMirrors.scala | 6 | ||||
-rw-r--r-- | test/files/pos/t9370/sample_2.flags | 2 | ||||
-rw-r--r-- | test/files/pos/t9475.scala | 19 | ||||
-rw-r--r-- | test/files/run/reflection-fieldmirror-ctorparam.check | 6 | ||||
-rw-r--r-- | versions.properties | 2 |
9 files changed, 45 insertions, 19 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 43f2655311..c46bc7444a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -574,19 +574,23 @@ trait Contexts { self: Analyzer => /** Issue/buffer/throw the given implicit ambiguity error according to the current mode for error reporting. */ private[typechecker] def issueAmbiguousError(err: AbsAmbiguousTypeError) = reporter.issueAmbiguousError(err)(this) /** Issue/throw the given error message according to the current mode for error reporting. */ - def error(pos: Position, msg: String) = reporter.error(pos, msg) + def error(pos: Position, msg: String) = reporter.error(fixPosition(pos), msg) /** Issue/throw the given error message according to the current mode for error reporting. */ - def warning(pos: Position, msg: String) = reporter.warning(pos, msg) - def echo(pos: Position, msg: String) = reporter.echo(pos, msg) + def warning(pos: Position, msg: String) = reporter.warning(fixPosition(pos), msg) + def echo(pos: Position, msg: String) = reporter.echo(fixPosition(pos), msg) + def fixPosition(pos: Position): Position = pos match { + case NoPosition => nextEnclosing(_.tree.pos != NoPosition).tree.pos + case _ => pos + } def deprecationWarning(pos: Position, sym: Symbol, msg: String): Unit = - currentRun.reporting.deprecationWarning(pos, sym, msg) + currentRun.reporting.deprecationWarning(fixPosition(pos), sym, msg) def deprecationWarning(pos: Position, sym: Symbol): Unit = - currentRun.reporting.deprecationWarning(pos, sym) // TODO: allow this to escalate to an error, and implicit search will ignore deprecated implicits + currentRun.reporting.deprecationWarning(fixPosition(pos), sym) // TODO: allow this to escalate to an error, and implicit search will ignore deprecated implicits def featureWarning(pos: Position, featureName: String, featureDesc: String, featureTrait: Symbol, construct: => String = "", required: Boolean): Unit = - currentRun.reporting.featureWarning(pos, featureName, featureDesc, featureTrait, construct, required) + currentRun.reporting.featureWarning(fixPosition(pos), featureName, featureDesc, featureTrait, construct, required) // nextOuter determines which context is searched next for implicits @@ -1239,7 +1243,7 @@ trait Contexts { self: Analyzer => type Error = AbsTypeError type Warning = (Position, String) - def issue(err: AbsTypeError)(implicit context: Context): Unit = handleError(err.errPos, addDiagString(err.errMsg)) + def issue(err: AbsTypeError)(implicit context: Context): Unit = handleError(context.fixPosition(err.errPos), addDiagString(err.errMsg)) protected def handleError(pos: Position, msg: String): Unit protected def handleSuppressedAmbiguous(err: AbsAmbiguousTypeError): Unit = () @@ -1256,7 +1260,7 @@ trait Contexts { self: Analyzer => * - else, let this context reporter decide */ final def issueAmbiguousError(err: AbsAmbiguousTypeError)(implicit context: Context): Unit = - if (context.ambiguousErrors) reporter.error(err.errPos, addDiagString(err.errMsg)) // force reporting... see TODO above + if (context.ambiguousErrors) reporter.error(context.fixPosition(err.errPos), addDiagString(err.errMsg)) // force reporting... see TODO above else handleSuppressedAmbiguous(err) @inline final def withFreshErrorBuffer[T](expr: => T): T = { diff --git a/src/eclipse/partest/.classpath b/src/eclipse/partest/.classpath index 50757ad2ba..65848ea439 100644 --- a/src/eclipse/partest/.classpath +++ b/src/eclipse/partest/.classpath @@ -5,7 +5,7 @@ <classpathentry combineaccessrules="false" kind="src" path="/repl"/> <classpathentry kind="var" path="M2_REPO/com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0.jar"/> <classpathentry kind="var" path="M2_REPO/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar"/> - <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.11/1.0.7/scala-partest_2.11-1.0.7.jar"/> + <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.11/1.0.9/scala-partest_2.11-1.0.9.jar"/> <classpathentry kind="var" path="SCALA_BASEDIR/lib/ant/ant.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/> diff --git a/src/library/scala/util/Properties.scala b/src/library/scala/util/Properties.scala index 367488f116..d4a5e2f0e8 100644 --- a/src/library/scala/util/Properties.scala +++ b/src/library/scala/util/Properties.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2006-2013, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2006-2015, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** @@ -105,7 +105,7 @@ private[scala] trait PropertiesTrait { * or "version (unknown)" if it cannot be determined. */ val versionString = "version " + scalaPropOrElse("version.number", "(unknown)") - val copyrightString = scalaPropOrElse("copyright.string", "Copyright 2002-2013, LAMP/EPFL") + val copyrightString = scalaPropOrElse("copyright.string", "Copyright 2002-2015, LAMP/EPFL") /** This is the encoding to use reading in source files, overridden with -encoding. * Note that it uses "prop" i.e. looks in the scala jar, not the system properties. diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index adc2362e88..9697e16da7 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -2510,6 +2510,9 @@ trait Types override def baseType(clazz: Symbol): Type = resultType.baseType(clazz) override def narrow: Type = resultType.narrow + // SI-9475: PolyTypes with dependent method types are still dependent + override def isDependentMethodType = resultType.isDependentMethodType + /** @M: typeDefSig wraps a TypeBounds in a PolyType * to represent a higher-kinded type parameter * wrap lo&hi in polytypes to bind variables diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala index d0670f337a..50442519f2 100644 --- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala +++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala @@ -124,9 +124,9 @@ private[scala] trait JavaMirrors extends internal.SymbolTable with api.JavaUnive private def ErrorArrayConstructor(sym: Symbol, owner: Symbol) = abort(s"Cannot instantiate arrays with mirrors. Consider using `scala.reflect.ClassTag(<class of element>).newArray(<length>)` instead") private def ErrorFree(member: Symbol, freeType: Symbol) = abort(s"cannot reflect ${member.kindString} ${member.name}, because it's a member of a weak type ${freeType.name}") private def ErrorNonExistentField(sym: Symbol) = abort( - sm"""Scala field ${sym.name} isn't represented as a Java field, neither it has a Java accessor method - |note that private parameters of class constructors don't get mapped onto fields and/or accessors, - |unless they are used outside of their declaring constructors.""") + sm"""Scala field ${sym.name} of ${sym.owner} isn't represented as a Java field, nor does it have a + |Java accessor method. One common reason for this is that it may be a private class parameter + |not used outside the primary constructor.""") /** Helper functions for extracting typed values from a (Class[_], Any) * representing an annotation argument. diff --git a/test/files/pos/t9370/sample_2.flags b/test/files/pos/t9370/sample_2.flags index 03baca3030..dd7eb55d33 100644 --- a/test/files/pos/t9370/sample_2.flags +++ b/test/files/pos/t9370/sample_2.flags @@ -1 +1 @@ --Xplugin:/tmp:. -Xplugin-require:timebomb -Ystop-after:parser +-Xplugin:/tmp -Xplugin:. -Xplugin-require:timebomb -Ystop-after:parser diff --git a/test/files/pos/t9475.scala b/test/files/pos/t9475.scala new file mode 100644 index 0000000000..ce9c250ace --- /dev/null +++ b/test/files/pos/t9475.scala @@ -0,0 +1,19 @@ +trait Ctx { + trait Tree +} + +trait Lst[+A] { + def zip[A1 >: A, B](that: Lst[B]): Nothing +} + +object Test { + + // both of these methods should be transformed by uncurry + // such that List[c.Tree] becomes List[Ctx#Tree]: + def foo1(c: Ctx)(l: Lst[c.Tree]) = l zip l + def foo2[@specialized T](c: Ctx)(l: Lst[c.Tree], t: T) = l zip l + + // if this doesn't happen for the 2nd method, the specialization + // transformation fails +} + diff --git a/test/files/run/reflection-fieldmirror-ctorparam.check b/test/files/run/reflection-fieldmirror-ctorparam.check index e391e7ccfe..c66be94ed7 100644 --- a/test/files/run/reflection-fieldmirror-ctorparam.check +++ b/test/files/run/reflection-fieldmirror-ctorparam.check @@ -1,3 +1,3 @@ -class scala.ScalaReflectionException: Scala field x isn't represented as a Java field, neither it has a Java accessor method -note that private parameters of class constructors don't get mapped onto fields and/or accessors, -unless they are used outside of their declaring constructors. +class scala.ScalaReflectionException: Scala field x of class A isn't represented as a Java field, nor does it have a +Java accessor method. One common reason for this is that it may be a private class parameter +not used outside the primary constructor. diff --git a/versions.properties b/versions.properties index a2f74bbd08..2253921940 100644 --- a/versions.properties +++ b/versions.properties @@ -36,7 +36,7 @@ jline.version=2.12.1 scala-asm.version=5.0.4-scala-3 # external modules, used internally (not shipped) -partest.version.number=1.0.7 +partest.version.number=1.0.9 scalacheck.version.number=1.11.6 # TODO: modularize the compiler |