diff options
author | Martin Odersky <odersky@gmail.com> | 2013-09-26 12:03:10 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-09-26 12:43:55 +0200 |
commit | 54acd26dcf377e2eb2a474399894e10cfd4322f5 (patch) | |
tree | a275062a8cab9e81b401a4745400f8db71fed1ae /src/dotty/tools/dotc/core/transform/Erasure.scala | |
parent | b7f5aa30383730dc1d2b34f9773695d0f5669bcd (diff) | |
download | dotty-54acd26dcf377e2eb2a474399894e10cfd4322f5.tar.gz dotty-54acd26dcf377e2eb2a474399894e10cfd4322f5.tar.bz2 dotty-54acd26dcf377e2eb2a474399894e10cfd4322f5.zip |
Added isRef method to determine whether a type is a typeref that refers to a symbol.
The alternative (tpe eq sym.typeConstructor) does not work because types are not unique.
The alternative (tpe.typeSymbol == sym) does not work because other types than TypeRefs have typeSymbols.
Diffstat (limited to 'src/dotty/tools/dotc/core/transform/Erasure.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/transform/Erasure.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/transform/Erasure.scala b/src/dotty/tools/dotc/core/transform/Erasure.scala index 6bb07e699..201dd107f 100644 --- a/src/dotty/tools/dotc/core/transform/Erasure.scala +++ b/src/dotty/tools/dotc/core/transform/Erasure.scala @@ -131,10 +131,10 @@ object Erasure { } def resultErasure(tp: Type)(implicit ctx: Context) = - if (tp.isClassType(defn.UnitClass)) tp else erasure(tp) + if (tp isRef defn.UnitClass) tp else erasure(tp) def removeLaterObjects(trs: List[TypeRef])(implicit ctx: Context): List[TypeRef] = trs match { - case tr :: trs1 => tr :: trs1.filterNot(_.isClassType(defn.ObjectClass)) + case tr :: trs1 => tr :: trs1.filterNot(_ isRef defn.ObjectClass) case nil => nil } } |