summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Make AnyRefMap serializableJason Zaugg2015-09-252-2/+5
|
* Merge pull request #4764 from lrytz/sd-33Jason Zaugg2015-09-243-26/+47
|\ | | | | SD-33 Consider methods annotated @CallerSensitive not safe to inline
| * SD-33 Consider methods annotated @CallerSensitive not safe to inlineLukas Rytz2015-09-233-26/+47
| | | | | | | | | | | | | | Fixes https://github.com/scala/scala-dev/issues/33 Methods annotated `sun.reflect.CallerSensitive` should not be inlined, their implementation may depend on the call stack.
* | Merge pull request #4763 from lrytz/inlineDeserializeLambdaJason Zaugg2015-09-2417-151/+203
|\ \ | |/ |/| Add $deserializeLambda$ when inlining an indyLambda into a class
| * Add $deserializeLambda$ when inlining an indyLambda into a classLukas Rytz2015-09-237-29/+75
| | | | | | | | | | | | | | | | Fixes https://github.com/scala/scala-dev/issues/39 When inlining an indyLambda closure instantiation into a class, and the closure type is serializable, make sure that the target class has the synthetic `$deserializeLambda$` method.
| * Move addLambdaDeserialize into the BTypes assemblyLukas Rytz2015-09-234-62/+65
| | | | | | | | | | This allows accessing the method from the inliner, which doesn't have access to the Global instance.
| * Rename the Analyzers backend component to BackendUtilsLukas Rytz2015-09-2311-18/+21
|/ | | | | Until now, there was no good place to hold various utility functions that are used acrosss the backend / optimizer.
* Merge pull request #4761 from lrytz/merge-2.11-to-2.12-sep-22Lukas Rytz2015-09-22176-457/+1203
|\ | | | | Merge 2.11 to 2.12 sep 22
| * Merge commit 'a6c1687' into merge-2.11-to-2.12-sep-22Lukas Rytz2015-09-220-0/+0
| |\
| | * Merge pull request #4757 from lrytz/t9375-2.11Lukas Rytz2015-09-229-9/+371
| | |\ | | | | | | | | [backport] SI-9375 add synthetic readResolve only for static modules
| | | * [backport] SI-9375 add synthetic readResolve only for static modulesLukas Rytz2015-09-229-9/+371
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For inner modules, the synthetic readResolve method would cause the module constructor to be invoked on de-serialization in certain situations. See the discussion in the ticket. Adds a comprehensive test around serializing and de-serializing modules.
| * | | Merge commit '03aaf05' into merge-2.11-to-2.12-sep-22Lukas Rytz2015-09-2243-355/+945
| |\| |
| | * | Merge pull request #4759 from SethTisue/bump-ant-version-in-readmeSeth Tisue2015-09-211-1/+1
| | |\ \ | | | | | | | | | | bump required Ant version in README.md
| | | * | bump required Ant version in README.mdSeth Tisue2015-09-211-1/+1
| | |/ / | | | | | | | | | | | | | | | | (a little missing piece of https://github.com/scala/scala/pull/4746 we missed at review time)
| | * | Merge pull request #4725 from retronym/topic/completely-2.11Lukas Rytz2015-09-2131-199/+796
| | |\ \ | | | | | | | | | | Topic/completely 2.11
| | | * | Remove used param and document positionDeltaJason Zaugg2015-09-213-8/+9
| | | | |
| | | * | Merge remote-tracking branch 'origin/2.11.x' into topic/completely-2.11Jason Zaugg2015-09-17152-126/+333
| | | |\ \
| | | * | | Workaround JLine bug for mid-line tab completionJason Zaugg2015-09-111-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ``` scala> {" ".char<TAB>} charAt chars scala> {" ".char<CURSOR>}} ``` I noticed that pressing <SPACE>-<BACKSPACE> re-rendered the line correctly, so I've added this workaround to our customization of the JLine console reader. After: ``` scala> {" ".char<TAB>} charAt chars scala> {" ".char<CURSOR>} ``` We can delete this workaround when JLine 2.13.1 is released, but I haven't heard back about when this might happen.
| | | * | | Fix REPL completion of symbolic identifiersJason Zaugg2015-09-102-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recover part of the identifier that preceded the cursor from the source, rather than from the name in the `Select` node, which might contains an encoded name that differs in length from the one in source.
| | | * | | Fix completion for synthetic case modules and methodsJason Zaugg2015-09-103-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm pretty sure the `isSynthetic` call added in 854de25ee6 should instead be `isArtifact`, so that's what I've implemented here. `isSynthetic` used to also filter out error symbols, which are created with the flags `SYNTHETIC | IS_ERROR`. I've added an addition test for `isError`, which was needed to keep the output of `presentation/scope-completion-import` unchanged. The checkfile for `presentation/callcc-interpreter` is modified to add the additional completion proposals: synthetic companion objects.
| | | * | | Hide some completion candidates on the first TABJason Zaugg2015-09-092-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When `foo.<TAB>`, assume you don't want to see the inherited members from Any_ and universally applicable extension methods like `ensuring`. Hitting <TAB> a second time includes them in the results.
| | | * | | Fix completion for multi-line entriesJason Zaugg2015-09-093-16/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to include the previously entered lines into the code that we presentation compile. Management of this state makes the interpret method non tail recursive, so we could blow the default stack with a multi-line entry of hundreds of lines. I think thats an acceptable limitation.
| | | * | | More liberal matching in REPL autocompletionJason Zaugg2015-09-092-9/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the SHIFT-impaired: you can just write everything in lowercase, (whisper-case?) and we'll try to DWYM. We treat capital letters that you *do* enter as significant, they can't match a lower case letter in an identifier. Modelled after IntellIJ's completion. I still don't fall into this mode if you enter an exact prefix of a candidate, but we might consider changing that. ``` scala> classOf[String].typ<TAB> getAnnotationsByType getComponentType getDeclaredAnnotationsByType getTypeName getTypeParameters scala> classOf[String].typN<TAB> scala> classOf[String].getTypeName res3: String = java.lang.String scala> def foo(s: str<TAB> scala> def foo(s: String String StringBuffer StringBuilder StringCanBuildFrom StringContext StringFormat StringIndexOutOfBoundsException scala> def foo(s: string<TAB> scala> def foo(s: String String StringBuffer StringBuilder StringCanBuildFrom StringContext StringFormat StringIndexOutOfBoundsException ```
| | | * | | Exclude <byname> and friends from REPL completionJason Zaugg2015-09-092-2/+4
| | | | | |
| | | * | | Camel Case and JavaBean completionJason Zaugg2015-09-083-15/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is just too useful to leave on the cutting room floor. ``` scala> classOf[String].enclo<TAB> scala> classOf[String].getEnclosing getEnclosingClass getEnclosingConstructor getEnclosingMethod scala> classOf[String].simpl<TAB> scala> classOf[String].getSimpleName type X = global.TTWD<TAB> scala> type X = global.TypeTreeWithDeferredRefCheck ``` I revised the API of `matchingResults` as it was clunky to reuse the filtering on accessibility and term/type-ness while providing a custom name matcher.
| | | * | | Sort completion proposalsJason Zaugg2015-09-032-1/+4
| | | | | |
| | | * | | Don't offer `asInstanceOf` et al as completions in a fresh REPLJason Zaugg2015-09-032-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trying harder to keep the synthetic interpretter wrapper classes behind the curtain
| | | * | | Add the prefix the autocompletion results (Scope-, TypeMember)Jason Zaugg2015-09-034-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes life easier for clients of these APIs, we use this to avoid passing this around in the wrapper result `TypeMembers`.
| | | * | | Remove unneeded codeJason Zaugg2015-09-031-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | Move misplaced and malindented comment and remove two lines of unneeded code.
| | | * | | Use the presentation compiler to drive REPL tab completionJason Zaugg2015-09-0212-53/+426
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old implementation is still avaiable under a flag, but we'll remove it in due course. Design goal: - Push as much code in src/interactive as possible to enable reuse outside of the REPL - Don't entangle the REPL completion with JLine. The enclosed test case drives the REPL and autocompletion programatically. - Don't hard code UI choices, like how to render symbols or how to filter candidates. When completion is requested, we wrap the entered code into the same "interpreter wrapper" synthetic code as is done for regular execution. We then start a throwaway instance of the presentation compiler, which takes this as its one and only source file, and has a classpath formed from the REPL's classpath and the REPL's output directory (by default, this is in memory). We can then typecheck the tree, and find the position in the synthetic source corresponding to the cursor location. This is enough to use the new completion APIs in the presentation compiler to prepare a list of candidates. We go to extra lengths to allow completion of partially typed identifiers that appear to be keywords, e.g `global.def` should offer `definitions`. Two secret handshakes are included; move the the end of the line, type `// print<TAB>` and you'll see the post-typer tree. `// typeAt 4 6<TAB>` shows the type of the range position within the buffer. The enclosed unit test exercises most of the new functionality.
| | | * | | Add a convenience method to Symbol to "resugar" fieldsJason Zaugg2015-09-021-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | val and var members of classes are split into getter/setter and field symbols. However, we can't call `defString` on any of these and see what existed in source code. Example: ``` scala> class X { protected var x: Int = 0 } defined class X scala> val xField = typeOf[X].member(TermName("x ")) xField: $r.intp.global.Symbol = variable x scala> xField.defString res10: String = private[this] var x: Int scala> xField.getterIn(xField.owner).defString res11: String = protected def x: Int scala> xField.setterIn(xField.owner).defString res12: String = protected def x_=(x$1: Int): Unit ``` This commit introduces a new method on `Symbol` that pieces together the information from these symbols to create an artificial symbol that has the `defString` we're after: ``` scala> xField.sugaredSymbolOrSelf.defString res14: String = protected var x: Int ```
| | | * | | REPL depends on presentation compilerJason Zaugg2015-09-022-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation for use of the presentation compiler to drive REPL tab completion, add a dependency in the build. As far as the outside world is concerned, these are already comingled in scala-compiler.jar, and this patch doesn't change that.
| | | * | | Publicize method in the presentation compilerJason Zaugg2015-09-021-1/+1
| | | | | |
| | | * | | Add a higher level completion API to the pres compilerJason Zaugg2015-09-021-1/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conveniences added: - The client need not determine ahead of time whether it wants scope completions of type member completions, this is inferred from the tree at the cursor - Computes the delta from the cursor to point where a suggested completion item should be written. This includes finding the position of the name within a Select node, which is tricky. - Includes a matcher that matches results base on prefix, accessibility and suitability in the syntactic location. Type members are not offered in term positions, and term members only offered in type position if they could for a prefix for a type. E.g. `type T = glob<TAB>` should offer `global` to help writing `global.Tree`.
| | | * | | Add an option to let pres compiler user manage threadingJason Zaugg2015-09-022-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The presentation compiler currently demands that all interaction is performed by asynchronous submission of work items, which are queued and executed on the presentation compiler thread. This is fairly inconvenient if you are a known-single-threaded client that is trying to use the compiler from your own thread. This commit adds an option to disable "assertCorrectThread" to better support this use case.
| | | * | | SI-5408 Prompt after incomplete script pasteSom Snytt2015-09-024-68/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Transcript paste mode invites the user to keep typing like regular paste mode, but really you must enter more transcript. This matters if the script ends in the middle of incomplete code that the user wants to complete by hand. Previously, ``` scala> scala> def f() = { // Detected repl transcript paste: ctrl-D to finish. // Replaying 1 commands from transcript. scala> def f() = { scala> scala> def f() = { // Detected repl transcript paste: ctrl-D to finish. | } // Replaying 1 commands from transcript. scala> def f() = { } f: ()Unit ``` Now, ``` scala> scala> def f() = { // Detected repl transcript. Paste more, or ctrl-D to finish. // Replaying 1 commands from transcript. scala> def f() = { | 42 | } f: ()Int scala> f() res0: Int = 42 ```
| | | * | | Update power mode bannerSom Snytt2015-09-0210-64/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The classic banner is available under -Dscala.repl.power.banner=classic. ``` scala> :power Power mode enabled. :phase is at typer. import scala.tools.nsc._, intp.global._, definitions._ Try :help or completions for vals._ and power._ ```
| | | * | | SI-4438 FindAll implicits after errorJason Zaugg2015-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix cross talk between candidates in ImplicitComputation#findAll. Haoyi reported that he couldn't get the presentation compiler to offer completion suggestions for extension methods on primitive arrays. Turns out that an error in typechecking the previous candidate had not been cleared, and this was taken to mean that `arrayIntOps` was itself ineligible. After this patch: ``` scala> Array(1, 2, 3) reverse reverseIterator reverse reverseMap reversed scala> Array(1,2,3).reverse //print scala.Predef.intArrayOps(scala.Array.apply(1, 2, 3)).reverse scala> Array(1, 2, 3) to toString toCollection toSeq toIterator to toMap toSet toList toArray toBuffer toStream toIterable toTraversable toVector toIndexedSeq scala> Array(1, 2, 3) toSeq override def toSeq: Seq[Int] ```
| | * | | | Merge pull request #4716 from Ichoran/issue/9388Lukas Rytz2015-09-216-46/+128
| | |\ \ \ \ | | | | | | | | | | | | | | SI-9388 Fix Range behavior around Int.MaxValue
| | | * | | | SI-9388 Fix Range behavior around Int.MaxValueRex Kerr2015-09-196-46/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | terminalElement (the element _after_ the last one!) was used to terminate foreach loops and sums of non-standard instances of Numeric. Unfortunately, this could result in the end wrapping around and hitting the beginning again, making the first element bad. This patch fixes the behavior by altering the loop to end after the last element is encountered. The particular flavor was chosen out of a few possibilities because it gave the best microbenchmarks on both large and small ranges. Test written. While testing, a bug was also uncovered in NumericRange, and was also fixed. In brief, the logic around sum is rather complex since division is not unique when you have overflow. Floating point has its own complexities, too. Also updated incorrect test t4658 that insisted on incorrect answers (?!) and added logic to make sure it at least stays self-consistent, and fixed the range.scala test which used the same wrong (overflow-prone) formula that the Range collection did.
| | * | | | | Merge pull request #4736 from gourlaysama/ticket/t9429Lukas Rytz2015-09-211-1/+11
| | |\ \ \ \ \ | | | | | | | | | | | | | | | | SI-9429 fix filtering in scaladoc after focusing on a package
| | | * | | | | SI-9429 fix filtering in scaladoc after focusing on a packageAntoine Gourlay2015-09-151-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The scaladoc left pane used to be refreshed too often until ce5cfd2 when it was changed to only refresh when the filter changed. This forgot one important case when it also must be refreshed: when entering the "focus on a single package" mode (and it has been broken ever since). This forces a refresh when focusing on a package, and makes sure all entities are displayed when filtering.
| | * | | | | | Merge pull request #4758 from lrytz/pagedSeqNpeSeth Tisue2015-09-212-2/+8
| | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix NPE in PagedSeq.slice at end of seq
| | | * | | | | | Fix NPE in PagedSeq.slice at end of seqTomas Janousek2015-09-212-2/+8
| | | | |_|_|_|/ | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/scala/scala-parser-combinators/issues/70 Basically the same thing as SI-6615, including the fact everything works okay if the PagedSeq is printed before calling slice. It might seem strange that this allows taking slices that start beyond the end, but - this was possible anyway if one forced the entire sequence, and - it is reasonable to be able to take a slice at the very end (not beyond it) and get an empty sequence, which is exactly what StreamReader in scala-parser-combinators does and gets an NPE.
| | * | | | | | Merge pull request #4750 from SethTisue/windows-partestLukas Rytz2015-09-212-105/+0
| | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | fix partest on Cygwin
| | | * | | | | | remove old partest.bat batch fileSeth Tisue2015-09-171-104/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this hadn't been touched since 2013, and didn't work when I tried it -- not surprisingly since the classpath stuff for partest changed a lot when Scala was modularized. the shell script works on Cygwin, so the bat file isn't needed. further piece of evidence this file is abandoned and unused: at https://issues.scala-lang.org/browse/SI-3290, in 2010, Lukas Rytz wrote "i never heard somebody saying it was abandoned, but i never heard of somebody using it either."
| | | * | | | | | fix partest to work on CygwinSeth Tisue2015-09-171-1/+0
| | | | |_|_|_|/ | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | note that the code removed here is inside an `if $cygwin; then` block, so it can't affect other environments.
| | * | | | | | Merge pull request #4751 from SethTisue/scala-dash-versionLukas Rytz2015-09-211-2/+2
| | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | bump copyright year in `scala -version`
| | | * | | | | | bump copyright year in `scala -version`Seth Tisue2015-09-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a little piece of #4644 I missed. fixes this: % scala -version Scala code runner version 2.11.7 -- Copyright 2002-2013, LAMP/EPFL
| * | | | | | | | Merge commit '27aada2' into merge-2.11-to-2.12-sep-22Lukas Rytz2015-09-220-0/+0
| |\| | | | | | |