| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
when an unapply returns Option[T] where T is some ProductN, does that mean the unapply
returns 1 result, i.e., that T, or did it mean to return N results?
to disambiguate, falling back to stricter spec-adherence, which requires T be exactly TupleN for N results
for now, allow extractor result to be any product, not just tuple
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
lib/scala-compiler.jar.desired.sha1
lib/scala-library-src.jar.desired.sha1
lib/scala-library.jar.desired.sha1
src/compiler/scala/reflect/internal/Definitions.scala
src/compiler/scala/reflect/internal/Importers.scala
src/compiler/scala/reflect/internal/Symbols.scala
src/compiler/scala/reflect/internal/Trees.scala
src/compiler/scala/reflect/internal/Types.scala
src/compiler/scala/tools/nsc/Global.scala
src/compiler/scala/tools/nsc/transform/Erasure.scala
src/compiler/scala/tools/nsc/transform/LiftCode.scala
src/compiler/scala/tools/nsc/transform/UnCurry.scala
src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
src/compiler/scala/tools/nsc/typechecker/Typers.scala
test/files/run/programmatic-main.check
test/files/speclib/instrumented.jar.desired.sha1
|
| |
| |
| |
| |
| |
| |
| | |
Removed all the trailing whitespace to make eugene happier.
Will try to keep it that way by protecting at the merge level.
Left the tabs in place because they can't be uniformly changed
to spaces, some are 2, some are 4, some are 8, whee.
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
And abort calls, and unhandled exceptions, all so I can supplement the
error message with a little of the vast quantity of useful information
which we possess but do not reveal. "Details are sketchy," says the
officer tasked with investigating the crash, but no longer. Also took
the opportunity to eliminate a bunch of one-argument assertions and
requirements if I thought there was any chance I'd someday be facing
them on the wrong end of an incident.
Have you ever dreamed that instead of this experience:
% scalac -optimise <long list of files>
error: java.lang.AssertionError: assertion failed: Record Record(anonymous class JavaToScala$$anonfun$makeScalaPackage$1,Map()) does not contain a field value owner$1
Things could proceed more like this:
% scalac -optimise <long list of files>
error:
while compiling: src/compiler/scala/reflect/runtime/JavaToScala.scala
current phase: closelim
library version: version 2.10.0.rdev-4267-2012-01-25-gc94d342
compiler version: version 2.10.0.rdev-4270-2012-01-26-gd540ddf
reconstructed args: -Ydead-code -optimise -Yinline -Yclosure-elim -Yinline-handlers -d /tmp
error: java.lang.AssertionError: [etc]
You are not dreaming! IT'S ALL HAPPENING
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are too many potential optimizations unavailable to us due to the
lack of bright lines among different kinds of symbols. For instance the
difference between a TypeSymbol which represents a type alias and one
which represents an abstract type is only whether the DEFERRED flag
is set. This creates issues.
1) There are many (many) places where tests are performed on every symbol
which could be done more efficiently and (especially) more verifiably
correctly with polymorphism.
2) TypeRefs based on those symbols are also checking that flag
constantly, in perpetuity. A symbol created as an alias is never (to the
best of my knowledge) going to intentionally morph into one representing
an abstract type, nor vice versa.
3) One has no guarantees, because anyone can set or reset the DEFERRED
flag at any time.
So tackling more than one problem at once herein:
1) I created canonical symbol creation points which take the flags as
an argument, so that there can be a difference between initializing a
symbol's flags and setting/resetting them at arbitrary times.
2) I structured all the symbol creators to take arguments in the
same order, which is:
def newXXX(name: Name, ..., pos: Position = NoPosition, flags: Long = 0L)
(Where "..." is for those symbols which require something
beyond the name to create, such as a TypeSkolem's origin.)
The name is first because it's the only always required argument.
I left but deprecated the variations which take (pos, name).
3) I created subclasses of TypeRef based on the information which
should be stable from creation time onward:
- args or no args?
- abstract type, type alias, or class?
2x3 == 6 and that's how many subclasses of TypeRef there are now. So
now, for example, every TypeRef doesn't have to carry null symInfoCache
and thisInfoCache fields for the benefit of the minority which use them.
I still intend to realize the gain possible once we can evade the fields
for pre and args without losing pattern matcher efficiency.
|
|
|
|
|
|
|
|
| |
Several large helpings of tedium later, fewer strings are being
discarded like so much refuse. Some names now cache a String, but only
"named Names", so it's not very many and they pay for themselves pretty
quickly. Many fewer name-related implicit conversions now taking place.
A number of efficiency related measures.
|
|
|
|
| |
Streamlining some of our more common operations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Finished giving case classes a ProductN parent, and flipped it on. The
"finish" part involved not breaking existing code where case classes
manually extend the appropriate ProductN. (Like, Tuple 1-22.)
- Generalized most of SyntheticMethods to ease method creation and class
manipulation in general.
- Fixed bugs related to the above, like the fact that this used to be a
compile error:
scala> case class Foo() extends Serializable
<console>:28: error: trait Serializable is inherited twice
case class Foo() extends Serializable
^
It feels like there's a better way to eliminate the duplicate parents,
but after spending a lot of time chasing my tail in that peril-fraught
zone between namer and typer, I don't see an easy path to improve on
it. Closes SI-1799. For that modification to Typers, review by odersky.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit is about not calling .length or .size on Lists. Sometimes it
is unavoidable; not often. I created some methods for the compiler which
should probably be in the collections, which do things like test if two
sequences have the same length in a more efficient manner than calling
length on each.
Also, wouldn't it be wonderful to have some mechanism for finding these
issues in a more automated way. Like say an annotation:
LinearSeqLike {
@badjuju("Calling length on linear seqs is O(n)")
def length: Int = whee
}
Or since I imagine everyone thinks they're calling length with lists of
2 or 3, an optional runtime check which yelled if it sees you calling
length on a 600 element list, or worse:
var i = 0
while (i < myList.length) { // you don't want to see what this does
f(myList(i)) ; i += 1;
}
Uniformity of interface without uniformity of behavior leaves us with
traps. No review.
|
|
|
|
|
|
|
|
|
|
|
| |
Determined that half a dozen ways of checking for varargs and
by-name-ness in param lists exceeded the legal limit. Also assessed that
names which are only used as type names would be a lot easier to deal
with if we created them as type names up front. Performed the changes
implied by the preceding along with a partial cleanup on TreeInfo which
one can see hasn't had a good look in a long time. (And still hasn't.)
No review.
|
|
|
|
|
|
|
|
|
|
|
| |
into Modifiers and Symbol, but touches as little as possible beyond
that. It also includes some lengthy commentary (see HasFlags.scala) on
the state of the flags and some of the remaining issues. One more patch
which unfortunately but unavoidably touches almost every file in the
compiler lies ahead.
The floor is still open! But no review.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
scala> def ser(o: AnyRef) = new java.io.ObjectOutputStream(new java.io.ByteArrayOutputStream()).writeObject(o)
ser: (o: AnyRef)Unit
scala> @serializable class Outer {
| case class Inner(x: Int)
| }
defined class Outer
scala> val o = new Outer
o: Outer = Outer@34469729
scala> ser(new o.Inner(1))
scala> o.Inner // initialize the Inner$module field of o
res1: o.Inner.type = Inner
scala> ser(new o.Inner(1))
java.io.NotSerializableException: Outer$Inner$
review by extempore.
|
|
|
|
|
|
| |
Fail more gracefully on > 22 case class parameters. Closes #3631, no
review.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Swapped the order of the arguments to returning to make it consistent
with the way I've been using it for a long time. No review, how about
a question for nobody in particular instead: can we put this in the
library somewhere so I can stop looking around for it everywhere I go?
It's really handy.
def returning[T](x: T)(f: T => Unit): T = { f(x) ; x }
|
|
|
|
|
| |
Removed more than 3400 svn '$Id' keywords and related junk.
|
|
|
|
|
|
|
| |
Companion objects of case classes extend AbstractFunctionN instead of
FunctionN. This saves quite some space, since FunctionN methods are not
re-mixed in for each object.
|
| |
|
|
|
|
|
|
| |
Modification to the last patch to return None/false rather than throwing
the MatchError. No review.
|
|
|
|
|
|
| |
null, and thrown MatchErrors don't NPE trying to stringify null. No
review.
|
|
|
|
|
|
|
| |
further speed improvements by eliminating most uses of paramTypes.
Knocks off about 3% of typer time. Not overwhelming but still worth
doing. Review by rytz.
|
| |
|
|
|
|
|
| |
A selection of cleanups stemming from recent investigations.
|
|
|
|
|
|
|
| |
Short/Byte/Char/Int scrutinees will now be compiled into switches if all
cases are literals. (There remain many things which can prevent switch
creation.)
|
| |
|
| |
|
| |
|
|
|
|
|
| |
refined range positions some more; eliminated Array.withDims
|
|
|
|
|
|
| |
Mostly rewriting Unapplies as I work my way through all the pattern
matcher related code.
|
|
|
|
|
|
| |
(1) some changes to interactive compiler interface. 2) added
(symbol.hasTypeAt 3) Added flatten/transpose/unzip to TraversableClass
|
|
|
|
|
|
|
| |
- MethodTypes now have (params: List[Symbol])
- "copy"-methods for case classes
- the "copy" object in the compiler is now called "treeCopy"
|
| |
|
|
|
|
|
|
|
| |
changed overloaing resolution to make Builders work. generalized
companion object generation in Namers. Fixed a problem in Types that
made the collection build crash.
|
| |
|
| |
|
|
|
|
|
|
| |
(1) Removed generation of $tag method for interfaces (2) improved type
inference for clsoures (3) redesign of CharSequence and regex.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
fixed build problem for sbaz; fixed one half of #470
|
| |
|
|
|
|
|
|
| |
case classes now generate objects not factory methods. some small
cleanups for type inference
|
|
Changed name of typechecker/UnApply.scala to Unapply.scala to match the
name of the trait inside and prevent unnecessary re-compilation
|