Skip to content

Commit dde9740

Browse files
committed
Fix recognition for byname varargs under -Ycc
1 parent 1a0908c commit dde9740

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,10 @@ object Types {
18721872
def dropRepeatedAnnot(using Context): Type = dropAnnot(defn.RepeatedAnnot)
18731873

18741874
def annotatedToRepeated(using Context): Type = this match {
1875-
case tp @ ExprType(tp1) => tp.derivedExprType(tp1.annotatedToRepeated)
1875+
case tp @ ExprType(tp1) =>
1876+
tp.derivedExprType(tp1.annotatedToRepeated)
1877+
case self @ AnnotatedType(tp, annot) if annot matches defn.RetainsByNameAnnot =>
1878+
self.derivedAnnotatedType(tp.annotatedToRepeated, annot)
18761879
case AnnotatedType(tp, annot) if annot matches defn.RepeatedAnnot =>
18771880
val typeSym = tp.typeSymbol.asClass
18781881
assert(typeSym == defn.SeqClass || typeSym == defn.ArrayClass)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def typeMismatch(addenda: => String*) = ???
2+
class TypeMismatch(addenda: => String*)
3+
4+
def test =
5+
typeMismatch("foo")
6+
typeMismatch("foo", "bar")
7+
TypeMismatch("foo")
8+
TypeMismatch("foo", "bar")
9+

0 commit comments

Comments
 (0)