Skip to content

Commit 53db738

Browse files
committed
Merge branch 'master' of git://github.com/scala/scala into issue/5623
2 parents 4f693ed + 9fe251e commit 53db738

File tree

22 files changed

+123
-41
lines changed

22 files changed

+123
-41
lines changed

src/actors/scala/actors/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package scala
77
* == Guide ==
88
*
99
* A detailed guide for the actors library is available
10-
* [[http://www.scala-lang.org/docu/files/actors-api/actors_api_guide.html#]].
10+
* [[http://docs.scala-lang.org/overviews/core/actors.html]].
1111
*
1212
* == Getting Started ==
1313
*

src/compiler/scala/tools/nsc/doc/html/page/Template.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ class Template(universe: doc.Universe, tpl: DocTemplateEntity) extends HtmlPage
511511
<dt>See also</dt>
512512
<dd>{
513513
val seeXml:List[scala.xml.NodeSeq]=(for(see <- comment.see ) yield <span class="cmt">{bodyToHtml(see)}</span> )
514-
seeXml.reduceLeft(_ ++ Text(", ") ++ _)
514+
seeXml.reduceLeft(_ ++ _)
515515
}</dd>
516516
} else NodeSeq.Empty
517517

src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,18 @@ trait EtaExpansion { self: Analyzer =>
6363
* @return ...
6464
*/
6565
def liftoutPrefix(tree: Tree): Tree = {
66-
def liftout(tree: Tree): Tree =
66+
def liftout(tree: Tree, byName: Boolean): Tree =
6767
if (treeInfo.isExprSafeToInline(tree)) tree
6868
else {
6969
val vname: Name = freshName()
7070
// Problem with ticket #2351 here
7171
defs += atPos(tree.pos) {
72-
ValDef(Modifiers(SYNTHETIC), vname.toTermName, TypeTree(), tree)
72+
val rhs = if (byName) Function(List(), tree) else tree
73+
ValDef(Modifiers(SYNTHETIC), vname.toTermName, TypeTree(), rhs)
74+
}
75+
atPos(tree.pos.focus) {
76+
if (byName) Apply(Ident(vname), List()) else Ident(vname)
7377
}
74-
Ident(vname) setPos tree.pos.focus
7578
}
7679
val tree1 = tree match {
7780
// a partial application using named arguments has the following form:
@@ -85,11 +88,14 @@ trait EtaExpansion { self: Analyzer =>
8588
defs ++= stats
8689
liftoutPrefix(fun)
8790
case Apply(fn, args) =>
88-
treeCopy.Apply(tree, liftoutPrefix(fn), args mapConserve (liftout)) setType null
91+
val byName = fn.tpe.params.map(p => definitions.isByNameParamType(p.tpe))
92+
// zipAll: with repeated params, there might be more args than params
93+
val newArgs = args.zipAll(byName, EmptyTree, false) map { case (arg, byN) => liftout(arg, byN) }
94+
treeCopy.Apply(tree, liftoutPrefix(fn), newArgs) setType null
8995
case TypeApply(fn, args) =>
9096
treeCopy.TypeApply(tree, liftoutPrefix(fn), args) setType null
9197
case Select(qual, name) =>
92-
treeCopy.Select(tree, liftout(qual), name) setSymbol NoSymbol setType null
98+
treeCopy.Select(tree, liftout(qual, false), name) setSymbol NoSymbol setType null
9399
case Ident(name) =>
94100
tree
95101
}

src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,20 +158,20 @@ trait NamesDefaults { self: Analyzer =>
158158
// it stays in Vegas: SI-5720, SI-5727
159159
qual changeOwner (blockTyper.context.owner -> sym)
160160

161+
val newQual = atPos(qual.pos.focus)(blockTyper.typedQualifier(Ident(sym.name)))
161162
var baseFunTransformed = atPos(baseFun.pos.makeTransparent) {
162-
// don't use treeCopy: it would assign opaque position.
163-
val f = Select(gen.mkAttributedRef(sym), selected)
164-
.setType(baseFun1.tpe).setSymbol(baseFun1.symbol)
163+
// setSymbol below is important because the 'selected' function might be overloaded. by
164+
// assigning the correct method symbol, typedSelect will just assign the type. the reason
165+
// to still call 'typed' is to correctly infer singleton types, SI-5259.
166+
val f = blockTyper.typedOperator(Select(newQual, selected).setSymbol(baseFun1.symbol))
165167
if (funTargs.isEmpty) f
166168
else TypeApply(f, funTargs).setType(baseFun.tpe)
167169
}
168170

169171
val b = Block(List(vd), baseFunTransformed)
170172
.setType(baseFunTransformed.tpe).setPos(baseFun.pos)
171-
172-
val defaultQual = Some(atPos(qual.pos.focus)(gen.mkAttributedRef(sym)))
173173
context.namedApplyBlockInfo =
174-
Some((b, NamedApplyInfo(defaultQual, defaultTargs, Nil, blockTyper)))
174+
Some((b, NamedApplyInfo(Some(newQual), defaultTargs, Nil, blockTyper)))
175175
b
176176
}
177177

src/library/scala/Array.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,8 @@ object Array extends FallbackArrayBuilding {
438438
* Arrays make use of two common pieces of Scala syntactic sugar, shown on lines 2 and 3 of the above
439439
* example code.
440440
* Line 2 is translated into a call to `apply(Int)`, while line 3 is translated into a call to
441-
* `update(Int, T)`. For more information on these transformations, see the
442-
* [[http://www.scala-lang.org/docu/files/ScalaReference.pdf Scala Language Specification v2.8]], Sections
443-
* 6.6 and 6.15 respectively.
444-
*
441+
* `update(Int, T)`.
442+
*
445443
* Two implicit conversions exist in [[scala.Predef]] that are frequently applied to arrays: a conversion
446444
* to [[scala.collection.mutable.ArrayOps]] (shown on line 4 of the example above) and a conversion
447445
* to [[scala.collection.mutable.WrappedArray]] (a subtype of [[scala.collections.Seq]]).
@@ -465,8 +463,9 @@ object Array extends FallbackArrayBuilding {
465463
*
466464
* @author Martin Odersky
467465
* @version 1.0
468-
* @see [[http://www.scala-lang.org/docu/files/collections-api/collections_38.html#anchor "The Scala 2.8 Collections' API"]]
469-
* section on `Array` by Martin Odersky for more information.
466+
* @see [[http://www.scala-lang.org/docu/files/ScalaReference.pdf Scala Language Specification]], for in-depth information on the transformations the Scala compiler makes on Arrays (Sections 6.6 and 6.15 respectively.)
467+
* @see [[http://docs.scala-lang.org/sips/completed/scala-2-8-arrays.html "Scala 2.8 Arrays"]] the Scala Improvement Document detailing arrays since Scala 2.8.
468+
* @see [[http://docs.scala-lang.org/overviews/collections/arrays.html "The Scala 2.8 Collections' API"]] section on `Array` by Martin Odersky for more information.
470469
* @define coll array
471470
* @define Coll `Array`
472471
* @define orderDependent

src/library/scala/Function.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ object Function {
3737
* @param f a function `T => Option[R]`
3838
* @return a partial function defined for those inputs where
3939
* f returns `Some(_)` and undefined where `f` returns `None`.
40-
* @see [[scala.PartialFunction#lift]]
40+
* @see [[scala.PartialFunction]], method `lift`.
4141
*/
4242
def unlift[T, R](f: T => Option[R]): PartialFunction[T, R] = PartialFunction.unlifted(f)
4343

src/library/scala/Predef.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,14 +451,14 @@ object Predef extends LowPriorityImplicits {
451451
}
452452

453453
/** A type for which there is always an implicit value.
454-
* @see fallbackCanBuildFrom in Array.scala
454+
* @see [[scala.Array$]], method `fallbackCanBuildFrom`
455455
*/
456456
class DummyImplicit
457457

458458
object DummyImplicit {
459459

460460
/** An implicit value yielding a `DummyImplicit`.
461-
* @see fallbackCanBuildFrom in Array.scala
461+
* @see [[scala.Array$]], method `fallbackCanBuildFrom`
462462
*/
463463
implicit def dummyImplicit: DummyImplicit = new DummyImplicit
464464
}

src/library/scala/collection/IterableLike.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ self =>
148148
}
149149

150150
/** Partitions elements in fixed size ${coll}s.
151-
* @see Iterator#grouped
151+
* @see [[scala.collection.Iterator]], method `grouped`
152152
*
153153
* @param size the number of elements per group
154154
* @return An iterator producing ${coll}s of size `size`, except the
@@ -163,7 +163,7 @@ self =>
163163

164164
/** Groups elements in fixed size blocks by passing a "sliding window"
165165
* over them (as opposed to partitioning them, as is done in grouped.)
166-
* @see Iterator#sliding
166+
* @see [[scala.collection.Iterator]], method `sliding`
167167
*
168168
* @param size the number of elements per group
169169
* @return An iterator producing ${coll}s of size `size`, except the
@@ -174,7 +174,7 @@ self =>
174174

175175
/** Groups elements in fixed size blocks by passing a "sliding window"
176176
* over them (as opposed to partitioning them, as is done in grouped.)
177-
* @see Iterator#sliding
177+
* @see [[scala.collection.Iterator]], method `sliding`
178178
*
179179
* @param size the number of elements per group
180180
* @param step the distance between the first elements of successive

src/library/scala/collection/Iterator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ trait Iterator[+A] extends TraversableOnce[A] {
824824

825825
/** Creates a buffered iterator from this iterator.
826826
*
827-
* @see BufferedIterator
827+
* @see [[scala.collection.BufferedIterator]]
828828
* @return a buffered iterator producing the same values as this iterator.
829829
* @note Reuse: $consumesAndProducesIterator
830830
*/

src/library/scala/collection/SeqLike.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
566566

567567
/** Sorts this $Coll according to the Ordering which results from transforming
568568
* an implicitly given Ordering with a transformation function.
569-
* @see scala.math.Ordering
569+
* @see [[scala.math.Ordering]]
570570
* $willNotTerminateInf
571571
* @param f the transformation function mapping elements
572572
* to some other domain `B`.
@@ -591,7 +591,7 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
591591
* The sort is stable. That is, elements that are equal (as determined by
592592
* `lt`) appear in the same order in the sorted sequence as in the original.
593593
*
594-
* @see scala.math.Ordering
594+
* @see [[scala.math.Ordering]]
595595
*
596596
* @param ord the ordering to be used to compare elements.
597597
* @return a $coll consisting of the elements of this $coll
@@ -852,7 +852,7 @@ object SeqLike {
852852
/** Finds a particular index at which one sequence occurs in another sequence.
853853
* Like `indexOf`, but finds the latest occurrence rather than earliest.
854854
*
855-
* @see SeqLike#indexOf
855+
* @see [[scala.collection.SeqLike], method `indexOf`
856856
*/
857857
def lastIndexOf[B](
858858
source: Seq[B], sourceOffset: Int, sourceCount: Int,

0 commit comments

Comments
 (0)