diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2009-03-24 16:19:25 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2009-03-24 16:19:25 +0000 |
commit | a2bfe6eef5294f9bd6347ab98c171db4bc6fe78d (patch) | |
tree | d1c26e6cfde619d0a9849ade49557b180d40c759 | |
parent | 66f28b5aa86372c16219f9acdaf9648b93fe133f (diff) | |
download | scala-a2bfe6eef5294f9bd6347ab98c171db4bc6fe78d.tar.gz scala-a2bfe6eef5294f9bd6347ab98c171db4bc6fe78d.tar.bz2 scala-a2bfe6eef5294f9bd6347ab98c171db4bc6fe78d.zip |
Fixed #1675
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala | 14 | ||||
-rw-r--r-- | test/files/pos/t1675.scala | 11 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala index c9d5a2ad2d..05a496cdce 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala @@ -311,16 +311,18 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT } /** Adapt the given argument in call to protected member. - * Adaptation means adding a cast to a path-dependent type, for instance + * Adaptation may add a cast to a path-dependent type, for instance * * def prot$m(obj: Outer)(x: Inner) = obj.m(x.asInstanceOf[obj.Inner]). * * such a cast might be necessary when m expects an Outer.this.Inner (the * outer of 'obj' and 'x' have to be the same). This restriction can't be * expressed in the type system (but is implicit when defining method m). + * + * Also, it calls using repeated parameters are ascribed with ': _*' */ private def makeArg(v: Symbol, obj: Symbol, expectedTpe: Type): Tree = { - val res = Ident(v) + var res: Tree = Ident(v) val sym = obj.tpe.typeSymbol var ownerClass: Symbol = NoSymbol @@ -330,13 +332,15 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT if (sym.isSubClass(ownerClass)) true else false case _ => false } + if (v.info.typeSymbol == definitions.RepeatedParamClass) { + res = gen.wildcardStar(res) + log("adapted to wildcard star: " + res) + } if (isDependentType) { val preciseTpe = expectedTpe.asSeenFrom(singleType(NoPrefix, obj), ownerClass) //typeRef(singleType(NoPrefix, obj), v.tpe.symbol, List()) TypeApply(Select(res, definitions.Any_asInstanceOf), List(TypeTree(preciseTpe))) - } - else - res + } else res } /** For a path-dependent type, return the this type. */ diff --git a/test/files/pos/t1675.scala b/test/files/pos/t1675.scala new file mode 100644 index 0000000000..dcf1bf5a08 --- /dev/null +++ b/test/files/pos/t1675.scala @@ -0,0 +1,11 @@ +package a +object Foo extends pack.Bar { + for(i <- 0 to 10) { + test("") + } +} +package pack { + class Bar { + protected def test(s: String*) {} + } +} |