diff options
author | Martin Odersky <odersky@gmail.com> | 2016-12-01 13:20:39 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-12-01 13:20:39 +0100 |
commit | 055f12f957ec176323e4e0bf01af51666b9ff433 (patch) | |
tree | dc4b4e7fedc92b09e44af5a3bfa3411456f33b23 /compiler/src/dotty/tools/dotc/transform/Erasure.scala | |
parent | 636608afacf943d8b3c05074a6f4de4ca40a4688 (diff) | |
download | dotty-055f12f957ec176323e4e0bf01af51666b9ff433.tar.gz dotty-055f12f957ec176323e4e0bf01af51666b9ff433.tar.bz2 dotty-055f12f957ec176323e4e0bf01af51666b9ff433.zip |
Adress reviewers comments
Diffstat (limited to 'compiler/src/dotty/tools/dotc/transform/Erasure.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/transform/Erasure.scala | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/Erasure.scala b/compiler/src/dotty/tools/dotc/transform/Erasure.scala index 5dd2e512b..d1f5bd532 100644 --- a/compiler/src/dotty/tools/dotc/transform/Erasure.scala +++ b/compiler/src/dotty/tools/dotc/transform/Erasure.scala @@ -343,19 +343,22 @@ object Erasure extends TypeTestsCasts{ * e.m -> e.[]m if `m` is an array operation other than `clone`. */ override def typedSelect(tree: untpd.Select, pt: Type)(implicit ctx: Context): Tree = { - val oldSym = tree.symbol - assert(oldSym.exists) - val oldOwner = oldSym.owner - val owner = - if ((oldOwner eq defn.AnyClass) || (oldOwner eq defn.AnyValClass)) { - assert(oldSym.isConstructor, s"${oldSym.showLocated}") + + def mapOwner(sym: Symbol): Symbol = { + val owner = sym.owner + if ((owner eq defn.AnyClass) || (owner eq defn.AnyValClass)) { + assert(sym.isConstructor, s"${sym.showLocated}") defn.ObjectClass } - else if (defn.isUnimplementedFunctionClass(oldOwner)) + else if (defn.isUnimplementedFunctionClass(owner)) defn.FunctionXXLClass else - oldOwner - val sym = if (owner eq oldOwner) oldSym else owner.info.decl(oldSym.name).symbol + owner + } + + var sym = tree.symbol + val owner = mapOwner(sym) + if (owner ne sym.owner) sym = owner.info.decl(sym.name).symbol assert(sym.exists, owner) def select(qual: Tree, sym: Symbol): Tree = { @@ -443,7 +446,7 @@ object Erasure extends TypeTestsCasts{ } } - /** Besides notmal typing, this method collects all arguments + /** Besides normal typing, this method collects all arguments * to a compacted function into a single argument of array type. */ override def typedApply(tree: untpd.Apply, pt: Type)(implicit ctx: Context): Tree = { |