From 406ec56c703c29ad29da2f5f6df366577d851ea5 Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Mon, 14 Sep 2015 16:41:38 +0200 Subject: Mixin: support trait setters. Used to create a separate field from trait setter, as the field name wasn't deconstructed. --- src/dotty/tools/dotc/core/NameOps.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/core/NameOps.scala') diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala index cab47025e..bf5b68ce9 100644 --- a/src/dotty/tools/dotc/core/NameOps.scala +++ b/src/dotty/tools/dotc/core/NameOps.scala @@ -69,6 +69,7 @@ object NameOps { def isLoopHeaderLabel = (name startsWith WHILE_PREFIX) || (name startsWith DO_WHILE_PREFIX) def isProtectedAccessorName = name startsWith PROTECTED_PREFIX def isReplWrapperName = name containsSlice INTERPRETER_IMPORT_WRAPPER + def isTraitSetterName = name containsSlice TRAIT_SETTER_SEPARATOR def isSetterName = name endsWith SETTER_SUFFIX def isSingletonName = name endsWith SINGLETON_SUFFIX def isModuleClassName = name endsWith MODULE_SUFFIX @@ -298,7 +299,14 @@ object NameOps { else setterToGetter def fieldName: TermName = - if (name.isSetterName) getterName.fieldName + if (name.isSetterName) { + if (name.isTraitSetterName) { + // has form <$-separated-trait-name>$_setter_$ `name`_$eq + val start = name.indexOfSlice(TRAIT_SETTER_SEPARATOR) + TRAIT_SETTER_SEPARATOR.length + val end = name.indexOfSlice(SETTER_SUFFIX) + name.slice(start, end) ++ LOCAL_SUFFIX + } else getterName.fieldName + } else name ++ LOCAL_SUFFIX private def setterToGetter: TermName = { -- cgit v1.2.3