From 055f12f957ec176323e4e0bf01af51666b9ff433 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 1 Dec 2016 13:20:39 +0100 Subject: Adress reviewers comments --- .../src/dotty/tools/dotc/core/Definitions.scala | 2 +- .../src/dotty/tools/dotc/transform/Erasure.scala | 23 ++++++++++++---------- library/src/scala/FunctionXXL.scala | 8 -------- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 09485918f..b9ea03661 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -685,7 +685,7 @@ class Definitions { def isFunctionClass(cls: Symbol) = isVarArityClass(cls, tpnme.Function) def isUnimplementedFunctionClass(cls: Symbol) = - isFunctionClass(cls) && cls.name.functionArity >= MaxImplementedFunctionArity + isFunctionClass(cls) && cls.name.functionArity > MaxImplementedFunctionArity def isAbstractFunctionClass(cls: Symbol) = isVarArityClass(cls, tpnme.AbstractFunction) def isTupleClass(cls: Symbol) = isVarArityClass(cls, tpnme.Tuple) def isProductClass(cls: Symbol) = isVarArityClass(cls, tpnme.Product) 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 = { diff --git a/library/src/scala/FunctionXXL.scala b/library/src/scala/FunctionXXL.scala index bc0de4482..25e7af609 100644 --- a/library/src/scala/FunctionXXL.scala +++ b/library/src/scala/FunctionXXL.scala @@ -1,11 +1,3 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ -// GENERATED CODE: DO NOT EDIT. See scala.Function0 for timestamp. package scala /** A function with all parameters grouped in an array. */ -- cgit v1.2.3