summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-01-26 10:37:12 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-02-02 01:30:19 +0100
commit4ed88363f6867e5b4ebedfde10b88c0167f24f23 (patch)
treed381ea47509eedae9576fd0c8289e86d35744a61 /src/reflect
parent283924bfa5c266ccaea1bdb87521581e1ceb38cd (diff)
downloadscala-4ed88363f6867e5b4ebedfde10b88c0167f24f23.tar.gz
scala-4ed88363f6867e5b4ebedfde10b88c0167f24f23.tar.bz2
scala-4ed88363f6867e5b4ebedfde10b88c0167f24f23.zip
[backport] SI-6482, lost bounds in extension methods.
Squashed commit of the following: commit 5c156185306ba797c0443d9dccae0ae7ce462a1f Author: Paul Phillips <paulp@improving.org> Date: Sat Oct 6 15:42:50 2012 -0700 A little more housecleaning in ExtensionMethods. The only real contribution is readability. (cherry picked from commit 61f12faacaaccf366f9211ba6493fb042a91f1d2) Conflicts: src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala commit 79f443edf584745d614e24fb9ca6644c6b18d439 Author: Paul Phillips <paulp@improving.org> Date: Sat Oct 6 14:22:19 2012 -0700 Incorporated pull request feedback. (cherry picked from commit 153ccb4757718cceb219988f30381f73362e6075) commit 707f580b0cdcb01e27ca4c76991dea427945b5bd Author: Paul Phillips <paulp@improving.org> Date: Sat Oct 6 10:20:45 2012 -0700 Fix for SI-6482, lost bounds in extension methods. That was a good one. How to create a new method with type parameters from multiple sources, herein. (cherry picked from commit ff9f60f420c090b6716c927ab0359b082f2299de) commit 8889c7a13f74bc175e48aa2209549089a974c2af Author: Paul Phillips <paulp@improving.org> Date: Fri Oct 5 22:19:52 2012 -0700 Responded to comment about how many isCoercibles there are. I make the case that there is only one. (cherry picked from commit 883f1ac88dd7cec5882d42d6b48d7f267d1f6e00)
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/internal/Definitions.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala
index 4269b65297..8f451c207a 100644
--- a/src/reflect/scala/reflect/internal/Definitions.scala
+++ b/src/reflect/scala/reflect/internal/Definitions.scala
@@ -671,6 +671,11 @@ trait Definitions extends api.StandardDefinitions {
case _ => Nil
}
+ def dropNullaryMethod(tp: Type) = tp match {
+ case NullaryMethodType(restpe) => restpe
+ case _ => tp
+ }
+
def unapplyUnwrap(tpe:Type) = tpe.finalResultType.normalize match {
case RefinedType(p :: _, _) => p.normalize
case tp => tp
@@ -864,6 +869,12 @@ trait Definitions extends api.StandardDefinitions {
removeRedundantObjects(parents)
}
+ /** Flatten curried parameter lists of a method type. */
+ def allParameters(tpe: Type): List[Symbol] = tpe match {
+ case MethodType(params, res) => params ::: allParameters(res)
+ case _ => Nil
+ }
+
def typeStringNoPackage(tp: Type) =
"" + tp stripPrefix tp.typeSymbol.enclosingPackage.fullName + "."