@@ -895,46 +895,10 @@ object desugar {
895895 vparams1 :: ext.vparamss ::: vparamss1
896896 case _ =>
897897 ext.vparamss ++ mdef.vparamss
898- ).withMods(mdef.mods | Extension )
898+ ).withMods(mdef.mods | ExtensionMethod )
899899 )
900900 }
901901
902- /** Transform the statements of a collective extension
903- * @param stats the original statements as they were parsed
904- * @param tparams the collective type parameters
905- * @param vparamss the collective value parameters, consisting
906- * of a single leading value parameter, followed by
907- * zero or more context parameter clauses
908- *
909- * Note: It is already assured by Parser.checkExtensionMethod that all
910- * statements conform to requirements.
911- *
912- * Each method in stats is transformed into an extension method. Example:
913- *
914- * extension on [Ts](x: T)(using C):
915- * def f(y: T) = ???
916- * def g(z: T) = f(z)
917- *
918- * is turned into
919- *
920- * extension:
921- * <extension> def f[Ts](x: T)(using C)(y: T) = ???
922- * <extension> def g[Ts](x: T)(using C)(z: T) = f(z)
923- */
924- def collectiveExtensionBody (stats : List [Tree ],
925- tparams : List [TypeDef ], vparamss : List [List [ValDef ]])(using Context ): List [Tree ] =
926- for stat <- stats yield
927- stat match
928- case mdef : DefDef =>
929- cpy.DefDef (mdef)(
930- name = mdef.name.toExtensionName,
931- tparams = tparams ++ mdef.tparams,
932- vparamss = vparamss ::: mdef.vparamss,
933- ).withMods(mdef.mods | Extension )
934- case mdef =>
935- mdef
936- end collectiveExtensionBody
937-
938902 /** Transforms
939903 *
940904 * <mods> type $T >: Low <: Hi
@@ -971,7 +935,7 @@ object desugar {
971935 report.error(IllegalRedefinitionOfStandardKind (kind, name), errPos)
972936 name = name.errorName
973937 }
974- if name.isExtensionName && ! mdef.mods.is(Extension ) then
938+ if name.isExtensionName && ! mdef.mods.is(ExtensionMethod ) then
975939 report.error(em " illegal method name: $name may not start with `extension_` " , errPos)
976940 name
977941 }
@@ -982,7 +946,7 @@ object desugar {
982946 case impl : Template =>
983947 if impl.parents.isEmpty then
984948 impl.body.find {
985- case dd : DefDef if dd.mods.is(Extension ) => true
949+ case dd : DefDef if dd.mods.is(ExtensionMethod ) => true
986950 case _ => false
987951 }
988952 match
0 commit comments