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] {
277
277
* of `scala.Singleton`, widen `tp`.
278
278
* 2. If `tp` is a union type, yet upper bound is not a union type,
279
279
* 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).
280
283
*/
281
284
def widenInferred (tp : Type , bound : Type )(implicit actx : AbstractContext ): Type = {
282
285
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 =>
1320
1320
// Widen rhs type and eliminate `|' but keep ConstantTypes if
1321
1321
// definition is inline (i.e. final in Scala2) and keep module singleton types
1322
1322
// 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).
1323
1325
def widenRhs (tp : Type ): Type = {
1324
1326
val tp1 = tp.widenTermRefExpr match {
1325
1327
case ctp : ConstantType if isInlineVal => ctp
You can’t perform that action at this time.
0 commit comments