summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* add syntactic combinators that represent enumeratorsDen Shabalin2013-11-122-0/+95
|
* move for loop desugaring into tree genDen Shabalin2013-11-124-387/+379
|
* change intermidiate representation of for loop enumeratorsDen Shabalin2013-11-127-55/+107
| | | | | | Encode values into real trees rather than non-tree case classes. This is needed for re-usability of desugaring code between quasiquotes and parser.
* add support for importable attachmentsDen Shabalin2013-11-123-5/+19
| | | | | | | Previously attachments weren't imported by importTree. Now a new marker trait has been added that lets attachments to import themselves to the new universe together with all their innards. Additionally a simpler subtrait is defined to mark attachments that can be imported as-is.
* add some post-typecheck tests for quasiquotesDen Shabalin2013-11-121-5/+25
| | | | | | Typecheck trees with toolbox and check that they are still matched by corresponding quasiquote. Fix tuples and function types matchers to account for different shape of trees after typing.
* add hasAttachment utility method to the internal apiDen Shabalin2013-11-122-1/+2
|
* make internal implementation of universe.build less restrictiveDen Shabalin2013-11-121-26/+16
| | | | | | | 1. Use protected instead of private to avoid needless lock-in 2. Use BuildImpl field type to expose non-protected members to the compiler (user-facing side in the reflection api stays the same)
* deduplicate tuple tree creation codeDen Shabalin2013-11-126-39/+34
| | | | | | Previously tuple tree generation code has been implemented in three place: tree builder, tree gen, build utils. Now it's just defined once in tree gen.
* Merge pull request #3100 from som-snytt/paulp/reductionJason Zaugg2013-11-082-130/+175
|\ | | | | Paulper stack reduction
| * Parser stack reduction peekingAheadSom Snytt2013-11-081-14/+30
| | | | | | | | | | | | | | | | Restores a form of the previous peekAhead bookkeeping. Instead of tracking the current token and offset outside of xxxAhead, peekingAhead uses `in.prev` and will push back if the operation results in an empty tree.
| * Parser stack reduction discussionSom Snytt2013-11-081-13/+14
| | | | | | | | Check files
| * Rewrites the parser stack reduction logic.Paul Phillips2013-11-081-128/+118
| | | | | | | | | | | | | | Centralizes the scattered logic surrounding erroneous pattern syntax. Consolidates the redundant lookahead implementations. Eliminates var manipulation in favor of recursion.
| * A value class for Precedence.Paul Phillips2013-11-081-0/+38
| | | | | | | | | | One fewer Int to be whizzing around the parser hoping to be confused with other Ints.
* | Merge pull request #3108 from adriaanm/faster-buildAdriaan Moors2013-11-081-22/+47
|\ \ | | | | | | Faster PR validation
| * | De-duplicate logic in maven deployment.Adriaan Moors2013-11-061-22/+47
| | |
* | | Merge pull request #3094 from retronym/topic/erasure-optJames Iry2013-11-083-13/+19
|\ \ \ | |_|/ |/| | Avoid needless TypeRef allocation during erasure.
| * | Address review commentsJason Zaugg2013-11-082-2/+2
| | | | | | | | | | | | | | | - anonymize unused pattern binder - avoid negations
| * | Avoid needless TypeRef allocation during erasure.Jason Zaugg2013-11-083-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - ThisType(some.package) need not be erased, we can let that prefix through unchanged and avoid churning through allocations. - Sharpen the condition in `rebindInnerClass`. The answer to the deleted comment in the code, is "anonymous and local classes", which are specifically excluded in the new formulation. - Finally, detect if erasure of the TypeRef is an identity and reuse the original. Waste not, want not. To expand on the first point, here is what used to happen during erasure: scala> val scalaPack = typeOf[Predef.type].prefix scalaPack: $r.intp.global.Type = scala.type scala> typeDeconstruct.show(scalaPack) res19: String = ThisType(package scala) scala> typeDeconstruct.show(erasure.scalaErasure(scalaPack)) res20: String = TypeRef(TypeSymbol(final class scala extends )) Showing one step of the erasure type map: scala> typeDeconstruct.show(scalaPack.asInstanceOf[SubType].underlying.typeOfThis) res21: String = SingleType(pre = ThisType(package <root>), package scala)
* | | Merge pull request #3103 from Ichoran/topic/tidy-collectionsJames Iry2013-11-0872-23/+197
|\ \ \ | |/ / |/| | Topic/tidy collections
| * | Collections library tidying and deprecation. Separate parts are listed below.Rex Kerr2013-11-0772-23/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Collections library tidying, part one: scripting. Everything in scala.collection.scripting is deprecated now, along with the << method that is implemented in a few other classes. Scripting does not seem used at all, and anyone who did can easily write a wrapper that does the same thing. Deprecated *Proxy collections. The only place proxies were used in the library was in swing.ListView, and that was easy to change to a lazy val. Proxy itself is used in ScalaNumberProxy and such, so it was left undeprecated. Deprecated Synchronized* traits from collections. Synchronizability does not compose well, and it requires careful examination of every method (which has not actually been done). Places where the Scala codebase needs to be fixed (eventually) include: scala.reflect.internal.util.Statistics$QuantMap scala.tools.nsc.interactive.Global (several places) Deprecated LinkedList (including Double- and -Like variants). Interface is idiosyncratic and dangerously low-level. Although some low-level functionality of this sort would be useful, this doesn't seem to be the ideal implementation. Also deprecated the extractFirst method in Queue as it exposes LinkedList. Cannot shift internal representations away from LinkedList at this time because of that method. Deprecated non-finality of several toX collection methods. Improved documentation of most toX collection methods to describe what the expectation is for their behavior. Additionally deprecated overriding of - toIterator in IterableLike (should always forward to iterator) - toTraversable in TraversableLike (should always return self) - toIndexedSeq in immutable.IndexedSeq (should always return self) - toMap in immutable.Map (should always return self) - toSet in immutable.Set (should always return self) Did not do anything with IterableLike.toIterable or Seq/SeqLike.toSeq since for some odd reason immutable.Range overrides those. Deprecated Forwarders from collections. Forwarding, without an automatic mechanism to keep up to date with changes in the forwarded class, is inherently unreliable. Absent a mechanism to keep current, they're deprecated. ListBuffer is the only class in the collections library that uses forwarders, and that functionality can be rolled into ListBuffer itself. Deprecating immutable set/map adaptors. They're a bad idea (barring compiler support) for the same reason that all the other adaptors are a bad idea: they get out of date and probably have a variety of performance bugs. Deprecated inheritance from leaf classes in immutable collections. Inheriting from leaf-classes in immutable collections is rarely a good idea since whenever you use any interesting collections method you'll revert to the original class. Also, the methods are often designed to work with only particular behavior, and an override would be difficult (at best) to make work. Fortunately, people seem to have realized this and there are few to no cases of people extending PagedSeq and TreeSet and the like. Note that in many cases the classes will become sealed not final. Deprecated overriding of methods and inheritance from various mutable collections. Some mutable collections seem unsuited for overriding since to override anything interesting you would need vast knowledge of internal data structures and/or access to private methods. These include - ArrayBuilder.ofX classes. - ArrayOps - Some methods of BitSet (moved others from private to protected final) - Some methods of HashTable and FlatHashTable - Some methods of HashMap and HashSet (esp += and -= which just forward) - Some methods of other maps and sets (LinkedHashX, ListMap, TreeSet) - PriorityQueue - UnrolledBuffer This is a somewhat aggressive deprecation, the theory being better to try it out now and back off if it's too much than not attempt the change and be stuck with collections that can neither be safely inherited nor have implementation details changed. Note that I have made no changes--in this commit--which would cause deprecation warnings in any of the Scala projects available on Maven (at least as gathered by Adriaan). There are deprecation warnings induced within the library (esp. for classes/traits that should become static) and the compiler. I have not attempted to fix all the deprecations in the compiler as some of them touch the IDE API (but these mostly involved Synchronized which is inherently unsafe, so this should be fixed eventually in coordination with the IDE code base(s)). Updated test checks to include new deprecations. Used a higher level implementation for messages in JavapClass.
* | | Merge pull request #3092 from retronym/ticket/7678-2Grzegorz Kossakowski2013-11-0829-164/+240
|\ \ \ | | | | | | | | Small implicit optimizations, and SI-7678 RunDefinitions
| * | | SI-7678 Don't cache member symbols of TypeTags in Definitions.Jason Zaugg2013-11-0828-148/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It we can only safely use vals in Definitions for top-level symbols. Otherwise, when the IDE switches to loading the symbol from source, we can hold on to a stale symbol, which in turn impedes implicit materialization of TypeTags. This commit moves (most) of the accessors for member symbols into RunDefinitions, and changes calling code accordingly. This is a win for presentation compiler correctness, and might even shave of a few cycles. In a few cases, I have had to leave a `def` to a member symbol in Definitions so we can get to it from the SymbolTable cake, which doesn't see RunDefinitions. The macro FastTrack facility now correctly recreates the mapping from Symbol to macro implementation each run, using a new facility in perRunCaches to create a run-indexed cache. The enclosed test recreates the situation reported in the ticket, in which TypeTags.scala is loaded from source.
| * | | Add a per-run cache for member symbolsJason Zaugg2013-11-084-18/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are all used to calls to `definitions.PredefModule`, or `defintions.Predef_???` to grab the symbol of some well known entity. But you'll notice that some of these are lazy vals, and others are defs. Why is this so? In the presentation compiler, a member like `Predef.???` will be assigned a new symbol after the user browses into `Predef.scala`. Mistakenly using vals in definitions leads to subtle IDE bugs like SI-7678. We are able to trigger these situations in tests, as noted in the comments of that issue. Changing the vals to defs, on the other hand, has a performance penalty. Some schemes to workaround this have shown up: cache them per-implicit search, or compare method names and owners rather than symbols on hot paths in the type checker. This commit introduces a facility to cache these sort of symbols per-run, and uses it to check for `Predef.conforms` and and for the class/type tag materializers. A followup pull request (WIP: https://github.com/retronym/scala/compare/ticket/7678-2) will expand the use of to address the widespread and unsafe caching of member symbols that I found while investigating SI-7678.
| * | | Cache ImplicitInfo#isCyclicOrErroneousJason Zaugg2013-11-081-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An optimization in implicit search. ImplicitInfo-s themselves are cached (per-run) in Contexts (for in-scope implicits) and in Implicits (for companion object implicits.)
| * | | Fast path for ByNameClass in isImpossibleSubtypeJason Zaugg2013-11-081-1/+1
| |/ / | | | | | | | | | | | | | | | These show up often due to the way that searches for implicit views operate: firstly `A=>B` is sought, and failing that `(=>A) => B`.
* | | Merge pull request #3101 from xeno-by/ticket/7776Eugene Burmako2013-11-071-4/+7
|\ \ \ | |/ / |/| | SI-7776 post-erasure signature clashes are now macro-aware
| * | SI-7776 post-erasure signature clashes are now macro-awareEugene Burmako2013-11-051-4/+7
| | | | | | | | | | | | | | | | | | | | | "double definition: macro this and method that have same type after erasure" This error doesn't make sense when macros are involved, because macros expand at compile-time, where we're not affected by erasure. Moreover, macros produce no bytecode, which means that we're safe from VerifyErrors.
* | | Merge pull request #3042 from gourlaysama/t7634-repl-sh-is-brokenAdriaan Moors2013-11-071-1/+1
|\ \ \ | | | | | | | | SI-7634 resurrect the REPL's :sh command
| * | | SI-7634 resurrect the REPL's :sh commandAntoine Gourlay2013-11-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | ProcessResult had a companion object in 2.10 that somehow disappeared in 2.11. It only called "new ProcessResult(...)", so the REPL might just as well do that.
* | | | Merge pull request #3081 from JamesIry/wip_delayed_delambdafy_cleanupAdriaan Moors2013-11-0716-196/+811
|\ \ \ \ | | | | | | | | | | Delay delambdafication and put the lambda's body into the containing class
| * | | | Make specialization aware of anonymous functions.James Iry2013-11-062-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During development of late delmabdafying there was a problem where specialization would undo some of the work done in uncurry if the body of the lambda had a constant type. That would result in a compiler crash as when the delambdafy phase got a tree shape it didn't understand. This commit has a fix and a test.
| * | | | Make GenASM not eliminate loadmodule on static methods.James Iry2013-11-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During development of delayed delambdafy there was a problem where GenASM would eliminate a loadmodule for all methods defined within that module even if those methods were static. The result would be broken byte code that failed verification. This commit fixes that and adds a test.
| * | | | Flesh out the Delambdafy phase.James Iry2013-11-063-4/+458
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit puts a real body on the Delambdafy phase. From a lambda, Delambdafy will create 1) a static forwarder at the top level of the class that contained the lambda 2) a new top level class that a) has fields and a constructor taking the captured environment (including possbily the "this" reference) b) an apply method that calls the static forwarder c) if needed a bridge method for the apply method 3) an instantiation of the newly created class which replaces the lambda Trees.scala is modified to add two more convenient factories for templates and classdefs. A few basic tests are included to verify that it works as expected. Further commits will have additional tests.
| * | | | Refactor Erasure for delambdafication.James Iry2013-11-065-168/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is purely a refactor. It pulls code needed to adapt a tree of one type into a tree of another type (by casting, boxing, coercing, etc) out of Erasure and into common locations that will be usable from the Delambdafy phase.
| * | | | Adds a setting to delay delambdafication. If set then uncurry liftsJames Iry2013-11-062-21/+108
| | | | | | | | | | | | | | | | | | | | | | | | | the body of a lambda into a local def. Tests are included to show the different tree shapes.
| * | | | Add a skeletal Delambdafy phase.James Iry2013-11-014-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a do-nothing phase called "Delambdafy" that will eventually be responsible for doing the final translation of lambdas into classes.
* | | | | Merge pull request #3104 from dotta/update-eclipse-setup-instructionsGrzegorz Kossakowski2013-11-073-4/+15
|\ \ \ \ \ | | | | | | | | | | | | Update eclipse setup instructions
| * | | | | Updated instructions for setting up Eclipse for Scala developmentMirco Dotta2013-11-071-0/+11
| | | | | |
| * | | | | Updated Eclipse .classpath of partest and scaladoc projectsMirco Dotta2013-11-072-4/+4
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | The version of some of the dependencies used in partest and scaladoc projects did not match the version defined in `version.properties`. This prevented the above projects from compiling correctly because the old dependencies were not available in the local maven repository.
* | | | | Merge pull request #3095 from retronym/topic/opt-no-runtime-reflectGrzegorz Kossakowski2013-11-072-13/+16
|\ \ \ \ \ | |_|_|_|/ |/| | | | Don't use runtime reflection from the batch compiler.
| * | | | Don't use runtime reflection from the batch compiler.Jason Zaugg2013-11-012-13/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not only does this save a big chunk of time on startup by avoiding classloading and symbol table population, but it also seems to improve steady state performance of the compiler. Theory: JIT can optimize more aggressively without the SynchronizedXxx decorators and the like being in the classloader. See "Class Heirarchy Analyis" in [1] This commit does this by: - Avoiding use of FromString in pattern matcher, instead using an established mechanism to parse system properties. - Changes FromString back to use OptManifest. AFAICT, this is now only a dependency of scala.tools.cmd.gen.Codegen, so this is just a defensive measure. The REPL still uses runtime reflection, so will pay a little performance tax. Benchmark: avg shortest 10 times 744ms # before avg shortest 10 times 675ms # after [1] https://wikis.oracle.com/display/HotSpotInternals/PerformanceTechniques
* | | | | Merge pull request #3086 from axel22/topic/pc-execution-contextAdriaan Moors2013-11-052-10/+87
|\ \ \ \ \ | | | | | | | | | | | | - parallel collections should use default ExecutionContext
| * | | | | SI-7938 - parallel collections should use default ExecutionContextAleksandar Prokopec2013-10-292-10/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Parallel collections now use `scala.concurrent.ExecutionContext` by default. The `ExecutionContextTaskSupport` is optimized to use the `ForkJoinPool` underlying the `ExecutionContext` if possible. Otherwise, a fallback `TaskSupport` that creates a reduction tree and execute an operation through `Future`s is used.
* | | | | | from Issue #3098Xusen Yin2013-11-051-2/+2
| |_|/ / / |/| | | | | | | | | from Issue #3098, some typos.
* | | | | Merge pull request #3088 from retronym/ticket/7944Jason Zaugg2013-11-031-1/+5
|\ \ \ \ \ | | | | | | | | | | | | SI-7944 FOUND: stray undetermined type params in vicinity of implicits
| * | | | | SI-7944 FOUND: stray undetermined type params in vicinity of implicitsJason Zaugg2013-10-311-1/+5
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicit search created a nested Context into which the results of its typechecking, namely, errors and undetermined type parameters (roughly: those inferred as Nothing) are stashed. The code the drives the process was checking for errors, but discarded those undetermined type parameters. This commit copies them from the child context to the parent, which lets `Typer#adapt` to get to: else if (hasUndetsInMonoMode) { // (9) assert(!context.inTypeConstructorAllowed, context) //@M instantiatePossiblyExpectingUnit(tree, mode, pt) } Our lost TypeVar has found its way home! The reward for which is being instantiated, based on another type inference session adapting the expression's type to the expected type.
* / | | | Collections: remove redundant calls to .seqJason Zaugg2013-10-319-13/+13
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Students of Scala's history might recall that at introduction of parallel collections, GenIterable et al were *not* added; instead the parallel collections inherited from the existing interfaces. This of course was an invitation to widespread disaster as any existing code that foreach-ed over a collection might now experience unwanted concurrency. The first attempt to fix this was to add the `.seq` method to convert a parallel colleciton to a sequential one. This was added in e579152f732, and call sites in the standard library with side-effecting foreach calls were changed to use that. But this was (rightly) deemed inadequate, as we could hardly expect people to change existing code or remember to do this in new code. So later, in 3de96153e5b, GenIterable was sprouted, and parallel collections were re-parented. This commit removes residual needless calls to .seq when the static type of the receiver is already a plain Iterable, which are no-ops.
* | | | Merge pull request #3084 from retronym/topic/optJason Zaugg2013-10-302-2/+3
|\ \ \ \ | |_|/ / |/| | | Microoptimization in implicit search
| * | | Microptimization in implicit searchJason Zaugg2013-10-282-2/+3
| |/ / | | | | | | | | | Avoid creating a throwaway list of parameter types.
* | | Merge pull request #3076 from soc/SI-7605-deprecate-proceduresJames Iry2013-10-291-1/+9
|\ \ \ | | | | | | | | SI-7605 Deprecate procedure syntax