summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala
Commit message (Collapse)AuthorAgeFilesLines
* [vpm] TODO note: make unapply type list stricterAdriaan Moors2012-03-201-0/+5
| | | | | | | | 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
* Merge branch 'master' into merge-inlinePaul Phillips2012-03-141-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Whitespace commit.Paul Phillips2012-02-291-1/+1
| | | | | | | | | | | | | | 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.
* | Mostly eliminated ScalaObject.Paul Phillips2012-02-031-2/+1
|/
* Intercept assert and require calls.Paul Phillips2012-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Optimizing TypeRef, starting with Symbols.Paul Phillips2012-01-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* More consistent use of Names.Paul Phillips2012-01-051-3/+4
| | | | | | | | 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.
* Consolidated misc collections helper methods.Paul Phillips2012-01-051-4/+4
| | | | Streamlining some of our more common operations.
* ProductN, and method synthesis toolbox.Paul Phillips2011-09-261-5/+5
| | | | | | | | | | | | | | | | | | | | | | - 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.
* close #4441. no reviewLukas Rytz2011-05-101-1/+1
|
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* This commit is about not calling .length or .si...Paul Phillips2010-12-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 f...Paul Phillips2010-11-041-16/+14
| | | | | | | | | | | 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.
* The second piece of the flags patch.Paul Phillips2010-10-131-1/+1
| | | | | | | | | | | 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.
* close #3667.Lukas Rytz2010-08-051-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | 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 paramet...Paul Phillips2010-07-021-2/+5
| | | | | | Fail more gracefully on > 22 case class parameters. Closes #3631, no review.
* companion objects of case classes know their name.Lukas Rytz2010-06-291-5/+12
|
* Swapped the order of the arguments to returning...Paul Phillips2010-05-151-6/+6
| | | | | | | | | | | 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 r...Antonio Cunei2010-05-121-1/+0
| | | | | Removed more than 3400 svn '$Id' keywords and related junk.
* Companion objects of case classes extend Abstra...Iulian Dragos2010-04-121-1/+1
| | | | | | | 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.
* Cosmetic renamings. No review.Martin Odersky2010-04-121-3/+3
|
* Modification to the last patch to return None/f...Paul Phillips2010-03-061-1/+2
| | | | | | Modification to the last patch to return None/false rather than throwing the MatchError. No review.
* Fixes for #3126.Paul Phillips2010-03-061-2/+2
| | | | | | null, and thrown MatchErrors don't NPE trying to stringify null. No review.
* further speed improvements by eliminating most ...Martin Odersky2010-01-061-2/+2
| | | | | | | 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.
* Updated copyright notices to 2010Antonio Cunei2009-12-071-1/+1
|
* A selection of cleanups stemming from recent in...Paul Phillips2009-10-211-0/+6
| | | | | A selection of cleanups stemming from recent investigations.
* Short/Byte/Char/Int scrutinees will now be comp...Paul Phillips2009-09-251-2/+2
| | | | | | | 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.)
* rewrite of positions in compilerMartin Odersky2009-07-301-9/+9
|
* switch to unnested packages.Martin Odersky2009-07-241-1/+2
|
* And more pattern matcher refinement.Paul Phillips2009-07-061-1/+0
|
* refined range positions some more; eliminated A...Martin Odersky2009-07-021-2/+2
| | | | | refined range positions some more; eliminated Array.withDims
* Mostly rewriting Unapplies as I work my way thr...Paul Phillips2009-06-301-110/+90
| | | | | | Mostly rewriting Unapplies as I work my way through all the pattern matcher related code.
* (1) some changes to interactive compiler interf...Martin Odersky2009-06-181-2/+2
| | | | | | (1) some changes to interactive compiler interface. 2) added (symbol.hasTypeAt 3) Added flatten/transpose/unzip to TraversableClass
* Named and default argumentsLukas Rytz2009-05-301-3/+34
| | | | | | | - MethodTypes now have (params: List[Symbol]) - "copy"-methods for case classes - the "copy" object in the compiler is now called "treeCopy"
* more work on rangepositions.Martin Odersky2009-05-281-1/+0
|
* changed overloaing resolution to make Builders ...Martin Odersky2009-03-301-5/+10
| | | | | | | changed overloaing resolution to make Builders work. generalized companion object generation in Namers. Fixed a problem in Types that made the collection build crash.
* Updated (all) copyright notices to 2009Antonio Cunei2009-01-131-1/+1
|
* fixed #807. More stuff for virtual classes.Martin Odersky2008-05-301-12/+7
|
* (1) Removed generation of $tag method for inter...Martin Odersky2008-04-071-1/+1
| | | | | | (1) Removed generation of $tag method for interfaces (2) improved type inference for clsoures (3) redesign of CharSequence and regex.
* fixed build problem.Martin Odersky2008-02-131-2/+1
|
* removed deprecated class util.Fluidmichelou2008-02-131-0/+1
|
* change to caseclass extractors with varargsMartin Odersky2008-02-131-6/+7
|
* fixed build problem for sbaz; fixed one half of...Martin Odersky2008-02-111-1/+1
| | | | | fixed build problem for sbaz; fixed one half of #470
* case classes can now inherit from case classes.Martin Odersky2008-01-251-2/+8
|
* build target is now 1.5Martin Odersky2008-01-171-1/+87
| | | | | | case classes now generate objects not factory methods. some small cleanups for type inference
* Changed name of typechecker/UnApply.scala to Un...mihaylov2007-09-021-0/+95
Changed name of typechecker/UnApply.scala to Unapply.scala to match the name of the trait inside and prevent unnecessary re-compilation