summaryrefslogtreecommitdiff
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* removes ClassTag.String and TypeTag.StringEugene Burmako2012-07-023-16/+22
| | | | | | | | | | TypeTag.String is removed because it's unclear whether it should point to scala.Predef.String or to java.lang.String. ClassTag.String is removed to be consistent with TypeTag.String. This requires re-bootstrapping, because Definitions.scala in locker expects classTag[String] being automatically generated, whereas starr disagrees with locker on how to generate that class tag.
* Improves backward compatibility of manifestsEugene Burmako2012-07-023-42/+60
| | | | | | | | | | | | | | | | 1) type ClassManifest[T] = ClassTag[T] (solves a problem with toArray[T: ClassManifest] defined on most of the collections; if these types weren't aliases, then we won't be able to change the signature of that method to toArray[T: ClassTag], because that would break source compatibility for those who override toArray in their custom collections) 2) Compiler-generated manifests no longer trigger deprecation warnings (this is implemented by using ClassManifestFactory instead of ClassManifest and ManifestFactory instead of Manifest) 3) Deprecation messages got improved to reflect the changes that were introduced in 2.10.0-M4.
* Merge pull request #771 from retronym/ticket/4176-2Adriaan Moors2012-07-023-15/+24
|\ | | | | SI-4176 A repeat dose of repeated parameter type sanitization.
| * SI-4176 A repeat dose of repeated parameter type sanitization.Jason Zaugg2012-06-303-15/+24
| | | | | | | | | | | | | | - During eta expansion, treat parameters of type A* as Seq[A] - Do the same for method/class parameters as referred to by an Ident. Also fixes SI-5967, which shows up during pattern matching.
* | Merge pull request #800 from retronym/ticket/5932Adriaan Moors2012-07-021-1/+1
|\ \ | | | | | | SI-5932 Tone down non-sensible == warning with refinements.
| * | SI-5932 Tone down non-sensible == warning with refinements.Jason Zaugg2012-07-011-1/+1
| | | | | | | | | | | | Errs on the side of avoiding false positives.
* | | moves reflective compiler into scala.tools.reflectEugene Burmako2012-07-024-10/+19
|/ /
* | Merge pull request #783 from phaller/topic/cps-return-revertAdriaan Moors2012-06-282-6/+1
|\ \ | | | | | | Revert pull request #720 (CPS: enable return expressions in CPS code if ...
| * | Revert pull request #720 (CPS: enable return expressions in CPS code if they ↵phaller2012-06-272-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | are in tail position) Reverts commit 0ada0706746c9c603bf5bc8a0e6780e5783297cf. Reverts commit 51c92f02229098d0b402a65a72267f7a17984022. Reverts commit cdfbe8e39fbbec00c969cd74f117ae410b98b40b. Reverts commit 796024c7429a03e974a7d8e1dc5c80b84f82467d.
* | | Merge pull request #757 from dragos/warn-when-swallowing-throwablesAdriaan Moors2012-06-271-3/+10
|\ \ \ | | | | | | | | Don't just swallow `Throwables` while parsing bytecode. Print a warning
| * | | Don't swallow `Throwables` while parsing bytecode. Print a warning and go on.Iulian Dragos2012-06-221-3/+10
| | | | | | | | | | | | This has caused hours of debugging, to find out that 'package X does not have a member Y' were caused by a `NullPointerException`.
* | | | Merge pull request #780 from hubertp/topic/fix-rangepos-buildAdriaan Moors2012-06-271-1/+1
|\ \ \ \ | | | | | | | | | | Fix range positions when applying anonymous classes.
| * | | | Fix range positions when applying anonymous classes. Review by @dragos or ↵Hubert Plociniczak2012-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | @odersky
* | | | | Merge pull request #778 from adriaanm/topic-virtpatmatAdriaan Moors2012-06-273-79/+92
|\ \ \ \ \ | | | | | | | | | | | | patmat bugfixes and minor clean ups
| * | | | | SI-5899 exhaustiveness for non-class typesAdriaan Moors2012-06-261-5/+17
| | | | | |
| * | | | | exhaust unit: consider Unit as sealedAdriaan Moors2012-06-261-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | one of the most boring sealed types imaginable, but a sealed type all the same
| * | | | | better fix for SI-5189 pt1Adriaan Moors2012-06-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the fix in 0cffdf38d9 was brain dead (only looking at the first argument of the ctor, rather than the first argument list) the reasoning was that we should not look at the MethodType of the constructor, but at the argument types directly (since going through the method type would flip variance, though the ctor arguments are conceptually in covariant positions here)
| * | | | | minor cleanup in patmat and typersAdriaan Moors2012-06-262-71/+67
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patmat: - remove Var's unused 'checked' member; subsumed by 'domain' - updated docs: no longer using isSuccess in __match typers: clean up indentation, swap ifs to failure-first
* | | | | Merge pull request #779 from hubertp/issue/5148Adriaan Moors2012-06-272-18/+16
|\ \ \ \ \ | |/ / / / |/| | | | Closes SI-5148.
| * | | | Closes SI-5148.Hubert Plociniczak2012-06-272-18/+16
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately we have to wrap transform to catch all the MissingRequirementErrors exceptions (wrapped in TypeErrors). This is because we force the info of the symbol in a couple of places and we would have to catch all/some of them (and remove the duplicates as well which really becomes messy). Review by @axel22.
* | | | Merge pull request #768 from magarciaEPFL/fixesAdriaan Moors2012-06-261-87/+85
|\ \ \ \ | | | | | | | | | | emit JVM InnerClasses attribute for bean info classes
| * | | | emit JVM InnerClasses attribute for bean info classesMiguel Garcia2012-06-241-87/+85
| | |_|/ | |/| |
* | | | fix for SI-4935Miguel Garcia2012-06-261-1/+25
| |/ / |/| |
* | | Merge pull request #770 from odersky/pullreq/statisticsAdriaan Moors2012-06-262-10/+11
|\ \ \ | | | | | | | | Statistics improvements and bug fixes.
| * | | Statistics improvements and bug fixes.Martin Odersky2012-06-252-10/+11
| | | | | | | | | | | | | | | | Added compile-time option hotEnabled to Statistics that can be used to count very high frequency methods with 0 overhead for the disabled case. Fixed problem with weak maps that caused some timers to be discarded prematurely before they could be printed. Fixed problem with accouning for stacked timers.
* | | | Merge pull request #769 from hubertp/topic/t4842-followupAdriaan Moors2012-06-261-2/+2
|\ \ \ \ | |/ / / |/| | | Minor followup on SI-4842: remove awkward condition. Review by @retronym
| * | | Minor followup on SI-4842: remove awkward condition. Review by @retronym.Hubert Plociniczak2012-06-251-2/+2
| | |/ | |/|
* | | Merge pull request #760 from retronym/ticket/5966-3Adriaan Moors2012-06-251-3/+5
|\ \ \ | | | | | | | | SI-5966 Fix eta expansion for repeated parameters with zero arguments.
| * | | SI-5966 Fix eta expansion for repeated parameters with zero arguments.Jason Zaugg2012-06-231-3/+5
| | | | | | | | | | | | | | | | | | | | Reworks part of e33901 / SI-5610, which was inserting an <empty> tree as an argument in this case, which turns into a null in icode.
* | | | Merge pull request #767 from retronym/ticket/5968Adriaan Moors2012-06-251-0/+2
|\ \ \ \ | |_|_|/ |/| | | SI-5968 Eliminate spurious exhaustiveness warning with singleton types.
| * | | SI-5968 Eliminate spurious exhaustiveness warning with singleton types.Jason Zaugg2012-06-231-0/+2
| | | | | | | | | | | | | | | | A singleton type is a type ripe for enumeration.
* | | | Merge pull request #761 from paulp/topic/parser-commentAdriaan Moors2012-06-241-1/+3
|\ \ \ \ | | | | | | | | | | Added a key comment.
| * | | | Added a key comment.Paul Phillips2012-06-231-1/+3
| |/ / / | | | | | | | | | | | | | | | | The commit message from f4d2678c42 works a lot better up close and personal with the change.
* | | | Merge pull request #733 from retronym/ticket/4989-3Adriaan Moors2012-06-241-0/+8
|\ \ \ \ | |/ / / |/| | | SI-4989 Reject super.x if an intermediate class declares x abstract.
| * | | SI-4989 Reject super.x if an intermediate class declares x abstract.Jason Zaugg2012-06-171-0/+8
| | | | | | | | | | | | | | | | | | | | This is in line with Java's treatment. Without this, an AbstractMethodError is thrown at runtime.
* | | | Merge pull request #755 from axel22/issue/5284-cherry-pickedAdriaan Moors2012-06-223-25/+93
|\ \ \ \ | |_|_|/ |/| | | Fix SI-5284.
| * | | Fix SI-5284.Aleksandar Prokopec2012-06-213-25/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #752 from retronym/topic/warn-catch-all-4Adriaan Moors2012-06-221-0/+10
|\ \ \ \ | |_|_|/ |/| | | SI-2807 Resurrect and refine the promiscuous catch warning.
| * | | SI-2807 Resurrect and refine the promiscuous catch warning.Jason Zaugg2012-06-191-0/+10
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous incarnation didn't survive 4fb3473. This version can be cleared by using a typed pattern: `catch { case _: Throwable => }`. This is motivated by the recent appearance of such a catch in `util.Try`, and by battle scars left by one too many processes bravely but stupidly catching and logging OutOfMemoryErrors. -Y status has been skipped: this warning is enabled by default and can only be silenced with use of a typed pattern.
* | | Merge pull request #712 from dragos/issue/hardening-compiling-with-newer-sourcesPaul Phillips2012-06-213-7/+17
|\ \ \ | | | | | | | | Issue/hardening compiling with newer sources
| * | | Remove NPE when `compileLate` sees sources during initialization.Iulian Dragos2012-06-131-5/+6
| | | | | | | | | | | | | | | | | | | | When a symbol needed in Definitions is loaded, it may be that the corresponding source is newer than the classfile. That will send it to `compileLate`, but no phase is yet set. We simply add it to the compilation pipeline and continue gracefully.
| * | | Don't require symbols to be loaded in the parser.Iulian Dragos2012-06-131-1/+10
| | | | | | | | | | | | | | | | | | | | The parser special-cases primitive types. For comparing the name, it relied on having the symbols for primitive types already loaded, which is not always the case. The presentation compiler may parse sources for, say, scala.Int, and therefore the symbol for Int may not be yet available.
| * | | Don't use the BrowsingLoader for Java sources. Iulian Dragos2012-06-131-1/+1
| | | | | | | | | | | | | | | | | | | | When the presentation compiler needs a SourceLoader, instead of immediately adding the file to the compilation round it uses a fast parser to create symbols for all top-level class definitions. The fast parser assumes Scala sources, which is not always the case.
* | | | Merge pull request #735 from retronym/ticket/4842-2Adriaan Moors2012-06-212-16/+54
|\ \ \ \ | | | | | | | | | | SI-4842 Forbid access to in-construction this in self-constructor args
| * | | | SI-4842 Forbid access to in-construction this in self-constructor argsJason Zaugg2012-06-172-16/+54
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | The check was already in place for direct calls to the super constructor. Without this additional check, ExplicitOuter crashes, as it doesn't create an $outer pointer for the constructor-arg scoped inner object, but expects one to exist when transforming the Outer.this reference.
* | | | Merge pull request #731 from retronym/ticket/5617Adriaan Moors2012-06-211-1/+10
|\ \ \ \ | |_|_|/ |/| | | SI-5617 Better error message for "x overrides nothing".
| * | | SI-5617 Better error message for "x overrides nothing".Jason Zaugg2012-06-171-1/+10
| |/ / | | | | | | | | | "It looks like you're trying to override a method", notes Clippy.
* | | Fix for SI-5953, extension methods crasher.Paul Phillips2012-06-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-192-5/+16
|\ \ \ | | | | | | | | Fix SI-4541.
| * | | Fix SI-4541.Aleksandar Prokopec2012-06-182-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.