You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
% scalac sandbox/test.scala
sandbox/test.scala:6: error: type mismatch;
found : c.f.type (with underlying type Any*)
required: Nothing
def test1(c: C): Nothing = c.f
^
sandbox/test.scala:7: error: type mismatch;
found : Seq[Any]
required: Nothing
def test2(c: C): Nothing = c.g
^
two errors found
% ./bin/dotc sandbox/test.scala
sandbox/test.scala:6: error: type mismatch:
found : scala.collection.Seq[Any] @Repeated(c.f)
required: Nothing
def test1(c: C): Nothing = c.f
^
sandbox/test.scala:7: error: type mismatch:
found : scala.collection.Seq[Any] @Repeated
required: Nothing
def test2(c: C): Nothing = c.g
^
two errors found
I believe that both dotc and scalac are wrong here to give the param accessor the type Any*/ Any @Repeated. Instead, the repeated-ness of the type should be dropped, in the same way that it is when computing the type of the explicity defined accessor g.
Note: By name constructor parameters are not allowed to to have the val modifier (or, equivalently, be used as case class params), otherwise we would need to test that out as well.
I don't see why. @Repeated is an annotation. The type for @Repeated method parameters gets transformed into an ExprType. But I see nothing wrong with leaving the annotation on the Seq type.
I believe that both dotc and scalac are wrong here to give the param accessor the type
Any*
/Any @Repeated
. Instead, the repeated-ness of the type should be dropped, in the same way that it is when computing the type of the explicity defined accessorg
.Followup from #617, /cc @smarter
The text was updated successfully, but these errors were encountered: