summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* JUnit tests for dead code elimination.Lukas Rytz2014-09-106-7/+204
| | | | JUnit tests may use tools from partest-extras (ASMConverters)
* Merge pull request #3938 from gourlaysama/wip/t8764Grzegorz Kossakowski2014-09-096-0/+38
|\ | | | | SI-8764 fix return type of case class productElement under Xexperimental
| * [nomaster] SI-8764 fix return type of case class productElement under ↵Antoine Gourlay2014-09-096-0/+38
| | | | | | | | | | | | | | | | | | | | Xexperimental Under Xexperimental, productElement now returns the lub instead of the weak lub of case class parameter types (numeric widening shouldn't magically happen *inside* productElement). This was removed from 2.12.x in 6317ae2.
* | Merge pull request #3946 from gourlaysama/wip/t5254Grzegorz Kossakowski2014-09-091-0/+23
|\ \ | | | | | | SI-5254 running an empty scala script should succeed
| * | SI-5254 running an empty scala script should succeedAntoine Gourlay2014-08-261-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The script runner made the assumption that "compilation succeeded" implies "there is a Main class to run", but this can be wrong if the script is empty (or only contains imports/comments). The ScriptRunner now uses the ClassPath utility to check if there really is a main class. If not, it doesn't try to run it and returns peacefully. This also makes `scala -e ''` succeed.
* | | Merge pull request #3939 from lrytz/ystatsLukas Rytz2014-09-085-7/+120
|\ \ \ | | | | | | | | -Ystatistics accepts a list of phases for which to print stats
| * | | Address PR feedback, fix MultiChoiceSetting.containsLukas Rytz2014-09-081-0/+2
| | | |
| * | | Use Enumeration for MultiChoiceSettingSom Snytt2014-09-051-1/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is pretty easy, since a ValueSet is a BitSet. When the setting is updated, recompute the current set of values, which is cheap and succinct. Checking a flag is also easy and fast. Choices in MultiChoiceSettings may enable other choices.
| * | | -Ystatistics accepts a list of phases, cleanups in MultiChoiceSettingLukas Rytz2014-09-021-1/+62
| | | | | | | | | | | | | | | | | | | | MultiChoiceSetting and Xlint with its deprecated aliases is now a bit simpler, but there's still room for improvement, as noted in comments.
| * | | Fix assertThrows, and the behaviors that it shadowedLukas Rytz2014-09-024-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | The test in StdNamesTest was introduced in cff8b569, where newTermName would throw on a negative length. In b090f97 this was changed to fix the negative length, but the test was not adapted (as it didn't fail).
* | | | Merge pull request #3935 from lrytz/t8803Jason Zaugg2014-09-052-0/+73
|\ \ \ \ | | | | | | | | | | SI-8803 generate super accessor for super[A], if A is outer superclass
| * | | | SI-8803 generate super accessor for super[A], if A is outer superclassLukas Rytz2014-08-202-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | class C extends A with T { class I { C.super[T] C.super[A] } } A super call in a nested class of the form super[T] where T is a parent trait of the outer class doesn't need an accessor: mixin can directly re-route the call to the correct implementation class - it's statically known to be T$class. However, if a nested class accesses super[A] and A is the superclass of the outer class (not a trait), then we need a super accessor in the outer class. We need to add the mixin name to the super accessor name, otherwise it clashes with non-qualified super accessors.
* | | | | Merge pull request #3961 from lrytz/t8786-disable-testJason Zaugg2014-09-041-1/+3
|\ \ \ \ \ | | | | | | | | | | | | SI-8786 disable part of thest that's failing the jdk8 build
| * | | | | SI-8786 disable part of test that's failing the jdk8 buildLukas Rytz2014-09-041-1/+3
| | | | | |
* | | | | | Merge pull request #3932 from gourlaysama/wip/t8498Jason Zaugg2014-09-042-4/+7
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8498 @compileTimeOnly should be aware of bridge methods.
| * | | | | | SI-8498 @compileTimeOnly should be aware of bridge methods.Antoine Gourlay2014-08-212-4/+7
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling a @compileTimeOnly method from another @compileTimeOnly method happens when the former gets a bridge method. It should not throw an error. Calling the bridge or the method will anyway.
* | | | | | Merge pull request #3951 from pawel-wiejacha/2.11.x_SI-8810_fixGrzegorz Kossakowski2014-09-032-3/+10
|\ \ \ \ \ \ | | | | | | | | | | | | | | scaladoc: fixed code block indentation normalization
| * | | | | | SI-8810 scaladoc: fixed code block indentation normalizationPaweł Wiejacha2014-09-032-3/+10
| | | | | | |
* | | | | | | SI-8113 allow a newline between a link target and titleAntoine Gourlay2014-09-032-0/+37
| |_|/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Parsing "[[http://foo.bar link title]]" stops at the first whitespace. This breaks pretty badly in: [[http://foo.bar link title]] It stops after "link", interprets what it parsed as a link to a member, obviously fails, and then just ouputs "title". It should at least return a proper error, or, even better, just allow a newline between the target and title. I went for the latter.
* | | | | | Merge pull request #3955 from som-snytt/issue/8410Grzegorz Kossakowski2014-09-032-0/+16
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8410 Don't warn fatally on disabled flag
| * | | | | | SI-8410 Don't warn fatally on disabled flagSom Snytt2014-09-012-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since boolean settings can now be set false by user, summary warnings should not be issued when the flag is explicitly off (as opposed to unset, default). In particular, `-Xfatal-warnings` should not fail if there were no warnings otherwise. ``` $ ~/scala-2.11.2/bin/scalac -d /tmp -deprecation:false test/files/pos/t8410.scala $ ~/scala-2.11.2/bin/scalac -d /tmp -deprecation:false -Xfatal-warnings test/files/pos/t8410.scala warning: there were three deprecation warnings; re-run with -deprecation for details error: No warnings can be incurred under -Xfatal-warnings. one warning found one error found ``` After this commit: ``` $ skalac -d /tmp -Xfatal-warnings test/files/pos/t8410.scala warning: there were three deprecation warnings; re-run with -deprecation for details error: No warnings can be incurred under -Xfatal-warnings. one warning found one error found $ skalac -d /tmp -deprecation:false -Xfatal-warnings test/files/pos/t8410.scala ``` Similarly for other collecting flags: ``` $ skalac -d /tmp -optimise -Yinline-warnings -deprecation:false -Xfatal-warnings test/files/pos/t8410.scala test/files/pos/t8410.scala:14: warning: Could not inline required method dropWhile because access level required by callee not matched by caller. def k = List(0).dropWhile(_ < 1) // inlining warns doubly ^ test/files/pos/t8410.scala:14: warning: At the end of the day, could not inline @inline-marked method dropWhile def k = List(0).dropWhile(_ < 1) // inlining warns doubly ^ error: No warnings can be incurred under -Xfatal-warnings. two warnings found one error found $ skalac -d /tmp -optimise -Yinline-warnings:false -deprecation:false -Xfatal-warnings test/files/pos/t8410.scala ``` Footnote: handling of deprecated locals also changed in 2014: ``` $ ~/scala-2.11.0-M7/bin/scalac -d /tmp -deprecation -Xfatal-warnings test/files/pos/t8410.scala test/files/pos/t8410.scala:8: warning: method f in object Test is deprecated: Console println f // warns ^ error: No warnings can be incurred under -Xfatal-warnings. one warning found one error found $ ~/scala-2.11.0-M8/bin/scalac -d /tmp -deprecation -Xfatal-warnings test/files/pos/t8410.scala test/files/pos/t8410.scala:5: warning: method _f is deprecated: def g = { @deprecated("","") def _f = f ; _f } // warns in 2.11.0-M8 ^ test/files/pos/t8410.scala:6: warning: class X is deprecated: def x = { @deprecated("","") class X { def x = f } ; new X().x } // warns in 2.11.0-M8 ^ test/files/pos/t8410.scala:8: warning: method f in object Test is deprecated: Console println f // warns ^ error: No warnings can be incurred under -Xfatal-warnings. three warnings found one error found ```
* | | | | | | Merge commit 'b5759ef' into merge/2.10-to-2.11-sept-2Lukas Rytz2014-09-022-0/+19
|\ \ \ \ \ \ \
| * | | | | | | Prevent SI-8314 by adding a testKato Kazuyoshi2014-07-312-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original issue was fixed already. This test is just for make sure.
* | | | | | | | Merge pull request #3952 from gourlaysama/wip/t8828-lint-innacessibleGrzegorz Kossakowski2014-09-022-0/+21
|\ \ \ \ \ \ \ \ | |_|_|_|_|/ / / |/| | | | | | | SI-8828 fix regression in Xlint visibility warning for sealed classes
| * | | | | | | SI-8828 fix regression in Xlint visibility warning for sealed classesAntoine Gourlay2014-08-282-0/+21
| | |/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5dfcf5e reverted a change to `Symbol#isEffectivelyFinal` (made in adeffda) that broke overriding checks, and moved the new enhanced version to a new method. However, the test for inaccessible type access still uses the old one, so it lost the ability to see that the owner of some method is either final or sealed and not overridden. This just makes it use the new `isEffectivelyFinalOrNotOverriden`.
* | | | | | | Merge pull request #3948 from retronym/ticket/8823Grzegorz Kossakowski2014-09-021-0/+10
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-8823 Exclude specialized methods from extension method rewrite
| * | | | | | | SI-8823 Exclude specialized methods from extension method rewriteJason Zaugg2014-08-271-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a value class extends a specialized class, it can sprout specialized members after the specialization info transformer has run. However, we only install extension methods for class members we know about at the extmethods phase. This commit simply disables rewiring calls to these methods in erasure to an extention method. This follows the approach taken from super accessors. Note: value class type parameters themselves currently are not allowed to be specialized.
* | | | | | | | Merge pull request #3931 from lrytz/opt/tracked-finalLukas Rytz2014-09-019-74/+837
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | | GenBCode refactoring (remove Tracked) and fix InnerClass / EnclosingMethod attributes
| * | | | | | | Fix InnerClass / EnclosingMethod attributesLukas Rytz2014-09-018-40/+816
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit seems bigger than it is. Most of it is tests, and moving some code around. The actual changes are small, but a bit subtle. The InnerClass and EnclosingMethod attributes should now be close to the JVM spec (which is summarized in BTypes.scala). New tests make sure that changes to these attributes, and changes to the way Java reflection sees Scala classfiles, don't go unnoticed. A new file, BCodeAsmCommon, holds code that's shared between the two backend (it could hold more, future work). In general, the difficulty with emitting InnerClass / EnclosingMethod is that we need to find out source-level properties. We need to make sure to do enough phase-travelling, and work around destructive changes to the ownerchain in lambdalift (we use originalOwner a lot). The change to JavaMirrors is prompted by the change to the EnclosingMethod attribute, which changes Java reflection's answer to getEnclosingMethod and getEnclosingConstructor. Classes defined in field initializers no longer have an enclosing method, just an enclosing class, which broke an assumption in JavaMirrors. There's one change in erasure. Before this change, when an object declaration implements / overrides a method, and a bridge is required, then the bridge method was actually a ModuleSymbol (it would get the lateMETHOD flag and be emitted as a method anyway). This is confusing, when iterating through the members of a class, you can find two modules with the same name, and one of them doesn't have a module class. Now, such bridge methods will be MethodSymbols. Removed Symbol.originalEnclosingMethod, that is a backend thing and doesn't need to live in the symbol API.
| * | | | | | | Remove Tracked, add type information to ClassBTypeLukas Rytz2014-08-191-34/+21
| | |_|_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, a ClassBType was just a name. The `exemplars` map stored a Tracked instance for every ClassBType. Tracked stored type information that is required later in the backend when things may run concurrently. In particular: superclass, interfaces, flags and information for emitting the InnerClass attribute. Now we put all the information stored in Tracked directly in the ClassBType. There is still one hash map: `classBTypeFromInternalNameMap` maps a JVM internal class name (e.g. "scala/Predef$") to the corresponding ClassBType. This map is used during bytecode generation, when the ASM framework computes stack map frames. In order to compute stack map frames, the ASM framework needs to be able to get the LUB of two types. The default implementation uses reflection to get type information, however that doesn't work in our case: the classes we compile are not on the classpath. So instead, the backend overwrites the method `getCommonSuperClass` of the ClassWriter. This method receives two class internal names and computes their LUB. This is done by looking up the ClassBTypes in the `classBTypeFromInternalNameMap` and invoking `jvmWiseLUB`. This commit was reviwed in https://github.com/scala/scala/pull/3855. It consists of all commits labelled [squash-after-review], squashed into one.
* | | | | | | Merge pull request #3949 from lrytz/t8627Grzegorz Kossakowski2014-08-272-1/+19
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-8627 make Stream.filterNot non-eager
| * | | | | | | SI-8627 make Stream.filterNot non-eagerLukas Rytz2014-08-272-1/+19
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The obvious fix, overriding `filterNot` in Stream, is not binary compatible, see https://github.com/scala/scala/pull/3925 Instead, this makes `filterImpl` in TaversableLike private[scala], which allows overriding it in Stream. The corresponding mima-failures can be whitelisted, as the changes are only to private[scala]. In 2.12.x we can remove the override of `filter` in Stream, but in 2.11.x this is not binary compatible. Eventually we'd also like to make filter / filterNot in TraversableLike final, but that's not source compatible, so it cannot be done in 2.12.x.
* | | | | | | Merge pull request #3905 from gourlaysama/wip/t5691-2Lukas Rytz2014-08-267-7/+59
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | SI-5691 lint warning when a type parameter shadows an existing type.
| * | | | | | SI-5691 lint warning when a type parameter shadows an existing type.Antoine Gourlay2014-08-127-7/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new lint warning for when a class/method/type-member's type parameter shadows an existing type: `-Xlint:type-parameter-shadow`. It excludes type parameters of synthetic methods (the user can't rename or remove those anyway), otherwise, for example, every case class triggers the warning. Also fixes a test that contained wrong java sources (that didn't even compile...), discovered thanks to the warning. --- This kind of errors shows up every now and then on the mailing-list, on stackoverflow, etc. so maybe a warning would be useful. I was afraid this would yield too many warnings for libraries that are heavy on type parameters, but no: running this on scalaz and shapeless HEAD (`v7.1.0-RC1-41-g1cc0a96` and `v2.0.0-M1-225-g78426a0` respectively) yields 44 warnings. None of them are false positives; they usually come from: - scalaz loving using `A` as type parameter, even several levels deep of parametrized classes/methods - or calling a type parameter that will hold a map `Map`, or similar, thus shadowing an existing type
* | | | | | | Merge pull request #3929 from retronym/ticket/8793Lukas Rytz2014-08-261-0/+15
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-8793 Fix patmat regression with extractors, existentials
| * | | | | | | SI-8793 Fix patmat regression with extractors, existentialsJason Zaugg2014-08-151-0/+15
| | |_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the same vein as SI-8128 / 3e9e2c65a, revert to the 2.10.x style of determining the types of the product elements of an extractor when using `TupleN`. I believe we can discard the special casing for Option/Tuple/Seq altogether with judicious application of `repackExistential` in `unapplyMethodTypes`. That ought to also fix fix SI-8149. But I'll target that work at 2.12.x.
* | | | | | | Merge pull request #3886 from adriaanm/report-filterGrzegorz Kossakowski2014-08-262-1/+10
|\ \ \ \ \ \ \ | |_|_|_|_|_|/ |/| | | | | | part 2 of the big error reporting refactoring
| * | | | | | Encapsulate reporting mode as class of reportBuffer.Adriaan Moors2014-07-181-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reporting mode used to be governed by contextMode. This logic is left in place by this commit, and the consistency of the new and the old is checked. Will be removed in follow-up commit. The main difference is that we no longer throw TypeErrors in buffering mode. There was one instance of context.error in implicit search the exploited the fact that implicit search runs in buffering (silent) mode and thus calls to error(pos,msg) used to throw new TypeError(pos, msg) -- made this explicit, and removed throwing behavior from the buffering context reporter.
| * | | | | | Simplify (ambiguous) error issuing.Adriaan Moors2014-07-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The two functional differences are: - always add the diagnostics string - check erroneousness in `issueAmbiguousTypeErrorUnlessErroneous`, before even constructing the error message. Consider this nugget: ``` - def issueAmbiguousError(pre: Type, sym1: Symbol, sym2: Symbol, err: AbsTypeError) { - issueCommon(err) { case _ if ambiguousErrors => - if (!pre.isErroneous && !sym1.isErroneous && !sym2.isErroneous) ``` I'd like to state for the record that the if-erroneous in the case of the partial function looked super-dodgy: it meant that, when `ambiguousErrors`, `issueCommon` would not get to the `else` branches that buffer or throw, and if the erroneous condition was met, nothing would be issued/buffered/thrown. This refactoring checks this condition up front.
* | | | | | | Merge pull request #3923 from som-snytt/issue/8787Grzegorz Kossakowski2014-08-191-0/+17
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | | | SI-8787 Regextraction is null-proof
| * | | | | | SI-8787 If you love nulls, so does RegexSom Snytt2014-08-081-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Regex is robust when unapplying null. A null never matches.
* | | | | | | SI-8512 Infer Any for the qSom Snytt2014-08-122-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid the widening bug for q. This resolution also suffers from the inference of Any, which can trigger a warning and an anxiety attack. But that's still better than doing the wrong thing. Right?
* | | | | | | SI-8512 Infer a type for f"$args"Som Snytt2014-08-122-1/+14
| |_|/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The f-interpolator gets a type param that better be Any to avoid unfortunate widenings. Hey, it worked! Unfortunately, when `Any` is inferred, `-Xlint:infer-any` takes notice. This is probably a greater problem for the f-interpolator than for quasiquotes, which are a more specialized tool.
* | | | | | Merge pull request #3927 from lrytz/innerClassesTestLukas Rytz2014-08-123-0/+310
|\ \ \ \ \ \ | | | | | | | | | | | | | | test for InnerClass and EnclosingMethod attributes
| * | | | | | test for InnerClass and EnclosingMethod attributesLukas Rytz2014-08-123-0/+310
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some parts of the test assert (current) buggy behavior. This is marked in the test file with TODO. It will be fixed in later work on the backend.
* | | | | | Merge pull request #3902 from gourlaysama/wip/t4563Lukas Rytz2014-08-1278-80/+80
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-4563 friendlier behavior for Ctrl+D in the REPL
| * | | | | | SI-4563 friendlier behavior for Ctrl+D in the REPLAntoine Gourlay2014-07-2978-80/+80
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closing the REPL with Ctrl+D does not issue a newline, so the user's prompt displays on the same line as the `scala>` prompt. This is bad. We now force a newline before closing the interpreter, and display `:quit` while we're at it so that people know how to exit the REPL (since `exit` doesn't exist anymore). The tricky part was to only add a newline when the console is interrupted, and *not* when it is closed by a command (like `:quit`), since commands are processed after their text (including newline) has been sent to the console.
* | | | | | Merge pull request #3889 from som-snytt/issue/6476-altLukas Rytz2014-08-123-20/+16
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | SI-6476 Improve error on escapement
| * | | | | SI-6476 DocumentationSom Snytt2014-07-182-18/+14
| | | | | | | | | | | | | | | | | | | | | | | | And adjust the test.
| * | | | | SI-6476 Improve error on escapementSom Snytt2014-07-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Behavior of escape processing under string interpolation can be confusing. This commit improves the exception message so you know at least what sort of escapes are handled. This came up on SO in the form `s"\d".r`, where it may not be obvious what is throwing and how to work around it. ``` scala> s"\d".r scala.StringContext$InvalidEscapeException: invalid escape '\d' not one of [\b, \t, \n, \f, \r, \\, \", \'] at index 0 in "\d". Use \\ for literal \. scala> s"a\" scala.StringContext$InvalidEscapeException: invalid escape at terminal index 1 in "a\". Use \\ for literal \. ``` Referencing SI-6476 because that has become the magnet ticket for "escape processing under string interpolation, huh?" This doesn't address `$"` and doesn't handle the more interesting parse error `s"a\"b"`.