@@ -895,7 +895,7 @@ object desugar {
895895 mdef.tparams.head.srcPos)
896896 defDef(
897897 cpy.DefDef (mdef)(
898- name = normalizeName(mdef, ext).toExtensionName ,
898+ name = normalizeName(mdef, ext).asTermName ,
899899 tparams = ext.tparams ++ mdef.tparams,
900900 vparamss = mdef.vparamss match
901901 case vparams1 :: vparamss1 if mdef.name.isRightAssocOperatorName =>
@@ -928,10 +928,10 @@ object desugar {
928928
929929 /** The normalized name of `mdef`. This means
930930 * 1. Check that the name does not redefine a Scala core class.
931- * If it does redefine, issue an error and return a mangled name instead of the original one.
932- * 2. Check that the name does not start with `extension_` unless the
933- * method is an extension method.
934- * 3. If the name is missing (this can be the case for instance definitions), invent one instead.
931+ * If it does redefine, issue an error and return a mangled name instead
932+ * of the original one.
933+ * 2. If the name is missing (this can be the case for instance definitions),
934+ * invent one instead.
935935 */
936936 def normalizeName (mdef : MemberDef , impl : Tree )(using Context ): Name = {
937937 var name = mdef.name
@@ -942,31 +942,16 @@ object desugar {
942942 report.error(IllegalRedefinitionOfStandardKind (kind, name), errPos)
943943 name = name.errorName
944944 }
945- mdef match {
946- case vdef : ValDef if name.isExtension && isSetterNeeded(vdef) =>
947- report.error(em " illegal setter name: `extension_=` " , errPos)
948- case memDef if name.isExtensionName && ! mdef.mods.is(ExtensionMethod ) =>
949- report.error(em " illegal name: $name may not start with `extension_` " , errPos)
950- case _ =>
951- }
952945 name
953946 }
954947
955- /** Invent a name for an anonympus given or extension of type or template `impl`. */
948+ /** Invent a name for an anonympus given of type or template `impl`. */
956949 def inventGivenOrExtensionName (impl : Tree )(using Context ): SimpleName =
957950 val str = impl match
958951 case impl : Template =>
959952 if impl.parents.isEmpty then
960- impl.body.find {
961- case dd : DefDef if dd.mods.is(ExtensionMethod ) => true
962- case _ => false
963- }
964- match
965- case Some (DefDef (name, _, (vparam :: _) :: _, _, _)) =>
966- s " extension_ ${name}_ ${inventTypeName(vparam.tpt)}"
967- case _ =>
968- report.error(AnonymousInstanceCannotBeEmpty (impl), impl.srcPos)
969- nme.ERROR .toString
953+ report.error(AnonymousInstanceCannotBeEmpty (impl), impl.srcPos)
954+ nme.ERROR .toString
970955 else
971956 impl.parents.map(inventTypeName(_)).mkString(" given_" , " _" , " " )
972957 case impl : Tree =>
0 commit comments