diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-07-23 16:42:35 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-07-23 16:42:35 +0200 |
commit | 5766b9976982071caf6e20a629c04a66ccf5cbb5 (patch) | |
tree | f19a31730e80806d0f73bf179fdf54b300a9d2e7 | |
parent | a1087a475717d960cf354cf388a44ecb9c40c8e3 (diff) | |
download | dotty-5766b9976982071caf6e20a629c04a66ccf5cbb5.tar.gz dotty-5766b9976982071caf6e20a629c04a66ccf5cbb5.tar.bz2 dotty-5766b9976982071caf6e20a629c04a66ccf5cbb5.zip |
Add Symdenotation. isValueClassConvertMethod
Checks if the symbols is a synthetic symbol that is
created by values class transformation to represent
conversions between representations of a value class.
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/ElimErasedValueType.scala | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index 53973b587..985d1a9c7 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -404,6 +404,14 @@ object SymDenotations { name.toTermName == nme.COMPANION_CLASS_METHOD || name.toTermName == nme.COMPANION_MODULE_METHOD + /** Is this a syntetic method that represents conversions between representations of a value class + * These methods are generated in ExtensionMethods + * and used in ElimErasedValueType. + */ + final def isValueClassConvertMethod(implicit ctx: Context) = + name.toTermName == nme.U2EVT || + name.toTermName == nme.EVT2U + /** Is symbol a primitive value class? */ def isPrimitiveValueClass(implicit ctx: Context) = defn.ScalaValueClasses contains symbol diff --git a/src/dotty/tools/dotc/transform/ElimErasedValueType.scala b/src/dotty/tools/dotc/transform/ElimErasedValueType.scala index 8a18c9c17..a3f8b56ff 100644 --- a/src/dotty/tools/dotc/transform/ElimErasedValueType.scala +++ b/src/dotty/tools/dotc/transform/ElimErasedValueType.scala @@ -56,12 +56,11 @@ class ElimErasedValueType extends MiniPhaseTransform with InfoTransformer { override def transformApply(tree: Apply)(implicit ctx: Context, info: TransformerInfo): Tree = { val Apply(fun, args) = tree - val name = fun.symbol.name // The casts to and from ErasedValueType are no longer needed once ErasedValueType // has been eliminated. val t = - if ((name eq nme.U2EVT) || (name eq nme.EVT2U)) + if (fun.symbol.isValueClassConvertMethod) args.head else tree |