diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-05-27 15:18:25 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-05-27 15:18:25 -0700 |
commit | ac3fdfddb64a93a17f414e34692b2fd86e7f4746 (patch) | |
tree | 7b547b9f934d198d30aab482a777637dd3e0e784 /src | |
parent | bcc82808ecf056affecf11b14f3ad850ad21d773 (diff) | |
parent | c82bc67737a31f2a639172e677cafdefe8fdbf4e (diff) | |
download | scala-ac3fdfddb64a93a17f414e34692b2fd86e7f4746.tar.gz scala-ac3fdfddb64a93a17f414e34692b2fd86e7f4746.tar.bz2 scala-ac3fdfddb64a93a17f414e34692b2fd86e7f4746.zip |
Merge pull request #633 from retronym/topic/value-class-bridge
Fix a NSDNHAO in extension methods.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala b/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala index 007457ef7b..8556cc9ddc 100644 --- a/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala +++ b/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala @@ -44,8 +44,18 @@ abstract class ExtensionMethods extends Transform with TypingTransformers { * in `extensionMethod` if the first name has the wrong type. We thereby gain a level of insensitivity * of how overloaded types are ordered between phases and picklings. */ - private def extensionNames(imeth: Symbol): Stream[Name] = - imeth.owner.info.decl(imeth.name).tpe match { + private def extensionNames(imeth: Symbol): Stream[Name] = { + val decl = imeth.owner.info.decl(imeth.name) + + // Bridge generation is done at phase `erasure`, but new scopes are only generated + // for the phase after that. So bridges are visible in earlier phases. + // + // `info.member(imeth.name)` filters these out, but we need to use `decl` + // to restrict ourselves to members defined in the current class, so we + // must do the filtering here. + val declTypeNoBridge = decl.filter(sym => !sym.isBridge).tpe + + declTypeNoBridge match { case OverloadedType(_, alts) => val index = alts indexOf imeth assert(index >= 0, alts+" does not contain "+imeth) @@ -55,6 +65,7 @@ abstract class ExtensionMethods extends Transform with TypingTransformers { assert(tpe != NoType, imeth.name+" not found in "+imeth.owner+"'s decls: "+imeth.owner.info.decls) Stream(newTermName("extension$"+imeth.name)) } + } /** Return the extension method that corresponds to given instance method `meth`. */ |