summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-11-07 13:18:40 +0100
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-11-07 17:51:06 +0100
commitcbca4943884d23f0a588471ea68e733170d069af (patch)
tree669cebd9475e9ca19aac9f6920a69a04fde77fdf /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parenta34be74e8f2630f1862a34e538cbe1162d279e5e (diff)
downloadscala-cbca4943884d23f0a588471ea68e733170d069af.tar.gz
scala-cbca4943884d23f0a588471ea68e733170d069af.tar.bz2
scala-cbca4943884d23f0a588471ea68e733170d069af.zip
[sammy] support repeated params
Generate correct trees to refer to repeated params using `gen.paramToArg`. Based on retronym's review feedback.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 5eee60031e..258029cbd7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2726,7 +2726,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
* which must be fully defined. Would be nice to have some kind of mechanism to insert type vars in a block of code,
* and have the instantiation of the first occurrence propagate to the rest of the block.
*
- * TODO: repeated and by-name params
+ * TODO: by-name params
* scala> trait LazySink { def accept(a: => Any): Unit }
* defined trait LazySink
*
@@ -2741,19 +2741,6 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
* scala> f.accept(println("!"))
* !
* !
- * This looks like a bug:
- *
- * scala> trait RepeatedSink { def accept(a: Any*): Unit }
- * defined trait RepeatedSink
- *
- * scala> val f: RepeatedSink = (a) => println(a)
- * f: RepeatedSink = $anonfun$1@4799abc2
- *
- * scala> f.accept(1)
- * WrappedArray(WrappedArray(1))
- *
- * scala> f.accept(1, 2)
- * WrappedArray(WrappedArray(1, 2))
*/
def synthesizeSAMFunction(sam: Symbol, fun: Function, resPt: Type, samClassTp: Type, mode: Mode): Tree = {
// assert(fun.vparams forall (vp => isFullyDefined(vp.tpt.tpe))) -- by construction, as we take them from sam's info
@@ -2848,7 +2835,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
Nil,
List(fun.vparams),
TypeTree(samMethTp.finalResultType) setPos sampos.focus,
- Apply(Ident(bodyName), fun.vparams map (p => Ident(p.name)))
+ Apply(Ident(bodyName), fun.vparams map gen.paramToArg)
)
val serializableParentAddendum =