summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Revert "SI-7517 type constructors too eagerly normalized."Paul Phillips2013-06-0311-126/+31
| | | | | | | | | This reverts commit 14534c693d2eb6acafaf8244c14b5643388fbd67. It turns out this approach was breaking the working variations in the submitted test case even as it was unbreaking the unworking one, but I never managed to uncomment them. Fortunately retronym's test case was not so lackadaisical.
* Merge pull request #2599 from paulp/pr/2586-rebasePaul Phillips2013-06-031-466/+594
|\ | | | | constructors phase refactoring for readability
| * Golfed about 20 lines into the sand trap.Paul Phillips2013-05-261-37/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And it's a nice golf clinic and all, but let's remove our golf gloves and take in some film. for (stat <- defBuf.iterator ++ auxConstructorBuf.iterator) A quick count: - defBuf is a ListBuffer (1 mutant) - auxConstructorBuf is a ListBuffer (2 mutants) - two mutable iterators over mutable sequences (3, 4 mutants) - Iterator.++ joins them and is BY-NAME (4 mutants, 1 tragedy in waiting) - the joined Iterator is a new mutable structure (5 mutants, now 3 deep) - omittables is a mutable Set (6 mutants) - the 5-layer-3-deep iterator mutates omittables as it walks [The following is a public service breakdown. The letter sequence y-o-u is a local variable which should be replaced with your name, whoever "you" are, if you commit any code in these parts.] Hear my plea! YOU DON'T HAVE TO DO IT THIS WAY! It isn't simpler, faster, easier, more satisfying, shorter, more pixelated, there just isn't any advantage to it, even if you're lazy! Especially if you're lazy! Whatever combination of virtues and vices exist in your personal petri dish, this will never be a hilltop! PLEASE COME ENJOY A DRINK WITH ME AND MY FRIEND 'VAL' !! I'LL INTRODUCE YOU! I THINK YOU WILL REALLY LIKE HER! I HOPE YOU WILL SEE A LOT OF ONE ANOTHER! REMEMBER THAT NAME, 'VAL' !! SHE'LL HAVE HER EYE OUT FOR YOU!
| * Reversing reversion of ac6504b8c4.Paul Phillips2013-05-261-4/+4
| | | | | | | | Putting back the bits I moved aside to get a clean rebase.
| * skipping trips to specializeTypes when not necessary in constructorsMiguel Garcia2013-05-261-5/+13
| |
| * separation of concerns: guard non-specialized ctor-stats in constructorsMiguel Garcia2013-05-261-118/+123
| |
| * readability for intoConstructors transformerMiguel Garcia2013-05-261-11/+37
| |
| * separation of concerns: elision in constructorsMiguel Garcia2013-05-261-115/+135
| |
| * separation of concerns: delayed-init in constructorsMiguel Garcia2013-05-261-134/+141
| |
| * method transformClassTemplate() turned into class TemplateTransformerMiguel Garcia2013-05-261-572/+576
| |
| * eliding what the constructor phase elides but with less effort (2 of 2)Miguel Garcia2013-05-261-63/+1
| | | | | | | | | | Removing the old implementation of elision in constructors in favor of the new one which is both faster, more readable.
| * eliding what the constructor phase elides but with less effort (1 of 2)Miguel Garcia2013-05-261-2/+67
| | | | | | | | | | | | For now both old and new implementations of elision coexist, allowing cross-checking their results. In the next commit only the new one will remain.
| * how stuff works: elision of param-accessor-fields and outer-accessorsMiguel Garcia2013-05-261-6/+64
| |
| * handling AnyVal special case early on to simplify logic afterwardsMiguel Garcia2013-05-261-6/+10
| | | | | | | | | | | | This way the contract of `transformClassTemplate()` can focus on non-AnyVal cases, which are more regular from the perspective of transforming their templates in the constructors phase.
| * warn about uninitialized reads (in constructors), self-contained checkMiguel Garcia2013-05-261-37/+47
| | | | | | | | | | | | | | The check in question relies on helper maps and methods that don't belong outside that check. This commit encapsulates those helpers into the newly added `checkUninitializedReads()` , thus uncluttering `transformClassTemplate()`
| * Temporary reversion of a bit of d8b96bb858.Paul Phillips2013-05-261-4/+4
| | | | | | | | | | | | | | If I reverse these few lines, I can rebase miguel's pull request cleanly; if I don't, git thinks there are enough merge conflicts to start a war. Something is suboptimal in that algorithm.
* | Merge pull request #2597 from paulp/issue/7520Paul Phillips2013-06-033-33/+96
|\ \ | | | | | | SI-7520 bug in subtyping.
| * | SI-7520 bug in subtyping.Paul Phillips2013-05-312-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | isSubType, if given two SingleTypes, would check =:= and stop there. It is necessary to continue with weakening the left hand side, because (for instance) the singleton type on the left hand side could be a refinement class carrying parents which are themselves single or constant types.
| * | Eliminated the shared logic.Paul Phillips2013-05-311-32/+31
| | | | | | | | | | | | | | | Gave isSubType and isSameType a more closely parallel structure to reduce both current and future duplication.
| * | New method typeRelationPreCheck.Paul Phillips2013-05-311-1/+27
| | | | | | | | | | | | | | | Utilizes TriState from previous commit. Consolidates code which had been duplicated across isSubType and isSameType.
| * | Add a TriState value class.Paul Phillips2013-05-311-0/+26
| | | | | | | | | | | | Sometimes true and false aren't enough.
* | | Merge pull request #2615 from paulp/issue/7517Paul Phillips2013-06-0311-31/+126
|\ \ \ | | | | | | | | SI-7517 type constructors too eagerly normalized.
| * | | SI-7517 type constructors too eagerly normalized.Paul Phillips2013-05-3111-31/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I think 403eadd0f1 was largely a symptomatic remedy (not that we shouldn't harden against such outcomes) and that this commit gets closer to the root causes. The unanticipated change to test/files/run/t6113.check is like a cry of support from the jury box. -Foo[[X](Int, X)] +Foo[AnyRef{type l[X] = (Int, X)}#l] We should continue to look at calls to normalize with grave suspicion.
* | | | Merge pull request #2577 from scalamacros/pullrequest/paradiseEugene Burmako2013-06-03332-1794/+2585
|\ \ \ \ | | | | | | | | | | Backport from paradise/macros
| * | | | refactors IMPLPARAM_xxx constants into value classesEugene Burmako2013-06-022-23/+66
| | | | |
| * | | | more refactoring and explanations in importersEugene Burmako2013-06-021-48/+54
| | | | |
| * | | | applying Jason's aesthetics suggestionEugene Burmako2013-05-281-4/+10
| | | | |
| * | | | changes some definitions to use Symbol.mapEugene Burmako2013-05-281-25/+25
| | | | |
| * | | | refactors macro runtimesEugene Burmako2013-05-2823-122/+202
| | | | | | | | | | | | | | | | | | | | | | | | | Following typedMacroBody, macroRuntime along with its friends has also been moved out into a separate component.
| * | | | refactors macro compilationEugene Burmako2013-05-2833-554/+837
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upgrades the way that macro defs are compiled by factoring out most of the logic in typedMacroBody and related errors in ContextErrors into an standalone cake. This leads to tighter cohesion and better code reuse as the cake is isolated from the rest of the compiler and is much easier to evolve than just a method body. Increased convenience of coding macro compilation allowed me to further clarify the implementation of the macro engine (e.g. take a look at Validators.scala) and to easily implement additional features, namely: 1) Parameters and return type of macro implementations can now be plain c.Tree's instead of previously mandatory c.Expr's. This makes macros more lightweight as there are a lot of situations when one doesn't need to splice macro params (the only motivation to use exprs over trees). Also as we're on the verge of having quasiquotes in trunk, there soon will be no reason to use exprs at all, since quasiquotes can splice everything. 2) Macro implementations can now be defined in bundles, standalone cakes built around a macro context: http://docs.scala-lang.org/overviews/macros/bundles.html. This further reduces boilerplate by simplifying implementations complex macros due to the fact that macro programmers no longer need to play path-dependent games to use helpers.
| * | | | refactors importersEugene Burmako2013-05-281-318/+318
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces better names, factors out recreation of symbols, trees, types and completes into separate methods, so that they can be overridden in specialized importers. The original motivation for this refactoring was to support JIT compilation of macros, but I think that most of the introduced improvements to code quality will be useful in trunk.
| * | | | refactors macro testsEugene Burmako2013-05-28258-785/+847
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | putting in a nutshell, this patch: * condenses some macro-XXX-a/b/c/... bundles * renames some tests to prepare for other macro flavors * introduces some additional tests
| * | | | macro engine refactoringEugene Burmako2013-05-2815-160/+455
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Macro impl bindings now store more information in signatures. Previously it was a flattened List[Int] corresponding to flattened paramss, now it's List[List[Int]] to preserve the lengths of parameter lists. Also now we distinguish between c.Expr parameters and others. Previously actual and reference macro signatures were represented as tuples of vparamss, rets, and sometimes tparams. Now they are all abstracted behind MacroImplSig. Finally this patch provides better error messages in cases of argsc <-> paramsc and argc <-> paramc mismatches.
| * | | | SI-7461 c.typeCheck(silent = true) now suppresses ambiguous errorsEugene Burmako2013-05-275-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise use cases like the one shown in the attached test (trying to typecheck something, which leads to an ambiguous overload error) will mysteriously fail compilation.
| * | | | less magic in fast track macrosEugene Burmako2013-05-275-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Now that we have a mechanism to declare not implemented macros, let's put it to good use by reducing the amount of magic applied to fast track.
| * | | | new starr that supports macro ???Eugene Burmako2013-05-276-6/+6
| | | | |
* | | | | Merge pull request #2613 from retronym/ticket/6309James Iry2013-05-312-0/+17
|\ \ \ \ \ | | | | | | | | | | | | SI-6309 Test case for early-init / private[this] crasher.
| * | | | | SI-6309 Test case for early-init / private[this] crasher.Jason Zaugg2013-05-312-0/+17
| | |_|/ / | |/| | | | | | | | | | | | | This has worked since 98daf03, "Overhauled local/getter/setter name logic.".
* | | | | Merge pull request #2618 from paulp/pr/final-in-package-objectJames Iry2013-05-311-2/+2
|\ \ \ \ \ | | | | | | | | | | | | Finalized math.E and math.Pi.
| * | | | | Finalized math.E and math.Pi.Paul Phillips2013-05-311-2/+2
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this treatment these constants will not be inlined or folded, bloating bytecode and inhibiting optimization. Marking them @inline doesn't have any additional effect, but I did it to futurize them in light of SI-7542.
* | | | | Merge pull request #2592 from paulp/issue/7088Paul Phillips2013-05-313-1/+20
|\ \ \ \ \ | |_|_|/ / |/| | | | SI-7088 Array crasher in erasure.
| * | | | SI-7088 Array crasher in erasure.Paul Phillips2013-05-273-1/+20
| | |/ / | |/| | | | | | | | | | | | | | The usual business where half our pattern matches are missing half the necessary cases.
* | | | Merge pull request #2614 from paulp/pr/revert-fsPaul Phillips2013-05-313-26/+2
|\ \ \ \ | |_|/ / |/| | | Revert "SI-6039 Harden against irrelevant filesystem details"
| * | | Revert "SI-6039 Harden against irrelevant filesystem details"Paul Phillips2013-05-313-26/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | This reverts commit b0758f5cb9d966b940933d48bdbb45d17a80de66. This commit sent startup time through the roof, at least in some circumstances (it is presumably related to one's current working directory.)
* | | Merge pull request #2424 from rjolly/si-7399James Iry2013-05-291-11/+11
|\ \ \ | | | | | | | | SI-7399 : Take scala.concurrent.context.maxThreads into account
| * | | SI-7399 : Take scala.concurrent.context.maxThreads into accountRaphael Jolly2013-05-291-11/+11
| | | | | | | | | | | | | | | | | | | | This change fixes the bug whereby specifiying maxThread as a property has no effect. A small refactoring is applied in the process.
* | | | Merge pull request #2563 from soc/SI-7474James Iry2013-05-284-26/+18
|\ \ \ \ | | | | | | | | | | SI-7474 Parallel collections: End the exception handling madness
| * | | | SI-7474 Parallel collections: End the exception handling madnessSimon Ochsenreither2013-05-284-26/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "What's wrong with an API which non-deterministically returns either type A or type B(Set(A, ...))?" This is pretty much what the exception handling behavior of the parallel collections does: If exceptions of type A occur, either an exception of type A or an exception of type B, wrapping multiple exceptions of A's, is returned. This behavior is incredibly broken and so unintuitive, that even people writing tests don't handle it correctly, as seen in test files/run/t5375.scala. Concerning “non-deterministic”: How many exceptions are observed before the operation is aborted depends on the machine, the available cores and hyper-threading, the operating system, the threadpool implementation and configuration, the size of the collection and the runtime itself. In fact, files/run/t5375.scala can be made to fail reproducible on both jdk7u and Avian, if we run on a single-core machine like in a virtual machine. With this change, we just pass the "first" exception which occurs. This is - consistent with the behaviour of sequential collections, - doesn't require users to know more about parallel collections than they already do ("elements might be processed out of order"), - in line with what Java 8 does. “Why don't we wrap everything in CompositeThrowables?” Even consistently returning CompositeThrowable doesn't make much sense (because we have fail-fast behaviour and don't wait until all tasks have finished or have thrown an exception). Therefore, there is no useful semantic in having a CompositeThrowable which returns "some" exceptions. I have done extensive research into C#'s approach (which is very similar to what Scala did until now, but even more messy) and the key observation from asking multiple C# developers is that not a single one had understood how PLINQ handled exceptions or could describe the semantics of it. As a consequence, either a) gather and return all exceptions in a CompositeThrowable or b) just return one, unwrapped, instead of non-deterministically wrapping a non-deterministic number of exceptions into a completely unrelated wrapper type. Considering that changing the parallel collection semantics in such a profound way as described in a) is out of question, b) is chosen. As soon as Scala targets Java > 7 Throwable#addSurpressed can be used to add further exceptions to the one which gets returned. This would allow passing more information to the caller without compromising the simplicity of the API.
* | | | | Merge pull request #2579 from vigdorchik/list_mapJames Iry2013-05-283-28/+41
|\ \ \ \ \ | |/ / / / |/| | | | SI-7502 removing non-existent element from ListMap leaves it unchaged.
| * | | | SI-7502 removing non-existent element from ListMap returns same map.Eugene Vigdorchik2013-05-223-28/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current imperative version constructs a new ListMap regardless of the fact the map doesn't contain the element. Replace it with the tail-recursive variant that conserves. Also replace some usages with the invariant now held.