aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/ExtensionMethods.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-07-11 14:37:06 +0200
committerMartin Odersky <odersky@gmail.com>2014-07-17 11:02:02 +0200
commit58f249d5d5acca1da3f4f2cdd417ba271d79819f (patch)
tree84ba7c7cfd1af5b04b8fa7c2c53f2d397ab62cb0 /src/dotty/tools/dotc/transform/ExtensionMethods.scala
parent4a08703c16bba862f1d27e1fdd7484da128696a7 (diff)
downloaddotty-58f249d5d5acca1da3f4f2cdd417ba271d79819f.tar.gz
dotty-58f249d5d5acca1da3f4f2cdd417ba271d79819f.tar.bz2
dotty-58f249d5d5acca1da3f4f2cdd417ba271d79819f.zip
Simplification: dynamicSignature instead of toDynamic
When figuring out which of a number of static methods corresponds to an overloaded dynamic method, we only need to compare signatures. No need to resconstruct the full dynamic type.
Diffstat (limited to 'src/dotty/tools/dotc/transform/ExtensionMethods.scala')
-rw-r--r--src/dotty/tools/dotc/transform/ExtensionMethods.scala7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/transform/ExtensionMethods.scala b/src/dotty/tools/dotc/transform/ExtensionMethods.scala
index d0cdf976d..afbb3c1f5 100644
--- a/src/dotty/tools/dotc/transform/ExtensionMethods.scala
+++ b/src/dotty/tools/dotc/transform/ExtensionMethods.scala
@@ -49,8 +49,6 @@ class ExtensionMethods extends MacroTransform with IdentityDenotTransformer { th
private def extensionNames(imeth: Symbol)(implicit ctx: Context): Stream[Name] = {
val decl = imeth.owner.info.decl(imeth.name)
- if (imeth.name.toString == "appliedTo") println(i"resolve: $decl")
-
/** No longer needed for Dotty, as we are more disciplined with scopes now.
// 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.
@@ -66,7 +64,6 @@ class ExtensionMethods extends MacroTransform with IdentityDenotTransformer { th
val index = alts indexOf imeth.denot
assert(index >= 0, alts+" does not contain "+imeth)
def altName(index: Int) = (imeth.name+"$extension"+index).toTermName
- if (imeth.name.toString == "appliedTo") println(i"resolve: $decl ${altName(index)}")
altName(index) #:: ((0 until alts.length).toStream filter (index != _) map altName)
case decl =>
assert(decl.exists, imeth.name+" not found in "+imeth.owner+"'s decls: "+imeth.owner.info.decls)
@@ -80,7 +77,7 @@ class ExtensionMethods extends MacroTransform with IdentityDenotTransformer { th
// FIXME use toStatic instead?
val companionInfo = imeth.owner.companionModule.info
val candidates = extensionNames(imeth) map (companionInfo.decl(_).symbol) filter (_.exists)
- val matching = candidates filter (alt => alt.info.toDynamic(imeth.owner) matches imeth.info)
+ val matching = candidates filter (_.info.dynamicSignature == imeth.signature)
assert(matching.nonEmpty,
sm"""|no extension method found for:
|
@@ -92,7 +89,7 @@ class ExtensionMethods extends MacroTransform with IdentityDenotTransformer { th
|
| Candidates (signatures normalized):
|
- | ${candidates.map(c => c.name + ":" + c.info.toDynamic(imeth.owner)).mkString("\n")}
+ | ${candidates.map(c => c.name + ":" + c.info.dynamicSignature).mkString("\n")}
|
| Eligible Names: ${extensionNames(imeth).mkString(",")}""")
matching.head