summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Test infrastructure for scope completionJason Zaugg2013-11-1510-22/+22
| | | | | Adds a new marker /*_*/ to trigger scope completion test. Original type completion test oracles update for the tweaked output
* Revert "temporarily disables run/reflection-sync-subtypes"Jason Zaugg2013-11-142-0/+0
| | | | | | | | | This reverts commit 04e2dbb29830d0e511cdfa8c132a9fad91d657ed, by avoiding the ill-fated attempt to short-circuit the global reflection lock. I think we can do better performance wise, but lets at least get something correct to start with.
* Merge pull request #3133 from adriaanm/merge-2.10Adriaan Moors2013-11-148-0/+81
|\ | | | | Merge 2.10
| * Merge commit '6045a05b83' into merge-2.10Adriaan Moors2013-11-133-0/+44
| |\ | | | | | | | | | | | | Conflicts: src/interactive/scala/tools/nsc/interactive/Global.scala
| | * Fix completion after application with implicit argumentsJason Zaugg2013-11-063-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `List(1, 2, 3).map(f).<ctrl-space>` now works; before the tree had the type `(bf: CanBuildFrom[...]):...` and did not contribute completions from the result type. This commit checks if the tree has an implicit method type, and typechecks it as a qualifier. That is enough to get to `adaptToImplicitMethod` in the type checker, infer the implicit arguments, and compute the final result type accordingly.
| | |
| | \
| *-. \ Merge commit '075f6f260c'; commit 'e09a8a2b7f' into merge-2.10Adriaan Moors2013-11-135-0/+37
| |\ \ \
| | | * | SI-4012 Mixin and specialization work wellVlad Ureche2013-11-052-0/+22
| | | |/ | | | | | | | | | | | | The bug was fixed along with SI-7638 in 504b5f3.
| | * / SI-6546 InnerClasses attribute refers to absent classPaul Phillips2013-11-043-0/+15
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At issue is that the optimizer would eliminate closure classes completely, then neglect to eliminate those classes from the container's InnerClasses attribute. This breaks tooling which expects those entries to correspond to real classes. The code change is essentially mgarcia's - I minimized it and put the caches in perRunCaches, and added the test case which verifies that after being compiled under -optimise, there are no inner classes. Before/after: 7,8d6 < InnerClasses: < public final #22; //class A_1$$anonfun$f$1 37,45c35,40 < #21 = Utf8 A_1$$anonfun$f$1 < #22 = Class #21 // A_1$$anonfun$f$1 < #23 = Utf8 Code --- > #21 = Utf8 Code
| | * Merge pull request #3072 from retronym/backport/7519Adriaan Moors2013-10-245-0/+51
| | |\ | | | | | | | | [nomaster] SI-7519 Less brutal attribute resetting in adapt fallback
| | | * SI-7519: Additional test case covering sbt/sbt#914Mark Harrah2013-10-233-0/+26
| | | | | | | | | | | | | | | | (cherry picked from commit e72c32db03b44d6eaf1c1872765a578c5445e15f)
| | | * [nomaster] SI-7519 Less brutal attribute resetting in adapt fallbackJason Zaugg2013-10-232-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prefers `resetLocalAttrs` over `resetAllAttrs`. The latter loses track of which enclosing class of the given name is referenced by a `This` node which prefixes the an applied implicit view. The code that `resetAllAttrs` originally landed in: https://github.com/scala/scala/commit/d4c63b#L6R804 Cherry picked from 433880e91cba9e1e926e9fcbf04ecd4aeb1d73eb Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala
| | * | [nomaster] SI-6026 backport getResource bug fixSom Snytt2013-10-182-0/+18
| | |/ | | | | | | | | | | | | Submitted to master under SI-4936, this fix allows :javap to work when tools.jar is discovered by REPL.
* | | Merge pull request #3129 from adriaanm/pr-rebase-3001Adriaan Moors2013-11-13240-469/+756
|\ \ \ | |/ / |/| | [rebase] blackbox and whitebox macros
| * | blackbox restriction #4: can't customize pattern matchingEugene Burmako2013-11-127-1/+58
| | | | | | | | | | | | | | | | | | When an application of a blackbox macro is used as an extractor in a pattern match, it triggers an unconditional compiler error, preventing customizations of pattern matching implemented with macros.
| * | blackbox restriction #3: can't affect implicit searchEugene Burmako2013-11-1210-11/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | When an application of a blackbox macro is used as an implicit candidate, no expansion is performed until the macro is selected as the result of the implicit search. This makes it impossible to dynamically calculate availability of implicit macros.
| * | blackbox restriction #2: can't guide type inferenceEugene Burmako2013-11-1211-1/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an application of a blackbox macro still has undetermined type parameters after Scala’s type inference algorithm has finished working, these type parameters are inferred forcedly, in exactly the same manner as type inference happens for normal methods. This makes it impossible for blackbox macros to influence type inference, prohibiting fundep materialization.
| * | blackbox restriction #1: can't refine the official return typeEugene Burmako2013-11-1218-21/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an application of a blackbox macro expands into a tree `x`, the expansion is wrapped into a type ascription `(x: T)`, where `T` is the declared return type of the blackbox macro with type arguments and path dependencies applied in consistency with the particular macro application being expanded. This invalidates blackbox macros as an implementation vehicle of type providers.
| * | blackbox and whitebox macrosEugene Burmako2013-11-12210-466/+492
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first commit in the series. This commit only: 1) Splits Context into BlackboxContext and WhiteboxContext 2) Splits Macro into BlackboxMacro and WhiteboxMacro 3) Introduces the isBundle property in the macro impl binding Here we just teach the compiler that macros can now be blackbox and whitebox, without actually imposing any restrictions on blackbox macros. These restrictions will come in subsequent commits. For description and documentation of the blackbox/whitebox separation see the official macro guide at the scaladoc website: http://docs.scala-lang.org/overviews/macros/blackbox-whitebox.html Some infrastructure work to make evolving macros easier: compile partest-extras with quick so they can use latest library/reflect/...
* | | Merge pull request #3090 from densh/pull/undo-forAdriaan Moors2013-11-1315-102/+195
|\ \ \ | | | | | | | | Add support for For loops to quasiquotes
| * | | test legacy .filter support in for loop resugaringDen Shabalin2013-11-121-0/+11
| | | |
| * | | add support for for loops and for enumerators to quasiquotesDen Shabalin2013-11-122-3/+47
| | | | | | | | | | | | | | | | | | | | | | | | 1. q"for (..$enums) $body", q"for (..$enums) yield $body" 2. fq"..." quote to construct/deconstruct enumerators
| * | | implement inverse transformation to mkForDen Shabalin2013-11-122-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This effectively reconstructs a sequence of enumerators and body from the tree produced by mkFor. This lets to define bi-directional SyntacticFor and SyntacticForYield constructors/extractors to work with for loops. Correctness of the transformation is tested by a scalacheck test that generates a sequence of random enumerators, sugars them into maps/flatMaps/foreach/withFilter calls and reconstructs them back.
| * | | make fresh names compare similar in quasiquotesDen Shabalin2013-11-122-4/+26
| | | | | | | | | | | | | | | | | | | | | | | | Otherwise it's annoying that trees that look the same are not equal due to some fresh name hidden underneath. Due to this one test needs to be changed to use plain equalsStructure.
| * | | simplify imports in quasiquotes scalacheck testsDen Shabalin2013-11-1212-91/+25
| | | |
| * | | add some post-typecheck tests for quasiquotesDen Shabalin2013-11-123-2/+45
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | deduplicate tuple tree creation codeDen Shabalin2013-11-122-5/+5
| |/ / | | | | | | | | | | | | | | | 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 #3112 from adriaanm/modularize-scaladocJames Iry2013-11-131-1/+16
|\ \ \ | | | | | | | | Modularize scaladoc... almost
| * | | Refactoring to prepare modularization of the compiler.Adriaan Moors2013-11-121-1/+16
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Actual modularization is delayed until 2.12. The one big (one-line) change is to make the interactive compiler independent of scaladoc. We have one "integration test": `MemoryLeaksTest`. This commit adds a bunch of comments marked `TODO: modularize the compiler`, that should be uncommented when we're ready to continue the modularization effort. I decided to merge them commented out to avoid having to rebase xml patches. There's still some chance of bitrot, but I'm willing to take my chances. I previously refactored the build to make it easier to add jars in a coherent way, which hinges on the `init-project-prop` mechanism, so the relevant properties are already injected there.
* | | Merge pull request #3123 from som-snytt/issue/7747-scrapcodes-fixAdriaan Moors2013-11-123-6/+357
|\ \ \ | | | | | | | | SI-7747 Support class based wrappers in REPL
| * | | SI-7747 Support class based wrappers clean upSom Snytt2013-11-102-27/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simplified the code paths to just use one of two `Wrapper` types for textual templating. Simplified the class-based template to use the same `$iw` name for the both the class and the wrapper value. In addition, the $read value is an object extending $read, instead of containing an extra instance field, which keeps paths to values the same for both templates. Both styles trigger loading the value object by referencing the value that immediately wraps the user code, although for the class style, inner vals are eager and it would suffice to load the enclosing `$read` object. The proposed template included extra vals for values imported from history, but this is not necessary since such an import is always a stable path. (Or, counter-example to test is welcome.) The test for t5148 is updated as a side effect. Probably internal APIs don't make good test subjects. Modify -Y option message.
| * | | SI-7747 Support class based wrappers as alternative through switch ↵Prashant Sharma2013-11-102-0/+360
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -Yrepl-class-based Refactoring to reduce the number of if-else Fix test.
* | | | Merge pull request #3113 from adriaanm/pr-rebase-3046Adriaan Moors2013-11-129-77/+17
|\ \ \ \ | | | | | | | | | | Make parameters to implicit value classes private
| * | | | Make parameters to implicit value classes privateJason Zaugg2013-11-129-77/+17
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So that they aren't offered as an autocomplete suggestion: implicit class Shouty(string: String) extends AnyVal { def SHOUT_! = string.toUpperCase + "!" } "". // autocompletion offers `.string` here The original incarnation of value classes didn't allow this sort of encapsulation, so we either invented goofy names like `__thingToAdd` or just picked `x` or `self`. But SI-7859 has delivered us the freedom to keep the accessor private. Should we keep any of these accessors around in a deprecated form? The implicit classes in Predef were added in 2.11.0-M2 (c26a8db067e4f), so they are okay. I think we can make reason that these APIs were both accidental and unlikely to be interpreted as public, so we can break them immediately. scala> Left(1).x res0: scala.util.Either[Int,Int] = Left(1) scala> import concurrent.duration._ import concurrent.duration._ scala> 1.n res1: Int = 1
* | | | Merge pull request #3121 from rjfwhite/SI-7568James Iry2013-11-121-0/+32
|\ \ \ \ | | | | | | | | | | SI-7568 Adding Serializable to ResizableArrayAccess inner class
| * | | | SI-7568 Adding PriorityQueueTestrjfwhite2013-11-111-0/+32
| | |/ / | |/| |
* | | | Merge pull request #3111 from phaller/issue/7958James Iry2013-11-127-87/+87
|\ \ \ \ | |_|/ / |/| | | SI-7958 Deprecate methods `future` and `promise` in the `scala.concurren...
| * | | SI-7958 Deprecate methods `future` and `promise` in the `scala.concurrent` ↵Philipp Haller2013-11-127-87/+87
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | package object - The corresponding `apply` methods in the `Future` and `Promise` objects should be used instead. - Adjusted tests to use non-deprecated versions - Fixed doc comments not to use deprecated methods - Added comment about planned removal in 2.13.0
* / / M6 modules, partest depends on scala as provided.Adriaan Moors2013-11-111-0/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new partest now marks its scala dependencies as provided. This is much more robust than before, and it breaks ugly cycles. Updated the build for partest-extras to provide the required scala-compiler dependency. Also, upgrade pax-url-aether to 1.6.0. Since our jenkins uses mirrors with passwords, we needed a fix for https://ops4j1.jira.com/browse/PAXURL-217 in order to run osgi.test on jenkins, now that we use maven more. We didn't hit this bug before because we were using a standard location for the maven local repository, but that causes problems with concurrent jenkins jobs accessing it. So, I added the following to `~/.m2/settings`, and then ran into the issue described above. Also removed some non-essential uses of the extra-repo (slows stuff down), and added a comment of how to make the osgi tests look in a certain local m2 repo (for /some/ operations...) ``` <!-- Maven repos are not safe for concurrent access, thus give each job its own. The WORKSPACE env var is set by jenkins to the path of the current job's workspace. This settings file will cause ant/maven to break if WORKSPACE is not set (to a writeable directory). I don't know how to encode a fall back, but I assume it's not needed as this is ~jenkins/.m2/settings.xml --> <localRepository>${WORKSPACE}/m2repo</localRepository> ```
* | Merge pull request #3100 from som-snytt/paulp/reductionJason Zaugg2013-11-085-13/+13
|\ \ | | | | | | Paulper stack reduction
| * | Parser stack reduction peekingAheadSom Snytt2013-11-082-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | 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-085-13/+13
| | | | | | | | | | | | Check files
| * | Rewrites the parser stack reduction logic.Paul Phillips2013-11-083-9/+6
| | | | | | | | | | | | | | | | | | | | | Centralizes the scattered logic surrounding erroneous pattern syntax. Consolidates the redundant lookahead implementations. Eliminates var manipulation in favor of recursion.
* | | Merge pull request #3094 from retronym/topic/erasure-optJames Iry2013-11-081-2/+2
|\ \ \ | |/ / |/| | Avoid needless TypeRef allocation during erasure.
| * | Avoid needless TypeRef allocation during erasure.Jason Zaugg2013-11-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-0816-2/+18
|\ \ \ | |/ / |/| | Topic/tidy collections
| * | Collections library tidying and deprecation. Separate parts are listed below.Rex Kerr2013-11-0716-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-083-0/+72
|\ \ \ | | | | | | | | Small implicit optimizations, and SI-7678 RunDefinitions
| * | | SI-7678 Don't cache member symbols of TypeTags in Definitions.Jason Zaugg2013-11-083-0/+72
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #3101 from xeno-by/ticket/7776Eugene Burmako2013-11-072-0/+20
|\ \ \ | |/ / |/| | SI-7776 post-erasure signature clashes are now macro-aware
| * | SI-7776 post-erasure signature clashes are now macro-awareEugene Burmako2013-11-052-0/+20
| | | | | | | | | | | | | | | | | | | | | "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.