summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix SI-5284.Aleksandar Prokopec2012-06-2110-26/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was the false assumption that methods specialized on their type parameter, such as this one: class Foo[@spec(Int) T](val x: T) { def bar[@spec(Int) S >: T](f: S => S) = f(x) } have their normalized versions (`bar$mIc$sp`) never called from the base specialization class `Foo`. This meant that the implementation of `bar$mIc$sp` in `Foo` simply threw an exception. This assumption is not true, however. See this: object Baz { def apply[T]() = new Foo[T] } Calling `Baz.apply[Int]()` will create an instance of the base specialization class `Foo` at `Int`. Calling `bar` on this instance will be rewritten by specialization to calling `bar$mIc$sp`, hence the error. So, we have to emit a valid implementation for `bar`, obviously. Problem is, such an implementation would have conflicting type bounds in the base specialization class `Foo`, since we don't know if `T` is a subtype of `S = Int`. In other words, we cannot emit: def bar$mIc$sp(f: Int => Int) = f(x) // x: T without typechecking errors. However, notice that the bounds are valid if and only if `T = Int`. In the same time, invocations of `bar$mIc$sp` will only be emitted in callsites where the type bounds hold. This means we can cast the expressions in method applications to the required specialized type bound. The following changes have been made: 1) The decision of whether or not to create a normalized version of the specialized method is not done on the `conflicting` relation anymore. Instead, it's done based on the `satisfiable` relation, which is true if there is possibly an instantiation of the type parameters where the bounds hold. 2) The `satisfiable` method has a new variant called `satisfiableConstraints`, which does unification to figure out how the type parameters should be instantiated in order to satisfy the bounds. 3) The `Duplicators` are changed to transform a tree using the `castType` method which just returns the tree by default. In specialization, the `castType` in `Duplicators` is overridden, and uses a map from type parameters to types. This map is obtained by `satisfiableConstraints` from 2). If the type of the expression is not equal to the expected type, and this map contains a mapping to the expected type, then the tree is cast, as discussed above. Additional tests added. Review by @dragos Review by @VladUreche Conflicts: src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
* Merge pull request #750 from paulp/issue/5953Adriaan Moors2012-06-192-2/+18
|\ | | | | Fix for SI-5953, extension methods crasher.
| * Fix for SI-5953, extension methods crasher.Paul Phillips2012-06-192-2/+18
|/ | | | | | | | | | | | | As usual, .tpe -> .tpeHK. As a side note following an old theme, if symbols of type parameters knew that they were symbols of type parameters, they could call tpeHK themselves rather than every call site having to do it. It's the operation which injects dummies which should require explicit programmer action, not the operation which faithfully reproduces the unapplied type. Were it that way, errors could be caught much more quickly via ill-kindedness. Seems like an improvement over lurking compiler crashes at every call to tparam.tpe.
* Merge pull request #743 from axel22/issue/4541Adriaan Moors2012-06-196-5/+62
|\ | | | | Fix SI-4541.
| * Fix SI-4541.Aleksandar Prokopec2012-06-186-5/+62
| | | | | | | | | | | | | | | | | | | | | | Catch type errors when duplicating trees. In this case, to access a protected member from a specialized class is an error, so we would have to make the member public anyway. Better it is then to report an error and have the user make the field public explicitly. Review by @dragos.
* | Merge pull request #723 from paulp/topic/5910Adriaan Moors2012-06-192-1/+4
|\ \ | | | | | | Fix for java parser edge case.
| * | Fix for java parser edge case.Paul Phillips2012-06-142-1/+4
| | | | | | | | | | | | Empty statements are A-OK. Closes SI-5910. Review by @dragos.
* | | Merge pull request #746 from adriaanm/pullreq/740-rebasedAdriaan Moors2012-06-1916-497/+546
|\ \ \ | | | | | | | | Statistics reorganization
| * | | Statistics reorganizationMartin Odersky2012-06-1916-497/+546
| | | | | | | | | | | | | | | | | | | | Statistics were broken since the move to reflect.internal. They are now re-organized, made more robost and modular.
* | | | Merge pull request #744 from jsuereth/sbt-reflecton-fixAdriaan Moors2012-06-199-286/+373
|\ \ \ \ | | | | | | | | | | Sbt reflecton fix
| * \ \ \ Merge branch 'master' into sbt-reflecton-fixJosh Suereth2012-06-1840-181/+806
| |\ \ \ \
| * | | | | Final clean up to get the build/testing working again.Josh Suereth2012-06-184-37/+82
| | | | | |
| * | | | | More fixups.Josh Suereth2012-06-143-17/+22
| | | | | |
| * | | | | Merge branch 'master' into sbt-reflecton-fixJosh Suereth2012-06-135-4/+12
| |\ \ \ \ \
| * | | | | | Refactoring and temporary commit before finishing the fix.Josh Suereth2012-06-138-253/+290
| | | | | | |
* | | | | | | Merge pull request #737 from scalamacros/topic/reifyanonymousAdriaan Moors2012-06-196-27/+0
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | enables reification of anonymous classes
| * | | | | | | enables reification of anonymous classesEugene Burmako2012-06-186-27/+0
| | |_|_|_|_|/ | |/| | | | |
* | | | | | | Merge pull request #729 from scalamacros/topic/showrawAdriaan Moors2012-06-1931-161/+404
|\ \ \ \ \ \ \ | |_|_|_|_|/ / |/| | | | | | improve showRaw
| * | | | | | improves showRawEugene Burmako2012-06-1931-161/+404
| | | | | | | | | | | | | | | | | | | | | | | | | | | | addresses concerns raised in http://groups.google.com/group/scala-user/browse_thread/thread/de5a5be2e083cf8e
* | | | | | | Merge pull request #697 from retronym/ticket/4270-3Adriaan Moors2012-06-197-56/+125
|\ \ \ \ \ \ \ | |_|_|_|_|/ / |/| | | | | | SI-4270 Disqualify in scope implicits that are shadowed.
| * | | | | | SI-4270 Refactor for efficiency and clarity.Jason Zaugg2012-06-141-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoids allocation of the hashset used by shadowing checks when searching in the implicit scope, and replaces three checks for `if (isLocal)` with a sprinkling of polymorphism.
| * | | | | | SI-4270 Disqualify in scope implicits that are shadowed.Jason Zaugg2012-06-106-49/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an expression wouldn't type check explicitly, it shouldn't be allowed implicitly. Employs typedIdent, which already does this sort of thing rather well, instead of continuing to reimplement it in Implicits. Remove check for non-implicit synonym, which is subsumed by typing an Ident. Workaround Scaladoc oddity, by using an attributed select when the context is deficient.
| * | | | | | SI-4270 Rename implicits to avoid name clashes.Jason Zaugg2012-06-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This will fail implicit search in the next commit.
* | | | | | | Merge pull request #728 from scalamacros/topic/reflection-meetingJosh Suereth2012-06-181-0/+17
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | exposes extra tests for symbols as discussed on reflection meeting
| * | | | | | | exposes extra tests for symbols as discussed on reflection meetingEugene Burmako2012-06-151-0/+17
| | |_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | review by @odersky
* | | | | | | Merge pull request #739 from jsuereth/feature/collection-conversionsJosh Suereth2012-06-1810-5/+219
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Adding copyInto and toVector methods to collections.
| * | | | | | | Fixing embarassing typo.Josh Suereth2012-06-181-1/+1
| | | | | | | |
| * | | | | | | Migrate build to @odersky's suggestion of convertTo.Josh Suereth2012-06-187-24/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move method into TraversableOnce from Iterator and Traversable to make the build pass. * Udpate IDE tests with new collection methods. * Rewire default toXYZ methods to use convertTo.
| * | | | | | | Rename copyTo to build based on consensus of 3Josh Suereth2012-06-185-14/+14
| | | | | | | |
| * | | | | | | Fixes from review.Josh Suereth2012-06-185-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fixed typo * Renamed copyInto to copyTo * Added tparam doc.
| * | | | | | | Adding copyInto and toVector methods to collections.Josh Suereth2012-06-188-0/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added generic copyInto method for collections. For any collection with a CanBuildFrom, can convert a generic collection into it using the builder. * Added specifici toVector method for collections. This is more efficient than copyInto if the collection is a Vector.
* | | | | | | | Merge pull request #738 from scalamacros/topic/checkinitJosh Suereth2012-06-182-9/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | fixes checkinit, now it's for real
| * | | | | | | | fixes checkinit, now it's for realEugene Burmako2012-06-182-9/+1
| | |_|_|_|/ / / | |/| | | | | |
* | | | | | | | Merge pull request #741 from axel22/issue/4954Josh Suereth2012-06-183-13/+81
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix SI-4954.
| * | | | | | | | Fix SI-4954.Aleksandar Prokopec2012-06-183-13/+81
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Override inner classes in `LinkedHashMap` that correspond to `filterKeys`, `mapValues` and `keys` to retain a proper ordering of elements when they are transformed.
* | | | | | | | Merge pull request #742 from axel22/feature/pc-ctrieJosh Suereth2012-06-182-5/+12
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Use `ThreadLocalRandom` in `TrieMap.size`.
| * | | | | | | | Use `ThreadLocalRandom` in `TrieMap.size`.Aleksandar Prokopec2012-06-182-5/+12
| |/ / / / / / /
* | | | | | | | Merge pull request #720 from phaller/cps-ticket-1681Josh Suereth2012-06-1813-3/+208
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | CPS: enable return expressions in CPS code if they are in tail position
| * | | | | | | | Remove unneeded use of Tree#idphaller2012-06-152-16/+16
| | | | | | | | |
| * | | | | | | | Replace context stack of AnnotationChecker with new mode for typing returnsphaller2012-06-157-32/+43
| | | | | | | | |
| * | | | | | | | Remove stray commentphaller2012-06-141-1/+0
| | | | | | | | |
| * | | | | | | | CPS: enable return expressions in CPS code if they are in tail positionphaller2012-06-1411-2/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a stack of context trees to AnnotationChecker(s). Here, it is used to enforce that adaptAnnotations will only adapt the annotation of a return expression if the expected type is a CPS type. The remove-tail-return transform is reasonably general, covering cases such as try-catch-finally. Moreover, an error is thrown if, in a CPS method, a return is encountered which is not in a tail position such that it will be removed subsequently.
* | | | | | | | | Merge pull request #725 from paulp/issue/arrayopsJosh Suereth2012-06-181-1/+1
|\ \ \ \ \ \ \ \ \ | |_|_|/ / / / / / |/| | | | | | | | Remove unused type parameter.
| * | | | | | | | Remove unused type parameter.Paul Phillips2012-06-151-1/+1
| | |_|/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There should probably be a warning about non-overriding methods which have unreferenced type parameters.
* | | | | | | | Merge pull request #736 from damienobrist/feature/diagrams-dev-revertJosh Suereth2012-06-1848-2962/+252
|\ \ \ \ \ \ \ \ | |_|_|/ / / / / |/| | | | | | | Reverting the diagrams
| * | | | | | | Revert "Scaladoc class diagrams part 1"Vlad Ureche2012-06-1835-1649/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 831f09bb6d00c152bd8aef3ce8bf9e200080fe36.
| * | | | | | | Revert "Scaladoc class diagrams part 2"Vlad Ureche2012-06-1814-1301/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit fba4098ca592bdd7d6609017daa4a08f274f35ec.
| * | | | | | | Revert "Documented SyncVar"Vlad Ureche2012-06-181-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 556065151c10685240dd907691dab5e094c87efc.
* | | | | | | | Merge pull request #718 from damienobrist/feature/diagrams-dev-finalJosh Suereth2012-06-1748-252/+2962
|\| | | | | | | | | | | | | | | | | | | | | | | Diagrams in Scaladoc
| * | | | | | | Documented SyncVarVlad Ureche2012-06-141-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we used it in the DocRunner and noticed it could have better documentation. Review by @heathermiller.