summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | SI-9409 Scaladoc: remove link to nonexistent diagram docSeth Tisue2015-07-181-1/+0
| | |/ | |/|
* / | SI-9406 fix doc for Range.takeRightSeth Tisue2015-07-181-1/+1
|/ /
* | Merge pull request #4595 from som-snytt/issue/9370Lukas Rytz2015-07-161-2/+2
|\ \ | | | | | | SI-9370 Xplugin scans plugin path for descriptor
| * | SI-9370 Xplugin scans plugin path for descriptorSom Snytt2015-06-301-2/+2
| | | | | | | | | | | | | | | Keep on scanning if the first entry doesn't yield a plugin.xml descriptor.
* | | Merge pull request #4615 from parambirs/patch-1Lukas Rytz2015-07-161-1/+1
|\ \ \ | | | | | | | | Update scaladoc for Any.scala#equals()
| * | | Update scaladoc for Any.scala#equals()Parambir Singh2015-07-091-1/+1
| | |/ | |/| | | | The transitive requirement for `Any` shouldn't mention `AnyRef`
* / | SI-9401 Avoid SOE with array + missing classtagJason Zaugg2015-07-161-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implicit classtags required by the Array constructor are not expressed in the type signature of its constructor, and instead are summoned by a special case in the typechecker. This special case entails replacing the `new Array` tree with `implicitly[T].newArray(size)`, handled in `ArrayInstantiation`. This tree is recursively typechecked. However, if the implicit materialization/search fails, an error is issued to the current reporter and the original tree is marked with an error type. As above, this is recursively typechecked. In the normal course of affairs, the recursive typecheck of the erroneous tree would be a noop (the tree already has a type!). However, if we are both in silent mode (in which errors are buffered) and in retyping mode (in which the typer clears the type and symbols of trees), we were getting into an cycle. In the enclosed test, retyping mode was trying to recover from: Resetting.this.gencastarray_=(new Array[T](0).<ERROR>) By inserting a suitable a view: implicitly[Resetting => { def gencastarray_=(AT)}]( Resetting.this ).gencastarray_=(new Array[T](0)) Where AT is the type found by retypechecking the argument. It is during the argument retypechecking that we fell into cycle. Crazily enough, in 2.11.0, the ensuing `StackOverflowError` was being caught and treated as a failure. We would then back out of the retyping mode, and issue the error from the the very first attempt at the implicit search. This fragile state of affairs was disrupted by a refactoring to the error reporting system in 725c5c9, after which the SOE crashed the compiler. This commit avoids recursively typechecking error typed trees.
* | Merge pull request #4604 from vergenzt/update-eclipse-filesAdriaan Moors2015-07-063-3/+3
|\ \ | | | | | | Update Eclipse classpath entries
| * | Update Eclipse classpath entriesTim Vergenz2015-07-043-3/+3
| | |
* | | Fix 25 typos (s)Janek Bogucki2015-07-068-9/+9
|/ /
* | Correct init order between Pasted and ILoop#pastedAdriaan Moors2015-07-021-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `testBoth` cannot be a val in `Pasted`, as `Pasted` is inherited by `object paste` in ILoop, which would cause `val testBoth` to be initialized before `val PromptString` was: ``` object paste extends Pasted { val PromptString = prompt.lines.toList.last ``` See https://scala-webapps.epfl.ch/jenkins/job/scala-nightly-checkinit-2.11.x/417. Introduced by #4564.
* | Merge pull request #4596 from janekdb/2.11.x-typos-p-rSeth Tisue2015-07-0114-17/+17
|\ \ | | | | | | Fix 27 typos (p-r)
| * | Fix 27 typos (p-r)Janek Bogucki2015-06-3014-17/+17
| | |
* | | Merge pull request #4576 from som-snytt/issue/9206-moreSeth Tisue2015-07-019-47/+92
|\ \ \ | |/ / |/| | SI-9206 REPL custom bits
| * | SI-9206 De-perk the welcome messageSom Snytt2015-06-252-8/+9
| | | | | | | | | | | | | | | The welcome message defaults to a sober header followed by one line of instructions.
| * | SI-9206 Update REPL welcome messageSom Snytt2015-06-243-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Everyone knows that a `help` command will result in `more information`. This commit moves the version string to the second line and adds some verve to the welcome. If anyone can't live without the old banner, they are now able to configure it explicitly, so there is still no blood on our hands. ``` $ scala Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). Type in expressions to have them evaluated. Type :help for more information. scala> :quit $ skala Welcome to Scala! version 2.11.7-20150623-155244-eab44dd092 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). Type in expressions for evaluation. Or try :help. scala> :quit ``` REPL tests now lop off the actual length of the welcome header; or, if necessary, remove the version number from a header embedded in output.
| * | SI-9206 REPL custom continuation promptSom Snytt2015-06-232-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because who doesn't want to customize their continuation prompt? `scala -Dscala.repl.continue="..."` looks especially nice with `-Dscala.color`. Somewhat works when pasting, but the test rig for running a transcript does not seek to support custom secondary prompts.
| * | SI-9206: REPL custom history fileIgor Racic2015-06-231-6/+6
| | | | | | | | | | | | Specify it with -Dscala.shell.histfile=/path/to/file.
| * | SI-9206: REPL custom welcome messageSom Snytt2015-06-237-17/+51
| | | | | | | | | | | | | | | | | | | | | | | | Can be specified by `-Dscala.repl.welcome=Greeting` or in properties file. It takes the same format arguments as the prompt, viz, version, Java version and JVM name. It can be disabled by `-Dscala.repl.welcome` with no text.
| * | SI-9206: No REPL message on :silent, unless -Dscala.repl.infoIgor Racic2015-06-231-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Anyone who doesn't understand why result printing was turned off after they entered `:silent` mode will start the REPL with `-Dscala.repl.debug` and be enlightened. For infotainment purposes, the verbose message is also emitted under info mode.
* | | Merge pull request #4569 from retronym/ticket/6985Adriaan Moors2015-06-301-2/+3
|\ \ \ | | | | | | | | SI-6895 Test cases to explain the limitations in tcpoly inference
| * | | SI-8892 Fix incorrect qualification in error messageJason Zaugg2015-06-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since beadafa2, we've ended up with nutty error messages for type errors involving aliases that target types in `java.lang` and `scala` packages. I think the intent of that change was to force the error messages to qualify types like `String` when needed, but to leave them unqualified by default. However, this led to this flat out wrong message in the enclosed test. found : B required: C.this.java.lang.B (which expands to) String I've changed the heuristic slightly limit this code to aliases that are eponymous with their targets. Still feels pretty kludgy, but we can at least book a little progress.
| * | | SI-8777 Avoid redundant disambiguation in error messagesJason Zaugg2015-06-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When printing types in error messages, we attempt to disambiguate symbol names by qualifying them in various ways. Type paramters symbols are qualified by adding `(in someMethod)`. However, the type errors generated by higher kinded subtyping can contain clones of type parameter symbols, as creater in `isPolySubType`. The disambiguation tries fruitlessly to distinguish them but ended up adding the same suffix to both names repeatedly. ``` found : [F[_]]Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[F,X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] required: Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[[X]Or[String,X],X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] ``` This commit limits the post qualification of type parameter symbols to a single attempt to limit the damage. An alternative might be to mark a clone (we could determine its status by checking whether it is a type parameter of its owner.) But I'm not sure how to present this information in a comphrenensible way, so for now I'm limiting my ambitions to stopping the stutter.
* | | | Merge pull request #4591 from vsalvis/vsalvis-stringdocSeth Tisue2015-06-302-4/+8
|\ \ \ \ | |_|_|/ |/| | | SI-8140 Documentation references java.lang.String directly
| * | | SI-8140 Documentation references java.lang.String directlyvsalvis2015-06-292-4/+8
| | | |
* | | | Merge pull request #4588 from retronym/topic/icodishAdriaan Moors2015-06-291-0/+5
|\ \ \ \ | | | | | | | | | | GenBCode: fix incrementatal compilation by mimicing GenASM
| * | | | GenBCode: fix incrementatal compilation by mimicing GenASMJason Zaugg2015-06-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The incremental compiler in SBT uses an implementation detail of the compiler backend to enumerate the classes that are actually written to disk. This commit mimics this in GenBCode by populating `Run#icode` with an `IClass` for each `ClassDef` processed. We should revisit this by creating a dedicated API for this purpose and migrating SBT to use that. We should also revisit this code as we implement closure elimination in the GenBCode; this commit assumes that all `ClassDef`s that enter the backend will generate classfile products. The enclosed test is extracted from the incrementatl compiler. I've also manually integration tested this with SBT: https://gist.github.com/retronym/fabf6f92787ea9c1ce67
* | | | | Merge pull request #4586 from som-snytt/issue/missing-argsSeth Tisue2015-06-291-19/+18
|\ \ \ \ \ | | | | | | | | | | | | Improved message for missing argument list
| * | | | | Improved message for missing argument listSom Snytt2015-06-271-19/+18
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clarifies the language and rules for eta-expansion. A missing argument in a list, as opposed to a missing argument list, results in a different message. The comical expansion in parens does not attempt to show what was already applied, but succeeds in showing at a glance the shape of the method in question. ``` scala> def m(i: Int, j: Int)(x: Int) = ??? m: (i: Int, j: Int)(x: Int)Nothing scala> m <console>:12: error: missing argument list for method m Unapplied methods are only converted to functions when a function type is expected. You can make this conversion explicit by writing `m _` or `m(_,_)(_)` instead of `m`. m ^ ``` The original submission was due to sschaef and the wording due to adriaanm, with a minor tweak.
* | | | | Merge pull request #4589 from janekdb/2.11.x-method-names-m-oJason Zaugg2015-06-291-2/+2
|\ \ \ \ \ | | | | | | | | | | | | Improve method names (m-o)
| * | | | | Improve method names (m-o)Janek Bogucki2015-06-281-2/+2
| |/ / / /
* / / / / Fix 23 typos (m-o)Janek Bogucki2015-06-288-10/+10
|/ / / /
* | | | Merge pull request #4577 from janekdb/2.11.x-typos-j-lSeth Tisue2015-06-244-7/+7
|\ \ \ \ | |/ / / |/| | | Fix 8 typos (j-l)
| * | | Fix 8 typos (j-l)Janek Bogucki2015-06-234-7/+7
| | | |
* | | | Merge pull request #4552 from lrytz/opt/closureInliningJason Zaugg2015-06-2413-113/+1005
|\ \ \ \ | |/ / / |/| | | Closure elimination for new backend
| * | | Cast arguments where necessary before rewriting closure invocationsLukas Rytz2015-06-231-15/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parameter types of a closure invocation can be supertypes of the parameter types in the implementation method. The closure automatically casts arguments to the right type. We need to do the same when rewriting closure invocations. Example: val fun: String => String = l => l val l = List("") fun(l.head) The closure object calls `apply(Object)Object`. The body method takes an argument of type `String`.
| * | | Rewrite closure invocations to the lambda body methodLukas Rytz2015-06-2210-108/+489
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an indylambda closure is allocated and invoked within the same method, rewrite the invocation to the implementation method. This works for any indylambda / SAM type, not only Scala functions. However, the Scala compiler (under -Xexperimental) currently desugars function literals for non-FunctionN types to an anonymous class during typer. No testing yet, waiting for FunctionN to become SAMs first. The feature requires scala-java8-compat to be on the classpath and a number of compiler flags: -Ydelambdafy:method -Ybackend:GenBCode -Yopt:closure-elimination -target:jvm-1.8 ➜ scala git:(opt/closureInlining) ant -Dscala-java8-compat.package=1 -Dlocker.skip=1 ➜ scala git:(opt/closureInlining) cd sandbox ➜ sandbox git:(opt/closureInlining) cat Fun.java public interface Fun<T> { T apply(T x); } ➜ sandbox git:(opt/closureInlining) javac Fun.java ➜ sandbox git:(opt/closureInlining) cat Test.scala class C { val z = "too" def f = { val kap = "me! me!" val f: Tuple2[String, String] => String = (o => z + kap + o.toString) f(("a", "b")) } def g = { val f: Int => String = x => x.toString f(10) } def h = { val f: Fun[Int] = x => x + 100 // Java SAM, requires -Xexperimental, will create an anonymous class in typer f(10) } def i = { val l = 10l val f: (Long, String) => String = (x, s) => s + l + z + x f(20l, "n") } def j = { val f: Int => Int = x => x + 101 // specialized f(33) } } ➜ sandbox git:(opt/closureInlining) ../build/quick/bin/scalac -target:jvm-1.8 -Yopt:closure-elimination -Ydelambdafy:method -Ybackend:GenBCode -Xexperimental -cp ../build/quick/scala-java8-compat:. Test.scala ➜ sandbox git:(opt/closureInlining) asm -a C.class ➜ sandbox git:(opt/closureInlining) cat C.asm [...] public g()Ljava/lang/String; L0 INVOKEDYNAMIC apply()Lscala/compat/java8/JFunction1; [ // handle kind 0x6 : INVOKESTATIC java/lang/invoke/LambdaMetafactory.altMetafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; // arguments: (Ljava/lang/Object;)Ljava/lang/Object;, // handle kind 0x6 : INVOKESTATIC C.C$$$anonfun$2$adapted(Ljava/lang/Object;)Ljava/lang/String;, (Ljava/lang/Object;)Ljava/lang/String;, 3, 1, Lscala/Serializable;.class, 0 ] CHECKCAST scala/Function1 L1 ASTORE 1 L2 ALOAD 1 BIPUSH 10 INVOKESTATIC scala/runtime/BoxesRunTime.boxToInteger (I)Ljava/lang/Integer; ASTORE 2 POP ALOAD 2 INVOKESTATIC C.C$$$anonfun$2$adapted (Ljava/lang/Object;)Ljava/lang/String; CHECKCAST java/lang/String L3 ARETURN [...]
| * | | Producers / Consumers AnalysisLukas Rytz2015-06-223-5/+461
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ASM has a built-in `SourceValue` analysis which computes for each value a set of instructions that may possibly have constructed it. The ProdConsAnalyzer class provides additional queries over the result of the SourceValue analysis: - consumers of values - tracking producers / consumers through copying operations (load, store, etc) A fix to (and therefore a new version of) ASM was required. See here: https://github.com/scala/scala-asm/commit/94106a5472
* | | | Merge pull request #4574 from janekdb/2.11.x-typos-g-iJason Zaugg2015-06-2310-10/+10
|\ \ \ \ | |_|_|/ |/| | | Fix 25 typos (g-i)
| * | | Fix 25 typos (g-i)Janek Bogucki2015-06-2210-10/+10
| |/ /
* | | Merge pull request #4564 from som-snytt/issue/promptv2.11.7Adriaan Moors2015-06-228-101/+109
|\ \ \ | | | | | | | | SI-9206 Fix REPL code indentation
| * | | SI-9206 Local refactor to save eyesightSom Snytt2015-06-212-42/+39
| | | | | | | | | | | | | | | | | | | | | | | | We talk about bit rot but not about how dust accumulates on code that hasn't been swept since the last time the furniture was moved around.
| * | | SI-9206 Accept paste with custom promptSom Snytt2015-06-213-24/+28
| | | | | | | | | | | | | | | | But sans test.
| * | | SI-9206 Verbose REPL prompt for info modeSom Snytt2015-06-191-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | Only for exactly `-Dscala.repl.info`, include the complete version number string in the REPL prompt. One could imagine this is the mode for posting snippets to stackoverflow.
| * | | SI-9206 Fix REPL code indentationSom Snytt2015-06-195-33/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To make code in error messages line up with the original line of code, templated code is indented by the width of the prompt. Use the raw prompt (without ANSI escapes or newlines) to determine the indentation. Also, indent only once per line.
| * | | SI-9206 REPL prompt is more easily configuredSom Snytt2015-06-192-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The scala shell prompt can be provided as either a system property or in compiler.properties. The prompt string is taken as a format string with one argument that is the version string. ``` $ scala -Dscala.repl.prompt="%nScala %s> " Welcome to Scala version 2.11.7-20150616-093756-43a56fb5a1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45). Type in expressions to have them evaluated. Type :help for more information. Scala 2.11.7-20150616-093756-43a56fb5a1> 42 res0: Int = 42 Scala 2.11.7-20150616-093756-43a56fb5a1> :quit ```
| * | | SI-9206 BooleanProp if set and not untrueSom Snytt2015-06-181-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, handy `sys.BooleanProp.keyExists` ignored the property value. While trying not to make any real estate puns, this commit will let it go false if a value is supplied that is not true in the usual Java sense. But what is truth? Allows `scala -Dscala.color=off`, for example.
* | | | Merge pull request #4566 from lrytz/t9359Adriaan Moors2015-06-227-56/+85
|\ \ \ \ | | | | | | | | | | SI-9359 Fix InnerClass entry flags for nested Java enums
| * | | | SI-9359 Fix InnerClass entry flags for nested Java enumsLukas Rytz2015-06-197-56/+85
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The access flags in InnerClass entries for nested Java enums were basically completely off. A first step is to use the recently introduced backend method `javaClassfileFlags`, which is now moved to BCodeAsmCommon. See its doc for an explanation. Then the flags of the enum class symbol were off. An enum is - final if none of its values has a class body - abstract if it has an abstract method (https://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.9) When using the ClassfileParser: - ENUM was never added. I guess that's just an oversight. - ABSTRACT (together with SEALED) was always added. This is to enable exhaustiveness checking, see 3f7b8b5. This is a hack and we have to go through the class members in the backend to find out if the enum actually has the `ACC_ABSTRACT` flag or not. When using the JavaParser: - FINAL was never added. - ABSTRACT was never added. This commit fixes all of the above and tests cases (Java enum read from the classfile and from source).
* | / / SI-9253 avoid IndexOutOfBoundsException in TypeMaps.correspondingTypeArgumentBruno Bieth2015-06-221-1/+1
| |/ / |/| |