@@ -446,9 +446,11 @@ object Types extends TypeUtils {
446446 def isRepeatedParam (using Context ): Boolean =
447447 typeSymbol eq defn.RepeatedParamClass
448448
449- /** Is this a parameter type that allows implicit argument converson? */
449+ /** Is this type of the form `compiletime.into[T]`, which means it can be the
450+ * target of an implicit converson without requiring a language import?
451+ */
450452 def isInto (using Context ): Boolean = this match
451- case AnnotatedType (_, annot ) => annot.symbol == defn.IntoParamAnnot
453+ case AppliedType ( tycon : TypeRef , arg :: Nil ) => defn.isInto(tycon.symbol)
452454 case _ => false
453455
454456 /** Is this the type of a method that has a repeated parameter type as
@@ -1967,8 +1969,7 @@ object Types extends TypeUtils {
19671969 }
19681970 defn.FunctionNOf (
19691971 mt.paramInfos.mapConserve:
1970- _.translateFromRepeated(toArray = isJava)
1971- .mapIntoAnnot(defn.IntoParamAnnot , null ),
1972+ _.translateFromRepeated(toArray = isJava),
19721973 result1, isContextual)
19731974 if mt.hasErasedParams then
19741975 defn.PolyFunctionOf (mt)
@@ -2016,38 +2017,6 @@ object Types extends TypeUtils {
20162017 case _ => this
20172018 }
20182019
2019- /** A mapping between mapping one kind of into annotation to another or
2020- * dropping into annotations.
2021- * @param from the into annotation to map
2022- * @param to either the replacement annotation symbol, or `null`
2023- * in which case the `from` annotations are dropped.
2024- */
2025- def mapIntoAnnot (from : ClassSymbol , to : ClassSymbol | Null )(using Context ): Type = this match
2026- case self @ AnnotatedType (tp, annot) =>
2027- val tp1 = tp.mapIntoAnnot(from, to)
2028- if annot.symbol == from then
2029- if to == null then tp1
2030- else AnnotatedType (tp1, Annotation (to, annot.tree.span))
2031- else self.derivedAnnotatedType(tp1, annot)
2032- case AppliedType (tycon, arg :: Nil ) if tycon.typeSymbol == defn.RepeatedParamClass =>
2033- val arg1 = arg.mapIntoAnnot(from, to)
2034- if arg1 eq arg then this
2035- else AppliedType (tycon, arg1 :: Nil )
2036- case defn.FunctionOf (argTypes, resType, isContextual) =>
2037- val resType1 = resType.mapIntoAnnot(from, to)
2038- if resType1 eq resType then this
2039- else defn.FunctionOf (argTypes, resType1, isContextual)
2040- case RefinedType (parent, rname, mt : MethodOrPoly ) =>
2041- val mt1 = mt.mapIntoAnnot(from, to)
2042- if mt1 eq mt then this
2043- else RefinedType (parent.mapIntoAnnot(from, to), rname, mt1)
2044- case mt : MethodOrPoly =>
2045- mt.derivedLambdaType(resType = mt.resType.mapIntoAnnot(from, to))
2046- case tp : ExprType =>
2047- tp.derivedExprType(tp.resType.mapIntoAnnot(from, to))
2048- case _ =>
2049- this
2050-
20512020 /** The set of distinct symbols referred to by this type, after all aliases are expanded */
20522021 def coveringSet (using Context ): Set [Symbol ] =
20532022 (new CoveringSetAccumulator ).apply(Set .empty[Symbol ], this )
@@ -4222,11 +4191,11 @@ object Types extends TypeUtils {
42224191
42234192 /** Produce method type from parameter symbols, with special mappings for repeated
42244193 * and inline parameters:
4225- * - replace @repeated annotations on Seq or Array types by <repeated> types
4194+ * - replace ` @repeated` annotations on Seq or Array types by <repeated> types
42264195 * - map into annotations to $into annotations
4227- * - add @inlineParam to inline parameters
4228- * - add @erasedParam to erased parameters
4229- * - wrap types of parameters that have an @allowConversions annotation with Into[_]
4196+ * - add ` @inlineParam` to inline parameters
4197+ * - add ` @erasedParam` to erased parameters
4198+ * - map `T @$into` types to `into[T]`
42304199 */
42314200 def fromSymbols (params : List [Symbol ], resultType : Type )(using Context ): MethodType =
42324201 apply(params.map(_.name.asTermName))(
@@ -4240,9 +4209,7 @@ object Types extends TypeUtils {
42404209 def addAnnotation (tp : Type , cls : ClassSymbol , param : Symbol ): Type = tp match
42414210 case ExprType (resType) => ExprType (addAnnotation(resType, cls, param))
42424211 case _ => AnnotatedType (tp, Annotation (cls, param.span))
4243- var paramType = pinfo
4244- .annotatedToRepeated
4245- .mapIntoAnnot(defn.IntoAnnot , defn.IntoParamAnnot )
4212+ var paramType = TypeOps .revealInto(pinfo).annotatedToRepeated
42464213 if param.is(Inline ) then
42474214 paramType = addAnnotation(paramType, defn.InlineParamAnnot , param)
42484215 if param.is(Erased ) then
0 commit comments