summaryrefslogtreecommitdiff
path: root/test/files/run
Commit message (Collapse)AuthorAgeFilesLines
* SD-120 Non FunctionN lambdas should not be universally serializableJason Zaugg2016-07-222-1/+48
| | | | | | | | Instead, we follow the example set by javac, and predicate serializability of bot anon-class and invokedynamic-based lambdas on whether or not the SAM type extends java.io.Serializable. Fixes https://github.com/scala/scala-dev/issues/120
* Upgrade asm to 5.1Lukas Rytz2016-07-202-2/+7
| | | | | The constructor of scala.tools.asm.Handle now takes an additional boolean parameter to denote whether the owner is an interface.
* Merge pull request #5257 from szeiger/wip/final-tuplesLukas Rytz2016-07-202-3/+3
|\ | | | | SI-7301 Make tuple classes final
| * SI-7301 Make tuple classes finalStefan Zeiger2016-07-072-3/+3
| | | | | | | | | | This includes undoing the special case for `-Xfuture` introduced in https://github.com/scala/scala/pull/2299 and updating tests to take the new errors into account.
* | Merge pull request #5265 from szeiger/issue/6947Adriaan Moors2016-07-181-3/+3
|\ \ | | | | | | SI-6947 Better type parameter names for Map classes
| * | SI-6947 Better type parameter names for Map classesStefan Zeiger2016-07-071-3/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Type parameter names are currently assigned pretty much alphabetically without any meaning. This change renames all key parameters in Map classes from `A` to `K` and all value parameters from `B` to `V` to make them more meaningful. Derived names are renamed accordingly (e.g. `V1` instead of `B1` for an upper bound on `V`, `W` instead of `C` for a new value type). As a side-effect this solves the documentation problem in SI-6947. Due to using `B` both as a type parameter for `foldLeft[B]` in `GenTraversableOnce[A]` and in `Map[A, B]` which extends `GenTraversableOnce[(A, B)]`, the signature of `Map.foldLeft` was rendered in scaladoc as def foldLeft[B](z: B)(op: (B, (A, B)) ⇒ B): B Now you get an unambiguous version: def foldLeft[B](z: B)(op: (B, (K, V)) ⇒ B): B
* | Merge pull request #5246 from jodersky/javadocAdriaan Moors2016-07-181-2/+2
|\ \ | | | | | | SI-4826 Retain javadoc comments in scaladoc [ci: last-only]
| * | Retain javadoc comments in scaladocJakob Odersky2016-07-151-2/+2
| | | | | | | | | | | | | | | * Hook into java parser to generate doc comments * Generate empty trees for java implementation bodies
* | | Merge pull request #5285 from szeiger/wip/sbt-bootstrapAdriaan Moors2016-07-181-2/+6
|\ \ \ | | | | | | | | Switch the bootstrap build over to sbt
| * | | Switch the bootstrap build over to sbtStefan Zeiger2016-07-151-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All of the individual ant builds that occured during `bootstrap` are replaced by equivalent sbt builds. - Allow extra dashes in version suffix when using SPLIT - Clean up ScriptCommands - Building an extra `locker` for stability testing with ant was not necessary but sbt also drops `strap`, so we need to build again with `quick` to get the equivalent of `strap`. The script for checking stability is invoked directly from the bootstrap script, not from sbt. - `STARR` and `locker` build output is still logged to `logs/builds`, the main build runs log directly to the main console with colored output. - Allow `—show-log` option on partest command line in sbt - Normalize inferred LUB in `run/t7747-repl.scala` - Add `normalize` feature from `ReplTest` to `InteractiveTest` - Normalize inferred LUBs in `presentation/callcc-interpreter`
* | | | Merge pull request #5273 from retronym/ticket/9855Adriaan Moors2016-07-181-3/+3
|\ \ \ \ | | | | | | | | | | SI-9855 Fix regression in extractor pattern translation
| * | | | SI-9855 Fix regression in extractor pattern translationJason Zaugg2016-07-141-3/+3
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In faa5ae6, I changed the pattern matchers code generator to use stable references (`Ident`-s with the singleton type, rather than the widened type) to the synthetic vals used to store intermediate results ("binders"). In the case where the scrutinee matched the unapply parameter type of some extractor pattern, but the pattern subsequently failed, this led to an regression. It turns out that this was due to the way that the type of the binder was mutated to upcast to the exact type of a subsequent pattern in `ensureConformsTo`: https://github.com/scala/scala/blob/953559988/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala#L165-L174 This was added in 32c57329a as a workaround for the problem caused in t6664.scala, when the binder type was `KList with KCons`, and the code generator wasn't able to find the case field accessors for `KCons` in the decls. The change to use stable references meant that this mutation was now observed in another part of the tree, as opposed to the 2.11.8 situation, where we had used the original, sharper type of the binder eagerly to assign to the `Ident` that referred to it. This led to a tree: Assign(Ident(x3), Ident(x1).setType(x1.tpe) Now that we instead refer generate: Assign(Ident(x3), Ident(x1).setType(stableTypeFor(x1)) and we don't typecheck this until after the mutation of `x1.symbol.info`, we can get a type error. This commit removes this mutation of the binder type altogether, and instead uses `aligner.wholeType`, which is based on the result type of the `Apply(TypeTree(MethodType(params, resultType))` that encodes a typechecked constructor pattern. In `t6624.scala`, this is `KCons`, the case class that has the extractors as its decls.
* | | | Deprecated and rename Some#x to Some#valueDale Wijnand2016-07-151-4/+4
| |/ / |/| |
* | | Merge pull request #5264 from lrytz/t8561Lukas Rytz2016-07-131-22/+15
|\ \ \ | | | | | | | | SI-8561 named subclasses for known Manifest / ClassTag instances
| * | | SI-8561 named subclasses for known Manifest / ClassTag instancesLukas Rytz2016-07-061-22/+15
| | |/ | |/| | | | | | | | | | | | | This helps keeping ClassTag serialization stable under accidental changes (like changing the order of definitions, which would change the name of the anonymous classes).
* | | Merge pull request #5234 from som-snytt/review/printersLukas Rytz2016-07-132-5/+4
|\ \ \ | |_|/ |/| | Avoid triple-quoting triple quotes in printer
| * | Constant print control in unicodeSom Snytt2016-06-162-5/+4
| | | | | | | | | | | | | | | Since octal escape is deprecated, use unicode escape for string representation of constants.
* | | Merge pull request #5247 from mo/2.12.xAdriaan Moors2016-07-051-1/+1
|\ \ \ | |_|/ |/| | Fix typo in test comment
| * | Fix typo in test commentMartin Olsson2016-06-261-1/+1
| |/
* | Emit trait method bodies in staticsJason Zaugg2016-06-287-15/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And use this as the target of the default methods or statically resolved super or $init calls. The call-site change is predicated on `-Yuse-trait-statics` as a stepping stone for experimentation / bootstrapping. I have performed this transformation in the backend, rather than trying to reflect this in the view from Scala symbols + ASTs. We also need to add an restriction related to invokespecial to Java parents: to support a super call to one of these to implement a super accessor, the interface must be listed as a direct parent of the class. The static method names has a trailing $ added to avoid duplicate name and signature errors in classfiles.
* | Remove stray .class file from version controlJason Zaugg2016-06-281-0/+0
|/
* Merge pull request #5099 from retronym/ticket/9390Jason Zaugg2016-06-067-7/+138
|\ | | | | SI-9390 Emit local defs that don't capture this as static
| * SI-9390 Avoid needless outer capture with local classesJason Zaugg2016-06-032-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An existing optimization in `Constructors` elides the outer field in member and local classes, if the class doesn't use the outer reference. (Member classes also need to be final, which is a secret handshake to say we're also happy to weaken prefix matching in the pattern matcher.) That optimization leaves the constructor signature as is: the constructor still accepts the outer instance, but does not store it. For member classes, this means that we can separately compile code that calls the constructor. Local classes need not be hampered by this constraint, we could remove the outer instance from the constructor call too. Why would we want to do this? Let's look at the case before and after this commit. Before: ``` class C extends Object { def foo(): Function1 = $anonfun(); final <static> <artifact> def $anonfun$foo$1($this: C, x: Object): Object = new <$anon: Object>($this); def <init>(): C = { C.super.<init>(); () } }; final class anon$1 extends Object { def <init>($outer: C): <$anon: Object> = { anon$1.super.<init>(); () } } ``` After: ``` class C extends Object { def foo(): Function1 = $anonfun(); final <static> <artifact> def $anonfun$foo$1(x: Object): Object = new <$anon: Object>(null); def <init>(): C = { C.super.<init>(); () } }; final class anon$1 extends Object { def <init>($outer: C): <$anon: Object> = { anon$1.super.<init>(); () } } ``` However, the status quo means that a lambda that This in turn makes lambdas that refer to such classes serializable even when the outer class is not itself serialiable. I have not attempted to extend this to calls to secondary constructors.
| * SI-9390 Emit local defs that don't capture this as staticJason Zaugg2016-06-015-7/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | This avoids unnecessary memory retention, and allows lambdas that call the local methods to be serializable, regardless of whether or not the enclosing class is serializable. The second point is especially pressing, given that the enclosing class for local methods defined in a used to be the (serializable) anonymous function class, but as of Scala 2.12 will be the enclosing class of the lambda. This change is similar in spirit to SI-9408 / 93bee55e.
* | Merge pull request #5157 from retronym/topic/lambda-staticsJason Zaugg2016-06-065-11/+11
|\| | | | | Lambda impl methods static and more stably named
| * Lambda impl methods static and more stably namedJason Zaugg2016-06-015-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The body of lambdas is compiled into a synthetic method in the enclosing class. Previously, this method was a public virtual method named `fully$qualified$Class$$anonfun$n`. For lambdas that didn't capture a `this` reference, a static method was used. This commit changes two aspects. Firstly, all lambda impl methods are now emitted static. An extra parameter is added to those that require a this reference. This is an improvement as it: - allows, shorter, more readable names for the lambda impl method - avoids pollution of the vtable of the class. Note that javac uses private instance methods, rather than public static methods. If we followed its lead, we would be unable to support important use cases in our inliner Secondly, the name of the enclosing method has been included in the name of the lambda impl method to improve debuggability and to improve serialization compatibility. The serialization improvement comes from the way that fresh names for the impl methods are allocated: adding or removing lambdas in methods not named "foo" won't change the numbering of the `anonfun$foo$n` impl methods from methods named "foo". This is in line with user expectations about anonymous class and lambda serialization stability. Brian Goetz has described this tricky area well in: http://cr.openjdk.java.net/~briangoetz/eg-attachments/lambda-serialization.html This commit doesn't go as far a Javac, we don't use the hash of the lambda type info, param names, etc to map to a lambda impl method name. As such, we are more prone to the type-1 and -2 failures described there. However, our Scala 2.11.8 has similar characteristics, so we aren't going backwards. Special case in the naming: Use "new" rather than "<init>" for constructor enclosed lambdas, as javac does. I have also changed the way that "delambdafy target" methods are identifed. Rather than relying on the naming convention, I have switched to using a symbol attachment. The assumption is that we only need to identify them from within the same compilation unit. This means we can distinguish impl metbods for expanded functions (ones called from an `apply` method of an ahead-of-time expanded anonfun class), from those that truly end up as targets for lambda metafactory. Only the latter are translated to static methods in this patch.
* | SI-9104 Autodetect raw pastageSom Snytt2016-06-028-3/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If `-raw` is not supplied explicitly to REPL `:paste`, see if the code text starts with `package` keyword or else see if it parses to a named package (to cope with leading commentary). In that case, take it as raw. But parse only on suspect comment slash. It's only worth parsing for a package if there's a chance that package keyword is buried behind comments. Small refactors to the `paste` object.
* | Merge commit '90215ce' into merge-2.11-to-2.12-june-1Lukas Rytz2016-06-015-4/+35
|\ \
| * \ Merge pull request #4998 from som-snytt/issue/7898-iLukas Rytz2016-06-015-4/+35
| |\ \ | | | | | | | | SI-7898 Read user input during REPL warmup
| | * | SI-7898 Label for parsing -i sourcesLukas Rytz2016-05-243-0/+34
| | | | | | | | | | | | | | | | Text-based REPL pre-parses, so use the current label for errors.
| | * | SI-7898 Report paste errors improvedlySom Snytt2016-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a "label" for errors, so that script names are shown. Position is still wrong for scripts in REPL. Initial scripts are run with `ILoop.echo` and results printing turned off, but reporter still enabled.
| | * | SI-7898 Read user input during REPL warmupSom Snytt2016-05-201-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The compiler is created on main thread and user input is read on an aux thread (opposite to currently). Fixes completion when `-i` is supplied. Now `-i` means pasted and new option `-I` means line-by-line. The temporary reader uses postInit to swap in the underlying reader. Completion is disabled for the temporary reader, rather than blocking while it waits for a compiler. But manically hitting tab is one way of knowing exactly when completion is live.
| * | | Merge pull request #4959 from rjolly/scripting15Stefan Zeiger2016-05-252-8/+4
| |\ \ \ | | | | | | | | | | Use jarlister in build
| | * | | Use jarlister in buildRaphael Jolly2016-05-212-8/+4
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | The goal of this change is to exercize the "manifest classpath" mechanism, meant to bring the compiler its needed classes as resources, listed in jar manifests, as opposed to files, thus enabling to use the compiler in sandboxed environments (and also the scripting engine for that matter).
* | | / Merge commit 'cba585d' into merge-2.11-to-2.12-june-1Lukas Rytz2016-06-019-0/+46
|\| | | | |_|/ |/| |
| * | SI-4625 Warn on first non-toplevel onlySom Snytt2016-05-171-0/+1
| | | | | | | | | | | | | | | | | | Fixed the warning when main module is accompanied by snippets. Minor clean-up so even I can follow what is returned.
| * | SI-4625 Warn when discarding script objectSom Snytt2016-05-173-0/+16
| | | | | | | | | | | | | | | | | | It's pretty confusing when your script object becomes a local and then nothing happens. Such as when you're writing a test and it takes forever to figure out what's going on.
| * | SI-4625 Permit arbitrary top-level in scriptSom Snytt2016-05-163-0/+16
| | | | | | | | | | | | | | | | | | | | | In an unwrapped script, where a `main` entry point is discovered in a top-level object, retain all top-level classes. Everything winds up in the default package.
| * | SI-4625 Recognize App in scriptSom Snytt2016-05-163-0/+13
| |/ | | | | | | | | | | | | | | | | Cheap name test: if the script object extends "App", take it for a main-bearing parent. Note that if `-Xscript` is not `Main`, the default, then the source is taken as a snippet and there is no attempt to locate an existing `main` method.
* | Merge pull request #5076 from soc/topic/deprecations-sinceLukas Rytz2016-05-3039-47/+47
|\ \ | | | | | | Improvements to deprecations related to `since` parameter
| * | Add since arg to deprecationWarning and use itSimon Ochsenreither2016-05-2935-38/+38
| | |
| * | Lower-case spelling of @deprecated messagesSimon Ochsenreither2016-05-281-4/+4
| | |
| * | SI-9084 Add `since` (if available) to deprecation warningsSimon Ochsenreither2016-05-285-9/+9
| | |
* | | Merge pull request #5191 from som-snytt/issue/9382Lukas Rytz2016-05-301-41/+0
|\ \ \ | |/ / |/| | SI-9382 Privatize enhanced x in Tuple2Zipped.Ops
| * | SI-9382 Zippy clean-up in aisle 2 & 3Som Snytt2016-05-261-41/+0
| | | | | | | | | | | | | | | Consolated JUnit tests and heeded comment about private def and code beauty.
* | | Merge pull request #5102 from milessabin/2.12.xJason Zaugg2016-05-274-1/+183
|\ \ \ | | | | | | | | SI-2712 Add support for partial unification of type constructors
| * | | -Xexperimental mode now only includes -Ypartial-unificationMiles Sabin2016-05-241-1/+1
| | | |
| * | | SI-2712 Add support for higher order unificationMiles Sabin2016-05-243-0/+182
| | | |
* | | | Merge pull request #5192 from dwijnand/wip/scala-repl-no-importsJason Zaugg2016-05-279-15/+567
|\ \ \ \ | | | | | | | | | | Fully qualify types in REPL generated code
| * | | | Fully qualify types in REPL generated codeDale Wijnand2016-05-269-15/+567
| | |/ / | |/| |