summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* SI-9740 Repl import fix -Yrepl-class-basedSom Snytt2016-05-026-73/+55
| | | | | | | Under `-Yrepl-class-based`, templating must follow the same scoping as under traditional object-based. The new test shows a typical case where two values of the same simple name must be imported in different scopes.
* SI-9734 Narrow type when import REPL history (#5084)som-snytt2016-04-202-0/+40
| | | | | Under `-Yrepl-class-based`, imports from historical `$read` instances must be singleton-typed so that path-dependent types remain so.
* SI-9735 REPL prefer standard escapes for code text (#5086)som-snytt2016-04-202-0/+36
| | | | | When constructing code text for compilation, the REPL should prefer standard escape sequences, in case unicode escapes are disabled.
* SI-9488 - adds the same default toString format to Scala Futures as 2.12.xViktor Klang2016-03-221-2/+18
| | | | Includes tests to verify the toString representations.
* SI-9425 Fix a residual bug with multi-param-list case classesJason Zaugg2016-03-041-0/+15
| | | | | | | | During code review for the fix for SI-9546, we found a corner case in the SI-9425 that remained broken. Using `finalResultType` peels off all the constructor param lists, and solves that problem.
* SI-9546 Fix regression in rewrite of case apply to constructor callJason Zaugg2016-03-021-0/+13
| | | | | | | | | | | | | | | | | | | | | In SI-9425, I disabled the rewrite of `CaseClass.apply(x)` to `new CaseClass(x)` if the constructor was was less accessible than the apply method. This solved a problem with spurious "constructor cannot be accessed" errors during refchecks for case classes with non-public constructors. However, for polymorphic case classes, refchecks was persistent, and even after refusing to transform the `TypeApply` within: CaseClass.apply[String]("") It *would* try again to transform the enclosing `Select`, a code path only intended for monomorphic case classes. The tree has a `PolyType`, which foiled the newly added accessibility check. I've modified the call to `isSimpleCaseApply` from the transform of `Select` nodes to exclude polymorphic apply's from being considered twice.
* Refactor transform of case apply in refchecksJason Zaugg2016-03-023-0/+42
| | | | | | | | | | | | | | | | I've identified a dead call to `transformCaseApply` that seems to date back to Scala 2.6 vintages, in which case factory methods were a fictional companion method, rather than a real apply method in a companion module. This commit adds an abort in that code path to aide code review (if our test suite still passes, we know that I've removed dead code, rather than silently changing behaviour.) The following commit will remove it altogether I then inlined a slightly clunky abstraction in the two remaining calls to `transformCaseApply`. It was getting in the way of a clean fix to SI-9546, the topic of the next commit.
* Update partest to 1.0.12, test case for reporting invalid flagsLukas Rytz2016-02-175-2/+12
| | | | | | Conflicts: test/files/pos/t3420.flags versions.properties
* Merge pull request #4937 from szeiger/issue/9623-2.11Seth Tisue2016-02-081-0/+28
|\ | | | | SI-9623 Avoid unnecessary hasNext calls in JoinIterator & ConcatIterator
| * SI-9623 Avoid unnecessary hasNext calls in JoinIterator & ConcatIteratorStefan Zeiger2016-02-011-0/+28
| | | | | | | | | | | | | | | | | | | | | | These iterator implementations are used to concatenate two (JoinIterator) or more (ConcatIterator) other iterators with `++`. They used to perform many unnecessary calls to the child iterators’ `hasNext` methods. This improved state machine-based implementation reduces that number to the bare minimum, i.e. iterating over concatenated iterators with `foreach` calls the children's `hasNext` methods a total of (number of children) + (number of elements) times, the same as when iterating over all children separately.
* | Merge pull request #4927 from szeiger/issue/9572Jason Zaugg2016-02-012-0/+13
|\ \ | | | | | | SI-9572 Check for illegal tuple sizes in the parser
| * | SI-9572 Check for illegal tuple sizes in the parserStefan Zeiger2016-01-282-0/+13
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds explicit checks with syntax errors for tuple literals and types of more than 22 elements. An alternative approach to fixing SI-9572 would be to revert to the old failure mode of Scala 2.10 where references to arbitrary `scala.TupleXY` would be generated in the parser, which then leads to “type/object not found” errors in the typechecker. This fix here is more intrusive but arguably provides a better user experience. Methods `stripParens` and `makeBinop` are moved from `TreeBuilder` to `Parsers` because they can now generate syntax errors. New methods `makeSafeTupleType` and `makeSafeTupleTerm` implement the error checking on top of `makeTupleType` and `makeTupleTerm`. They are overridden with no-op versions in the quasiquotes parser because it also overrides `makeTupleType` and `makeTupleTerm` in a way that supports arbitrary tuple sizes.
* / SI-9534 Use BoxedUnit in all cases for creating Array[Unit]Stefan Zeiger2016-01-271-1/+11
|/ | | | | | | | Calling `wrap` or one of the higher-dimension Array factory methods on the `Manifest` for `Unit` led to an exception because it tried to use `void` as a primitive type. Unlike all other primitive Scala types, `Unit` needs to be boxed. The basic `newArray` method was not affected by this bug because it was already special-cased. The fix is to also special-case `arrayClass`.
* Trim complexity in CommentFactoryBaseJanek Bogucki2016-01-252-0/+69
| | | | | | | | | | 1. Replace option handling with library call 2. Remove NumberFormatException catch presumed to be copy/paste legacy 3. It's Scaladoc 4. Parse trailing whitespace regex once instead of per line 5. Use string interpolation where it improves readability 6. Add missed alternative to block grammar production rule 7. Add regression test for tag requirement warnings
* Merge pull request #4899 from som-snytt/issue/9616Jason Zaugg2016-01-193-12/+81
|\ | | | | [backport] SI-9616 False positive in unused import warning
| * [backport] SI-9616 False positive in unused import warningSom Snytt2016-01-073-12/+81
| | | | | | | | This is a minimal backport of the fix for SI-9383.
* | disable flaky presentation compiler test on WindowsSeth Tisue2016-01-151-0/+6
| | | | | | | | see https://github.com/scala/scala-dev/issues/72 for details
* | SI-9605 Searching does not use binary search for ArrayRui Gonçalves2016-01-121-0/+48
|/ | | | Binary search should be used for every `IndexedSeqLike` instance and not only for `IndexedSeq`. According the Scaladoc, it is `IndexedSeqLike` that guarantees "constant-time or near constant-time element access and length computation".
* Merge pull request #4862 from retronym/ticket/9567Lukas Rytz2015-12-183-0/+66
|\ | | | | SI-9567 Fix pattern match on 23+ param, method local case class
| * SI-9567 Fix pattern match on 23+ param, method local case classJason Zaugg2015-11-252-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Typechecking constructor patterns of method local case classes was only working because of the existence of the unapply method in the companion, which is used if navigation to the case class companion object fails. We now support defintion of, and pattern matching on, case classes with more than 22 parameters. These have no `unapply` method in the companion, as we don't have a large enough tuple type to return. So for such case classes, the fallback that we inadvertently relied on would no longer save us, and we'd end up with a compile error advising that the identifier in the constructor pattern was neither a case class nor an extractor. This is due to the propensity of `Symbol#companionXxx` to return `NoSymbol` when in the midst of typechecking. That method should only be relied upon after typechecking. During typechecking, `Namers#companionSymbolOf` should be used instead, which looks in the scopes of enclosing contexts for symbol companionship. That's what I've done in this commit.
| * SI-9567 Fix latent bugs in patmat's reasoning about mutabilityJason Zaugg2015-11-251-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under -optimize, the pattern matcher tries to avoid local variables in favour of directly accessing to non-var case class accessors. However, the code that analysed the patterns failed to account properly for repeated parameters, which could either lead to a compiler crash (when assuming that the n-th subpattern must have a corresponding param accessor), or could lead to a correctness problem (when failing to eagerly the bound elements from the sequence.) The test case that tried to cover seems only to have been working because of a separate bug (the primary subject of SI-9567) related to method-local case classes: they were treated during typechecking as extractors, rather than native case classes. The subsequent commit will fix that problem, but first we must pave the way with this commit that emits local vals for bound elements of case class repeated params.
* | Merge pull request #4876 from ruippeixotog/issue/9581Seth Tisue2015-12-151-0/+30
|\ \ | | | | | | SI-9581 Fix overflow on Vector take and drop methods
| * | SI-9581 Fix overflow on Vector take and drop methodsRui Gonçalves2015-12-061-0/+30
| |/ | | | | | | | | | | Fixes the index/length comparison in `Vector#take` and `Vector#drop` so that they handle all possible integer values. Given the collection's invariants `startIndex >= endIndex` and `0 >= startIndex, endIndex`, it is sufficient to change the arithmetic in the comparison as done in this commit to avoid overflows. As cases when `n <= 0` are handled beforehand, `endIndex - n` cannot overflow, contrary to `startIndex + n`. If without the danger of overflows the condition yields true, on the other hand, `startIndex + n` cannot overflow as it is smaller than `endIndex` (as the previous formulation of the condition shows).
* / Make all of partest work in the sbt buildStefan Zeiger2015-12-041-4/+5
|/ | | | | | | | | | | | - Fix the scoping of files/lib/*.jar. These files were not on the classpath when running partest from sbt. - Pass the same standard Java options to partest as from the command line. This requires new versions of scala-partest and scala-partest-interface. - Fix the classpath scanning in jvm/innerClassEnclMethodJavaReflection. It only worked for JARs and relative directories but not for absolute directory paths (which are produced by sbt).
* Merge pull request #4828 from retronym/topic/existential-containsLukas Rytz2015-11-163-0/+15
|\ | | | | Attacking exponential complexity in TypeMaps
| * Attacking exponential complexity in TypeMapsJason Zaugg2015-11-133-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Don't normalize existentials during the `contain`-s type map; `ExistentialType#normalize' calls contains internally and an exponential blowup ensues. - Ensure that the type map used in variance validation never returns modified types in order to avoid needless cloning of symbols. The enclosed test case still gets stuck in Uncurry, thanks to the way that `TypeMap#mapOver(List[Symbol])` recurses through the type first to check whether the type map would be an no-op or not. If not, it repeats the type map with cloned symbols. Doing the work twice at each level of recursion blows up the complexity. Removing that "fast path" allows the enclosed test to compile completely. As at this commit, it gets stuck in uncurry, which dealiases `s.List` to `s.c.i.List` within the type. Some more background on the troublesome part of `TypeMap`: http://lrytz.github.io/scala-aladdin-bugtracker/displayItem.do%3Fid=1210.html https://github.com/scala/scala/commit/f8b2b21050e7a2ca0f537ef70e3e0c8eead43abc
* | Merge pull request #4839 from SethTisue/reword-dependent-type-errorSeth Tisue2015-11-141-2/+2
|\ \ | | | | | | less confusing wording for a dependent method type error
| * | less confusing wording for a dependent method type errorSeth Tisue2015-11-071-2/+2
| |/ | | | | | | | | | | | | | | note to reviewers: the error messages in this file are over the place about whether they're called "parameter sections", or "argument lists", or what, so there's no point in being picky about that here for context see SI-823
* | Merge pull request #4809 from wpopielarski/delambdafy-multiple-outputsJason Zaugg2015-11-131-0/+73
|\ \ | | | | | | Multi output problem with delambdafied compilation
| * | Test addedwpopielarski2015-11-061-0/+73
| |/
* | Merge pull request #4843 from SethTisue/scaladoc-little-d-pleaseJason Zaugg2015-11-139-9/+9
|\ \ | | | | | | it's Scaladoc, not ScalaDoc
| * | it's Scaladoc, not "ScalaDoc" or "Scala doc"Seth Tisue2015-11-129-9/+9
| |/ | | | | | | | | renaming the existing ScalaDoc and ScalaDocReporter classes might break stuff, sadly, but at least we can fix the rest
* | Merge pull request #4810 from ruippeixotog/fix-mutable-setlike-clearAdriaan Moors2015-11-121-0/+26
|\ \ | | | | | | SI-9497 Fix SetLike#clear() default implementation
| * | SI-9497 Fix SetLike#clear() default implementationRui Gonçalves2015-10-211-0/+26
| | | | | | | | | | | | When dealing with mutable collections, it is not safe to assume iterators will remain consistent when the collection is modified mid-traversal. The bug reported in SI-9497 is very similar to SI-7269, "ConcurrentModificationException when filtering converted Java HashMap". Then, only the `retain` method was fixed. This commit fixes `clear`, which had the same problem.
* | | Merge pull request #4804 from jvican/issue/9503Adriaan Moors2015-11-121-0/+1
|\ \ \ | |_|/ |/| | [SI-9503] Deprecate scala.collection.immutable.PagedSeq
| * | [SI-9503] Deprecate scala.collection.immutable.PagedSeqjvican2015-11-041-0/+1
| | |
* | | SI-4950 Test reductionSom Snytt2015-10-252-13/+18
| |/ |/| | | | | | | | | A session test with extra filtering best expresses the intentions. No check file is required.
* | Merge pull request #4795 from SethTisue/windows-ciLukas Rytz2015-10-213-3/+11
|\ \ | |/ |/| improvements to Windows build & test situation
| * add comment about Cygwin trouble to test/partestSeth Tisue2015-10-081-0/+8
| |
| * fix t7634 to work on CygwinSeth Tisue2015-10-082-3/+3
| | | | | | | | | | | | | | | | | | | | | | this was failing because the expected output was: res1: List[String] = List(shello, world.) but the actual output was: res1: List[String] = List(shello, world., Picked up _JAVA_OPTIONS: -Duser.home=y:\jenkins) but the "Picked up..." part caused partest's filters feature to ignore the entire line (it doesn't anchor matches to start of line.) This was a tough one to track down.
* | Merge pull request #4798 from performantdata/issue/9513Seth Tisue2015-10-151-0/+42
|\ \ | | | | | | SI-9513 decrement "deleted" count in OpenHashMap.put() when slot reused
| * | Suppress unneeded import.Performant Data LLC2015-10-141-2/+2
| | |
| * | SI-9513 decrement "deleted" count in OpenHashMap.put() when slot reusedPerformant Data LLC2015-10-101-0/+42
| |/
* | Merge pull request #4771 from som-snytt/issue/9492-hereSeth Tisue2015-10-142-0/+46
|\ \ | |/ |/| SI-9492 REPL paste here doc
| * SI-9492 REPL paste here docSom Snytt2015-09-272-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simple here documentish syntax for REPL paste. This makes it easier to paste a block of script (as opposed to transcript). It also means you won't accidentally ctl-D out of the REPL and then out of SBT and then out of the terminal window. ``` scala> :paste < EOF // Entering paste mode (EOF to finish) class C { def c = 42 } EOF // Exiting paste mode, now interpreting. defined class C scala> new C().c res0: Int = 42 scala> :paste <| EOF // Entering paste mode (EOF to finish) |class D { def d = 42 } EOF // Exiting paste mode, now interpreting. defined class D scala> new D().d res1: Int = 42 scala> :quit ```
* | Merge pull request #4720 from retronym/ticket/9029Jason Zaugg2015-09-2912-5/+148
|\ \ | |/ |/| SI-9029 Fix regression in extractor patterns
| * SI-7850 Additional tests for name based patmatJason Zaugg2015-09-212-0/+28
| | | | | | | | Found these in an old review branch of mine.
| * SI-8989 Better error message for invalid extractor patternJason Zaugg2015-09-215-5/+51
| |
| * SI-9029 Fix regression in extractor patternsJason Zaugg2015-09-215-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The unified treatment of classical and named-based pattern matching does not correctly handle the generalization of "tuple capture". By "tuple capture", I mean: ``` scala> object Extractor { def unapply(a: Any): Option[(Int, String)] = Some((1, "2")) } defined object Extractor scala> "" match { case Extractor(x: Int, y: String) => } scala> "" match { case Extractor(xy : (Int, String)) => } warning: there was one deprecation warning; re-run with -deprecation for details scala> :warnings <console>:9: warning: object Extractor expects 2 patterns to hold (Int, String) but crushing into 2-tuple to fit single pattern (SI-6675) "" match { case Extractor(xy : (Int, String)) => } ^ ``` Name based pattern matching, new in Scala 2.11, allows one to deconstruct the elements that structurally resembles `ProductN`: ``` scala> class P2(val _1: Int, val _2: String) defined class P2 scala> object Extractor { def unapply(a: Any): Option[P2] = Some(new P2(1, "2")) } defined object Extractor scala> "" match { case Extractor(x: Int, y: String) => } ``` However, attempting to extract the `P2` in its entirety leads to an internal error: ``` scala> "" match { case Extractor(p2: P2) => } <console>:10: warning: fruitless type test: a value of type (Int, String) cannot also be a P2 "" match { case Extractor(p2: P2) => } ^ <console>:10: error: error during expansion of this match (this is a scalac bug). The underlying error was: type mismatch; found : P2 required: (Int, String) "" match { case Extractor(p2: P2) => } ^ ``` Note that this match was legal and warning free in 2.10. This commit avoids the hard-coded assumption that the "tuple capture" results in a `TupleN`, and instead keeps track of the product-ish type from which we extracted the element types. I have also opted not to limit the deprecation warning to `TupleN` extractors.
* | Improve presentation compilation of annotationsJason Zaugg2015-09-241-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A trio of problems were hampering autocompletion of annotations. First, given that that annotation is written before the annotated member, it is very common to end parse incomplete code that has a floating annotation without an anotatee. The parser was discarding the annotations (ie, the modifiers) and emitting an `EmptyTree`. Second, the presetation compiler was only looking for annotations in the Modifiers of a member def, but after typechecking annotations are moved into the symbol. Third, if an annotation failed to typecheck, it was being discarded in place of `ErroneousAnnotation`. This commit: - modifies the parser to uses a dummy class- or type-def tree, instead of EmptyTree, which can carry the annotations. - updates the locator to look in the symbol annotations of the modifiers contains no annotations. - uses a separate instance of `ErroneousAnnotation` for each erroneous annotation, and stores the original tree in its `original` tree.