diff options
author | odersky <odersky@gmail.com> | 2016-12-18 16:05:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-18 16:05:15 +0100 |
commit | 7866bc2620098a7a692b68ac9c37e6d8a05ec774 (patch) | |
tree | fa37e7fe072bfa501666823e2f8c1da7f0f13994 /compiler/src/dotty/tools/dotc/core/TypeErasure.scala | |
parent | 18b8daa30916b2efaa59638c21198d401a67e46a (diff) | |
parent | 2e99511840915e2805e7a2c07571d3859a3db698 (diff) | |
download | dotty-7866bc2620098a7a692b68ac9c37e6d8a05ec774.tar.gz dotty-7866bc2620098a7a692b68ac9c37e6d8a05ec774.tar.bz2 dotty-7866bc2620098a7a692b68ac9c37e6d8a05ec774.zip |
Merge pull request #1775 from dotty-staging/add-implicit-funtypes
Add implicit function types
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/TypeErasure.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/TypeErasure.scala | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala index 2e7c1db04..91e37d440 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala @@ -2,7 +2,9 @@ package dotty.tools package dotc package core -import Symbols._, Types._, Contexts._, Flags._, Names._, StdNames._, Decorators._, Flags.JavaDefined +import Symbols._, Types._, Contexts._, Flags._, Names._, StdNames._, Decorators._ +import Flags.JavaDefined +import NameOps._ import Uniques.unique import dotc.transform.ExplicitOuter._ import dotc.transform.ValueClasses._ @@ -42,7 +44,7 @@ object TypeErasure { val sym = tp.symbol sym.isClass && sym != defn.AnyClass && sym != defn.ArrayClass && - !defn.isUnimplementedFunctionClass(sym) + !defn.isUnimplementedFunctionClass(sym) && !defn.isImplicitFunctionClass(sym) case _: TermRef => true case JavaArrayType(elem) => @@ -327,6 +329,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean * - For a typeref scala.Any, scala.AnyVal or scala.Singleton: |java.lang.Object| * - For a typeref scala.Unit, |scala.runtime.BoxedUnit|. * - For a typeref scala.FunctionN, where N > MaxImplementedFunctionArity, scala.FunctionXXL + * - For a typeref scala.ImplicitFunctionN, | scala.FunctionN | * - For a typeref P.C where C refers to a class, <noprefix> # C. * - For a typeref P.C where C refers to an alias type, the erasure of C's alias. * - For a typeref P.C where C refers to an abstract type, the erasure of C's upper bound. @@ -356,6 +359,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean else if (semiEraseVCs && isDerivedValueClass(sym)) eraseDerivedValueClassRef(tp) else if (sym == defn.ArrayClass) apply(tp.appliedTo(TypeBounds.empty)) // i966 shows that we can hit a raw Array type. else if (defn.isUnimplementedFunctionClass(sym)) defn.FunctionXXLType + else if (defn.isImplicitFunctionClass(sym)) apply(defn.FunctionType(sym.name.functionArity)) else eraseNormalClassRef(tp) case tp: RefinedType => val parent = tp.parent @@ -492,7 +496,10 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean val erasedVCRef = eraseDerivedValueClassRef(tp) if (erasedVCRef.exists) return sigName(erasedVCRef) } - normalizeClass(sym.asClass).fullName.asTypeName + if (defn.isImplicitFunctionClass(sym)) + sigName(defn.FunctionType(sym.name.functionArity)) + else + normalizeClass(sym.asClass).fullName.asTypeName case defn.ArrayOf(elem) => sigName(this(tp)) case JavaArrayType(elem) => |