summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | Made Array manifests return type arguments.Paul Phillips2012-01-072-3/+3
| |_|/ / / |/| | | | | | | | | | | | | | Closes SI-3758.
* | | | | Remedy spurious bounds conformance failure.Paul Phillips2012-01-061-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Misters hkarg and hkparam have to work harder to see things from the same perspective, so they don't end up in a huff over bounds which were the same all along. Closes SI-5020, review by @moors.
* | | | | Output improvements for TypeVar tracing.Paul Phillips2012-01-061-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | You should really try this out, anonymous commit log reader. scala -Dscalac.debug.tvar
* | | | | Fix for crasher where Arrays meet abstract types.Paul Phillips2012-01-061-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This sort of thing was crashing. No longer. trait Fooz[Q <: Array[_]] { def f0(x: Q) = x.length }
* | | | | Fix for crasher during type inference.Paul Phillips2012-01-061-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Well, "fix" is pretty generous, how about "workaround". It does seem to do the job. Closes SI-4070, review by @moors.
* | | | | TypeVar tracing.Paul Phillips2012-01-062-85/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | % scala -Dscalac.debug.tvar scala> class Foo[CC[X] <: Traversable[X]] { def bar[T](xs: CC[T]) = xs.head } defined class Foo scala> new Foo bar List(1,2,3) [ create] ?CC ( In Foo[CC[X] <: Traversable[X]] ) [ create] ?CC ( In Foo[CC[X] <: Traversable[X]] ) [ setInst] Nothing ( In Foo[CC[X] <: Traversable[X]], CC=Nothing ) [ create] ?CC ( In Foo[CC[X] <: Traversable[X]] ) [ create] ?T ( In Foo[CC[X] <: Traversable[X]]#bar[T] ) [ create] ?A ( In List#apply[A] ) [ create] ?A ( In List#apply[A] ) [ setInst] Int ( In List#apply[A], A=Int ) [ create] ?CC ( In Foo[CC[X] <: Traversable[X]] ) [ create] ?T ( In Foo[CC[X] <: Traversable[X]]#bar[T] ) [ create] ?CC ( In Foo[CC[X] <: Traversable[X]] ) [ applyArgs] ?CC ( In Foo[CC[X] <: Traversable[X]], apply args ?T to CC ) [ setInst] List ( In Foo[CC[X] <: Traversable[X]], CC=List ) [ setInst] Int ( In Foo[CC[X] <: Traversable[X]]#bar[T], T=Int ) res0: Int = 1 Also, I gave TypeVar some polymorphism. Review by @moors.
* | | | | Error message improvement.Paul Phillips2012-01-051-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | % scalac files/neg/t5357.scala files/neg/t5357.scala:5: error: '=>' expected but ':' found. case A: N => 1 ^ one error found That's uggo! Now it says: % scalac files/neg/t5357.scala files/neg/t5357.scala:5: error: Pattern variables must start with a lower-case letter. (SLS 8.1.1.) case A: N => 1 ^ one error found
* | | | | Init order issue in Manifest toStrings.Paul Phillips2012-01-051-43/+22
| | | | | | | | | | | | | | | | | | | | | | | | | Making -Xcheckinit happy. Then cleaned up the anyval and phantom type manifests once in the neighborhood.
* | | | | Fix issue with higher-order type params.Paul Phillips2012-01-052-13/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I think I found an issue underlying more than one bit of sketchy behavior amongst CC[_] and friends. Plus, I managed to initialize TypeConstraints with the bounds of the originating type parameter. I feel like that should cause something nifty to happen somewhere, but I have seen neither confetti nor lasers in greater quantities than I usually do. Will keep my remaining eye out. Closes SI-5359, review by @moors.
* | | | | More consistent use of Names.Paul Phillips2012-01-0573-993/+1205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Merge branches 'findMemberRewrite-redux' and 'jan4-map-paramss'Paul Phillips2012-01-0510-47/+51
|\ \ \ \ \
| * | | | | Consolidated misc collections helper methods.Paul Phillips2012-01-0510-47/+51
| | | | | | | | | | | | | | | | | | | | | | | | Streamlining some of our more common operations.
* | | | | | Optimization in refchecks.Paul Phillips2012-01-052-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | Making the inherited java vararg check cheaper.
* | | | | | Optimization in genjvm.Paul Phillips2012-01-051-22/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Again trying to reduce the load on findMember by supplying flags to exclude.
* | | | | | Optimization in Constructors.Paul Phillips2012-01-051-19/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reworked some old code which was far too expensive for the job it was performing.
* | | | | | Optimizing findMember.Paul Phillips2012-01-052-11/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Profiled for the most frequent drinkers at the findMember tavern and gave them bracelets so they don't have to always be hassling the bartender.
* | | | | | Moved Origins into scala.reflect.internal.util.Paul Phillips2012-01-051-8/+8
|/ / / / / | | | | | | | | | | | | | | | | | | | | It's too handy and I can't reach it from key classes whose calls I want to profile.
* | | | | Fix in bytecode generation.Paul Phillips2012-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't generate invokeinterface instructions when the target is an interface but the method being called is defined in java.lang.Object. Android chokes on them, but regardless, invokevirtual will be faster and more pleasing to all the more discriminating vms.
* | | | | Don't mark mixed in methods as bridges.Paul Phillips2012-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometime during the signature-related chaos before 2.9.1, genjvm was modified to pin ACC_BRIDGE onto mixed-in methods. This isn't necessary to suppress the signature (which has already happened at that point) and has deleterious effects since many tools ignore bridge methods. Review by @odersky.
* | | | | Fix for NoSuchMethod in cleanup.Paul Phillips2012-01-041-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't assume that just because someone is calling x.toInt and x <: java.lang.Number, that it's a boxed primitive. Closes SI-5356.
* | | | | Don't infer protected members into lub refinements.Paul Phillips2012-01-041-12/+21
| | | | | | | | | | | | | | | | | | | | Following up to the previous, taking my own advice in SI-5352.
* | | | | Fix bugs with lubs.Paul Phillips2012-01-041-2/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Was not substituting before using fallback lub. I don't think it was hurting anything because the substitution is wrong anyway, since it gives up on f-bounds. (This is directly responsible for the malformed lubs.) But if it must fail, it shouldn't be letting A and Repr escape into the error message: scala> List(List(), Stream()) <console>:8: error: type mismatch; found : List[Nothing] required: scala.collection.immutable.LinearSeq[Nothing] with ..... scala.collection.LinearSeqOptimized[A,Repr]]]]] List(List(), Stream()) ^ Rather, like this: found : List[Nothing] required: scala.collection.immutable.LinearSeq[Nothing] with ..... scala.collection.LinearSeqOptimized[Nothing,scala.collection.immutable.Stream[Nothing]]]]]] Also, AbstractSeq and other not-public classes were appeaing in the errors, alerting me to the fact that it would happily infer a lub containing a type which cannot be referenced. scala> List(List(), Vector()) res1: List[scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing] ... So I excluded non-public types in lubList: scala> List(List(), Vector()) res0: List[scala.collection.immutable.Seq[Nothing]] = List(List(), Vector()) Finally, I added logging for recursive bounds. % scala -Ydebug scala> List(List(), Stream()) Encountered 2 recursive bounds while lubbing 2 types. type A in trait LinearSeqOptimized appears in the bounds of type Repr type Repr >: scala.this.Nothing <: collection.this.LinearSeqOptimized[A,Repr] type Repr in trait LinearSeqOptimized appears in its own bounds type Repr >: scala.this.Nothing <: collection.this.LinearSeqOptimized[A,Repr] Review by @moors.
* | | | | Closes SI-5354.Martin Odersky2012-01-042-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason why the test case compiled without error is pretty devious: When checking the `Foo.x' implicit, a CyclicReference error occurs which causes the alternative to be discarded. Why a CylicReference? Because the inferencer tries to decide whether the owner of `z` is a subclass of the owner od `x`. To do this, it computed the info of the owner of `z1`, which is not complete because no result type for `f1` was given. Hence a CyclicReference error. The fix is twofold: (1) We make isNonBottomSubClass smarter so that it always returns false if the symbol in question is not a type; hence the info need not be computed. (2) It's dubious to swallow CyclicReference errors anywhere, but I deemed it too risky to propagate them. But at least the CyclicReference is now logged if -Ylog-implicit is true. This hopefully spares future maintainers the same detective work I had to go through when digging this out.
* | | | | Added forall to Option.Paul Phillips2012-01-031-0/+7
| | | | | | | | | | | | | | | | | | | | Another salvo in the war against option2Iterable.
* | | | | Optimization/robustness in the backend.Paul Phillips2012-01-0318-198/+279
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trying to help icode/jvm get through their business a bit faster, and also make things more robust. Less null, more distinguished objects. More encapsulation, fewer public vars. Helping updateSuccessorList() to avoid assembling a list of successors on every call only to find most of the time that it's the same list it already had (e.g. compiling quick.lib it says "59076 calls, 690 requiring allocation" rather than 59076 calls, 59076 requiring allocation.)
* | | | Added option -Xlog-reflective-calls.Paul Phillips2012-01-023-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A message is emitted when a reflective call is generated. We can now be eager consumers of this since we purged all the reflective calls at some point -- but without a backstop, they have been slipping back in.
* | | | Added -Xlog-implicit-conversions.Paul Phillips2012-01-0211-25/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New command line option prints a message whenever the compiler inserts an implicit conversion. Implicit parameters are not under consideration here, since the primary motivation is to make it easy to inspect your code for unintentional conversions, since they can have dramatic performance implications. class A { def f(xs: Array[Byte]) = xs.size def g(xs: Array[Byte]) = xs.length } % scalac -Xlog-implicit-conversions logImplicits.scala logImplicits.scala:2: applied implicit conversion from xs.type to ?{val size: ?} = implicit def byteArrayOps(xs: Array[Byte]): scala.collection.mutable.ArrayOps[Byte] def f(xs: Array[Byte]) = xs.size ^
* | | | Changed boxing of free mutable variables to be flexible wrt when liftcode ↵Martin Odersky2012-01-028-122/+105
| | | | | | | | | | | | | | | | | | | | | | | | takes place. A major redesign that unifies the various different approaches to boxing of free variables. Free variables are marked with CAPTURED and eliminated by LambdaLift. I also added some hooks in MacroContext that a reifier needs to use.
* | | | Hardening of adaptoNewRun to survive issues in presentation compiler.Martin Odersky2012-01-021-4/+8
| | | | | | | | | | | | | | | | Previously, adaptToNewRun crashed when an object declaration got replaced by a value with the same name, because the module class no longer existed. This caused crashes in the presentation compiler when class files disappeared because of a clean build. The new behavior avoids assertion errors.
* | | | More uniformity for the parser.Paul Phillips2011-12-311-4/+4
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixing consecutive type application made it more obvious there was another missing bit of the parser, type application following function application. This should (and now does) work: object F { def apply[T] = List[T]() } def g() = F g()[String]
* | | More performance work.Paul Phillips2011-12-3017-470/+700
| | | | | | | | | | | | | | | | | | | | | Custom versions of collections which methods which operate on 2 or 3 collections. Eliminated most users of zip/zipped. Cleaned up the kinds checking code somewhat. Reduced the number of silent typechecks being performed at named argument sites.
* | | Low-level optimization.Paul Phillips2011-12-305-20/+23
| | | | | | | | | | | | Eliminated a bunch of unnecessary array expense.
* | | Created VariantTypeMap.Paul Phillips2011-12-303-139/+197
| | | | | | | | | | | | | | | | | | | | | Noticed most TypeMaps ignore variance but perform all the variance bookkeeping regardless. Made it so only variant TypeMaps pay that cost. Also lent some organization to the one place making real use of VariantTypeMap, existentialAbstraction.
* | | Creator for existentials which flattens.Paul Phillips2011-12-307-19/+22
| | | | | | | | | | | | | | | | | | Currently it is possible to end up with nested existentials, because existentialAbstraction only looks one level deeper. This works harder to flatten them.
* | | Better hunting for tools.jar.Paul Phillips2011-12-304-27/+51
| | | | | | | | | | | | | | | Attempting to make the repl find it based on fewer clues so all can enjoy the javap goodness.
* | | Optimization in refchecks.Paul Phillips2011-12-302-36/+51
| | | | | | | | | | | | | | | | | | | | | addVarargBridges is extremely expensive to cover such a corner case (scala classes inheriting and overriding java varargs methods.) Added a fast path excluding every class which doesn't have a java varargs method somewhere amidst its ancestors.
* | | Optimization in backend.Paul Phillips2011-12-301-4/+2
| | | | | | | | | | | | | | | | | | | | | Eliminated one source of the thousands of copies of the same Strings we had/have (strongly reachable) on the heap. It is another good example of how constructor parameters unintentionally become fields and how that in turn brings the pain.
* | | Optimization in Flags.Paul Phillips2011-12-301-5/+26
| | | | | | | | | | | | Added fast and less slow paths for oddly expensive flagsToString.
* | | Optimization in method synthesis.Paul Phillips2011-12-303-5/+9
| | | | | | | | | | | | | | | Discovered expensive flag operations being performed on the wrong side of the only-when-logging by-name argument.
* | | Optimizations in typeref creation.Paul Phillips2011-12-302-3/+3
| | | | | | | | | | | | | | | | | | A couple locations where more work than necessary is performed when created a typeref. (Not to mention creating bogus typerefs applying arguments to implementation classes.)
* | | repl power mode improvements.Paul Phillips2011-12-286-95/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented great suggestion from moors. More imports in power mode, including the contents of treedsl. Also, another swing at overcoming the mismatched global singletons problem, this time taking advantage of dependent method types. Amazingly, it seems to work. Continuing in the quest to create a useful compiler hacking environment, there is now an implicit from Symbol which allows you to pretend a Symbol takes type parameters, and the result is the applied type based on the manifests of the type arguments and the type constructor of the symbol. Examples: // magic with manifests scala> val tp = ArrayClass[scala.util.Random] tp: $r.global.Type = Array[scala.util.Random] // evidence scala> tp.memberType(Array_apply) res0: $r.global.Type = (i: Int)scala.util.Random // treedsl scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) m: $r.treedsl.global.Match = 10 match { case 5 => false case _ => true } // typed is in scope scala> typed(m).tpe res1: $r.treedsl.global.Type = Boolean
* | | Tone down insensible-equality warning.Paul Phillips2011-12-271-1/+1
| | | | | | | | | | | | Closes SI-5175.
* | | Merge branch 'type-currying-mini' of /scala/trunk into developPaul Phillips2011-12-271-3/+4
|\ \ \
| * | | Consecutive type application.Paul Phillips2011-12-271-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parser through I think a quirk of history would not allow back to back type applications, like expr[T1, T2][T3, T4] Now it does, meaning the only thing it can: val n0 = Partial[immutable.HashMap][String][Int] ++ Seq(("a", 1)) val n1 = Partial.apply[immutable.HashMap].apply[String].apply[Int] ++ Seq(("a", 1)) assert(n0 == n1)
| | | |
| \ \ \
| \ \ \
| \ \ \
| \ \ \
| \ \ \
| \ \ \
| \ \ \
*-------. \ \ \ Merge remote-tracking branches 'ijuma/issue/5341', ↵Paul Phillips2011-12-272-0/+45
|\ \ \ \ \ \ \ \ | | |_|_|_|/ / / | |/| | | | | | | | | | | | | | 'kepler/topic/reifyclosuretests', 'kepler/topic/antscalacheck', 'szabolcsberecz/SI-5104', 'kepler/ticket/5334' and 'kepler/topic/miscfixes' into develop
| | | | | * | | Documented emptyValDef fieldEugene Burmako2011-12-231-0/+5
| | | | |/ / /
| | | * / / / fixes #5104 and related NaN ordering inconsistenciesSzabolcs Berecz2011-12-251-0/+40
| | | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug was caused by the inconsistency between j.l.Math.min() and j.l.Double.compareTo() wrt NaN (j.l.Math.min() considers NaN to be less than any other value while j.l.Double.compareTo() says it's greater...) The fix changes Ordering.{FloatOrdering,DoubleOrdering) to base it's results on primitive comparisons and math.{min,max} instead of j.l.{Float,Double}.compareTo()
* | | / / / Fix SI-5341: PhaseAssembly.removeDanglingNodes removes elements from mutable.MapIsmael Juma2011-12-271-1/+1
|/ / / / / | | | | | | | | | | | | | | | during iteration.
* / / / / Fixed regression in lub calculation.Paul Phillips2011-12-261-9/+17
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changing NullaryMethodType to be a SimpleTypeProxy because nearly all its operations forward to its result type was it seems not such a good idea, because it also meant that calling .underlying returned the result type rather than the method type. The way this materialized was in subtype checks of refinement types. A lub is calculated for two nullary method types in the course of calculating a refinement, and then the input types are checked against the calculated lub. However in the lub refinement, the nullary method type has become a bare typeref, and so the subtype check failed. Closes SI-5317. This does give me confidence that all the malformed lubs one sees logged under -Ydebug (and there are still many, especially with type constructors) are alerting us to real bugs elsewhere in Types.
* | | | Optimizing at the Name/String boundary.Paul Phillips2011-12-2511-87/+114
| | | | | | | | | | | | | | | | | | | | | | | | Working on reducing the now significant amount of both garbage and retained but duplicated Strings taking place as Names become Strings and vice versa. Long way to go.