It turns out that Tailcalls will perform "partial elimination" in
situations such as:
@annotation.tailrec final def f(x: Int): Int = f(f(x))
The outer call to f1 becomes a jump, but the inner call remains
as it was. I implemented @tailrec under the impression that if
the optimization had taken place, it had gone all the way. So
this is now fixed with a direct examination of the rewritten tree.
While I was in there I threw in some improved error reporting:
the error positioning is now on the call which is not in tail
position rather than the method declaration.
Closes#4135, no review.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23941 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
scala> implicitly[CanBuildFrom[String, Int, List[List[Int]]]]
<console>:10: error: Cannot construct a collection of type List[List[Int]]
with elements of type Int based on a collection of type List[List[Int]].
implicitly[CanBuildFrom[String, Int, List[List[Int]]]]
^
No review.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23940 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
on a mutable collection. Thanks to richard emberson for finding it.
I used what git fu I have searching for others, but no dice. No review.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23939 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
abstracts the common code out of the TrieIterators in HashMap
and HashSet. When I raised this flag to find out if anyone would
open fire, all was quiet on the western front. Although I wouldn't
want to write code like this as an everyday thing, I think it serves
as a nice showcase for some of the abstraction challenges we're up
against: performance looks the same and I will never again have to
fix the same bug in two places. Review by rompf.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23934 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
(Another fine reason for us to push all the way to using sbt
is that we wouldn't unwittingly break it, as that change and
my recent jline changes both did.) Maybe there is a better
way to do what's in this one: review by dragos.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23933 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
I believe this is the right change. The modifications in parallel
and actors were a result of the files failing to compile after
the change to allOverriddenSymbols. (I am taking the position
that that aspect is a feature.) Review by malayeri, odersky.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23926 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
def isRootOrEmptyPackageClass(s: Symbol) = s.isRoot || s.isEmptyPackageClass
def isRootOrEmpty = (this == EmptyPackageClass) || (this == RootClass)
def isEffectiveRoot = isRoot || isEmptyPackageClass
// last one actually not quite identical
def isUnqualified(n: Name) = n match { case nme.ROOT | nme.EMPTY_PACKAGE_NAME => true ; case _ => false }
I was responsible for at least half of these. Now it's only isEffectiveRoot.
Also, I have always found it warty that we have to specify Nothing and Any
as upper bounds. I gave the TypeBounds companion object a few obvious methods:
def empty: TypeBounds = apply(NothingClass.tpe, AnyClass.tpe)
def upper(hi: Type): TypeBounds = apply(NothingClass.tpe, hi)
def lower(lo: Type): TypeBounds = apply(lo, AnyClass.tpe)
It's a lovable patch. No review.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23924 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
me the pity of Tiark, who sent this monster patch which he probably
dashed off before the appetizers had been cleared away. All the steak
is his but I threw in a little sizzle so I could feel like a part
of things. It knocks about a bazillion miniseconds off the time
spent in implicit search.
This is the same patch martin already endorsed, give or take several
hundred lines of diff, so I will say no review, even though I know it
will be hard to look away. I trimmed most of the "speculative code" (that
is, the commented out bits) because it's getting awfully busy along those
sidelines. I will preserve the ideas in some more structured form.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23911 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
sbt for a while. This changes jline not to install it, and alters
the scala startup script to trap exit and re-enable echo on
recognizably unix platforms. In addition it no longer installs
a shutdown hook to flush the repl history to disk, instead flushing
after every line.
Any bash reviewers out there? Unless someone raises a hand, no review.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23909 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
// Cannot be created directly; one should always use `singleType' for creation.
// Cannot be created directly; one should always use `refinedType' for creation.
// Cannot be created directly; one should always use `typeRef' for creation. (@M: Otherwise hashing breaks)
This involved altering about 15 locations. If there was a
rhyme or a reason as to why those particular places were entitled
to ignore the "always" dictate, I trust it will emerge from some
corner now. Until then, it's nice to see some code following its
official marching orders. Review by odersky.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23906 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
(I counted on my fingers) during the compilation of quick.lib and
quick.comp by reusing an empty Array[Object]. (And another ten
million or so after quick.comp, but who is counting.) It sounds
like it would make a bigger difference than it does. Also
eliminated some strange indirection from WrappedArray to
LowPriorityImplicits back to WrappedArray on each creation.
Review by dragos.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23903 5e8d7ff9-d8ef-0310-90f0-a4852d11357a