File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -277,6 +277,9 @@ trait ConstraintHandling[AbstractContext] {
277277 * of `scala.Singleton`, widen `tp`.
278278 * 2. If `tp` is a union type, yet upper bound is not a union type,
279279 * approximate the union type from above by an intersection of all common base types.
280+ *
281+ * At this point we also drop the @Repeated annotation to avoid inferring type arguments with it,
282+ * as those could leak the annotation to users (see run/inferred-repeated-result).
280283 */
281284 def widenInferred (tp : Type , bound : Type )(implicit actx : AbstractContext ): Type = {
282285 def isMultiSingleton (tp : Type ): Boolean = tp.stripAnnots match {
Original file line number Diff line number Diff line change @@ -1320,6 +1320,8 @@ class Namer { typer: Typer =>
13201320 // Widen rhs type and eliminate `|' but keep ConstantTypes if
13211321 // definition is inline (i.e. final in Scala2) and keep module singleton types
13221322 // instead of widening to the underlying module class types.
1323+ // We also drop the @Repeated annotation here to avoid leaking it in method result types
1324+ // (see run/inferred-repeated-result).
13231325 def widenRhs (tp : Type ): Type = {
13241326 val tp1 = tp.widenTermRefExpr match {
13251327 case ctp : ConstantType if isInlineVal => ctp
You can’t perform that action at this time.
0 commit comments