@@ -445,9 +445,11 @@ object Types extends TypeUtils {
445445 def isRepeatedParam (using Context ): Boolean =
446446 typeSymbol eq defn.RepeatedParamClass
447447
448- /** Is this a parameter type that allows implicit argument converson? */
448+ /** Is this type of the form `compiletime.into[T]`, which means it can be the
449+ * target of an implicit converson without requiring a language import?
450+ */
449451 def isInto (using Context ): Boolean = this match
450- case AnnotatedType (_, annot ) => annot.symbol == defn.IntoParamAnnot
452+ case AppliedType ( tycon : TypeRef , arg :: Nil ) => defn.isInto(tycon.symbol)
451453 case _ => false
452454
453455 /** Is this the type of a method that has a repeated parameter type as
@@ -1965,8 +1967,7 @@ object Types extends TypeUtils {
19651967 }
19661968 defn.FunctionNOf (
19671969 mt.paramInfos.mapConserve:
1968- _.translateFromRepeated(toArray = isJava)
1969- .mapIntoAnnot(defn.IntoParamAnnot , null ),
1970+ _.translateFromRepeated(toArray = isJava),
19701971 result1, isContextual)
19711972 if mt.hasErasedParams then
19721973 defn.PolyFunctionOf (mt)
@@ -2014,38 +2015,6 @@ object Types extends TypeUtils {
20142015 case _ => this
20152016 }
20162017
2017- /** A mapping between mapping one kind of into annotation to another or
2018- * dropping into annotations.
2019- * @param from the into annotation to map
2020- * @param to either the replacement annotation symbol, or `null`
2021- * in which case the `from` annotations are dropped.
2022- */
2023- def mapIntoAnnot (from : ClassSymbol , to : ClassSymbol | Null )(using Context ): Type = this match
2024- case self @ AnnotatedType (tp, annot) =>
2025- val tp1 = tp.mapIntoAnnot(from, to)
2026- if annot.symbol == from then
2027- if to == null then tp1
2028- else AnnotatedType (tp1, Annotation (to, annot.tree.span))
2029- else self.derivedAnnotatedType(tp1, annot)
2030- case AppliedType (tycon, arg :: Nil ) if tycon.typeSymbol == defn.RepeatedParamClass =>
2031- val arg1 = arg.mapIntoAnnot(from, to)
2032- if arg1 eq arg then this
2033- else AppliedType (tycon, arg1 :: Nil )
2034- case defn.FunctionOf (argTypes, resType, isContextual) =>
2035- val resType1 = resType.mapIntoAnnot(from, to)
2036- if resType1 eq resType then this
2037- else defn.FunctionOf (argTypes, resType1, isContextual)
2038- case RefinedType (parent, rname, mt : MethodOrPoly ) =>
2039- val mt1 = mt.mapIntoAnnot(from, to)
2040- if mt1 eq mt then this
2041- else RefinedType (parent.mapIntoAnnot(from, to), rname, mt1)
2042- case mt : MethodOrPoly =>
2043- mt.derivedLambdaType(resType = mt.resType.mapIntoAnnot(from, to))
2044- case tp : ExprType =>
2045- tp.derivedExprType(tp.resType.mapIntoAnnot(from, to))
2046- case _ =>
2047- this
2048-
20492018 /** The set of distinct symbols referred to by this type, after all aliases are expanded */
20502019 def coveringSet (using Context ): Set [Symbol ] =
20512020 (new CoveringSetAccumulator ).apply(Set .empty[Symbol ], this )
@@ -4174,11 +4143,11 @@ object Types extends TypeUtils {
41744143
41754144 /** Produce method type from parameter symbols, with special mappings for repeated
41764145 * and inline parameters:
4177- * - replace @repeated annotations on Seq or Array types by <repeated> types
4146+ * - replace ` @repeated` annotations on Seq or Array types by <repeated> types
41784147 * - map into annotations to $into annotations
4179- * - add @inlineParam to inline parameters
4180- * - add @erasedParam to erased parameters
4181- * - wrap types of parameters that have an @allowConversions annotation with Into[_]
4148+ * - add ` @inlineParam` to inline parameters
4149+ * - add ` @erasedParam` to erased parameters
4150+ * - map `T @$into` types to `into[T]`
41824151 */
41834152 def fromSymbols (params : List [Symbol ], resultType : Type )(using Context ): MethodType =
41844153 apply(params.map(_.name.asTermName))(
@@ -4192,9 +4161,7 @@ object Types extends TypeUtils {
41924161 def addAnnotation (tp : Type , cls : ClassSymbol , param : Symbol ): Type = tp match
41934162 case ExprType (resType) => ExprType (addAnnotation(resType, cls, param))
41944163 case _ => AnnotatedType (tp, Annotation (cls, param.span))
4195- var paramType = pinfo
4196- .annotatedToRepeated
4197- .mapIntoAnnot(defn.IntoAnnot , defn.IntoParamAnnot )
4164+ var paramType = TypeOps .revealInto(pinfo).annotatedToRepeated
41984165 if param.is(Inline ) then
41994166 paramType = addAnnotation(paramType, defn.InlineParamAnnot , param)
42004167 if param.is(Erased ) then
0 commit comments