summaryrefslogtreecommitdiff
path: root/test/files
Commit message (Collapse)AuthorAgeFilesLines
* 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
* 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.
* 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
* 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.
* | 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 #4843 from SethTisue/scaladoc-little-d-pleaseJason Zaugg2015-11-136-6/+6
|\ \ | | | | | | it's Scaladoc, not ScalaDoc
| * | it's Scaladoc, not "ScalaDoc" or "Scala doc"Seth Tisue2015-11-126-6/+6
| |/ | | | | | | | | renaming the existing ScalaDoc and ScalaDocReporter classes might break stuff, sadly, but at least we can fix the rest
* | 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-212-3/+3
|\ \ | |/ |/| improvements to Windows build & test situation
| * 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 #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.
* | Merge pull request #4757 from lrytz/t9375-2.11Lukas Rytz2015-09-227-7/+356
|\ \ | | | | | | [backport] SI-9375 add synthetic readResolve only for static modules
| * | [backport] SI-9375 add synthetic readResolve only for static modulesLukas Rytz2015-09-227-7/+356
| |/ | | | | | | | | | | | | | | | | 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 pull request #4725 from retronym/topic/completely-2.11Lukas Rytz2015-09-2111-43/+36
|\ \ | | | | | | Topic/completely 2.11
| * \ Merge remote-tracking branch 'origin/2.11.x' into topic/completely-2.11Jason Zaugg2015-09-1768-0/+39
| |\ \
| * | | Fix completion for synthetic case modules and methodsJason Zaugg2015-09-101-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | SI-5408 Prompt after incomplete script pasteSom Snytt2015-09-022-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-028-40/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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._ ```
* | | | Merge pull request #4716 from Ichoran/issue/9388Lukas Rytz2015-09-213-4/+31
|\ \ \ \ | | | | | | | | | | SI-9388 Fix Range behavior around Int.MaxValue
| * | | | SI-9388 Fix Range behavior around Int.MaxValueRex Kerr2015-09-193-4/+31
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #4752 from alexeyr/topic/errornonexistentfield-messageLukas Rytz2015-09-211-3/+3
|\ \ \ \ | | | | | | | | | | [backport] Include owner in ErrorNonExistentField message
| * | | | [backport] Include owner in ErrorNonExistentField messageAlexey Romanov2015-09-181-3/+3
| |/ / / | | | | | | | | | | | | This should be particularly helpful for synthetic field names like `evidence$21`.
* / / / fix t9370 so it works on Windows tooSeth Tisue2015-09-181-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | partest has custom code for -Xplugin handling (see DirectCompiler.updatePluginPath for details). that code has its own idea of what the syntax of -Xplugin is, different from Scalac's. partest's idea is that multiple paths should be separated by the platform classpath separator character, so : on Unix and ; on Windows. the .flags file here was using a colon, and that confuses partest on Windows, since partest was expecting a semicolon. it might be nice to fix partest to accept comma as the separator instead, which is standard for a scalac MultiStringSetting such as -Xplugin. but it turns out we have an out: we can just provide multiple -Xplugin flags. what evidence do I have that this is the right change? * the test still passes on both Windows and Mac OS X (manually tested); if Travis likes it, we'll know it passes on Linux too * I tried reverting Som's fix for SI-9370 (c32ba93) and the test failed, as expected, both with and without my change * I added a bunch of debugging output to DirectCompiler.updatePluginPath in partest, built a new partest jar, and used it to run the test on Windows with and without my fix, and verified by eye that the logic there was operating as expected in both cases and in conclusion, for Som's benefit: <insert cryptic joke here>
* | / SI-9475 Dependent PolyTypes are dependent typesVlad Ureche2015-09-171-0/+19
| |/ |/| | | | | Such that uncurry can correctly un-dependify them.
* | Merge pull request #4727 from SethTisue/unset-stray-execute-bitsSeth Tisue2015-09-1465-0/+0
|\ \ | | | | | | unset inappropriate execute bits
| * | unset inappropriate execute bitsSeth Tisue2015-09-0265-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I imagine these date back to old Subversion days and are probably the result of inadvertent commits from Windows users with vcs client configs. having the bit set isn't really harmful most of the time, but it's just not right, and it makes the files stand out in directory listings for no reason
* | | SI-9369 Fix pattern matcher warnings for diamond shaped inheritance.Gerard Basler2015-09-122-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A previous optimization (d44a86f432a7f9ca250b014acdeab02ac9f2c304) for pattern matcher exhaustivity checks used a smarter encoding to ensure that the scrutinee can be equal to one child only. However, in case of traits between the root and leave type, a child can be of several types and these types should not be in a mutually exclusive group. A simple solution (hat tip to retronym) is to just put traits and classes into separate groups.
* | | Merge pull request #4704 from VladUreche/issue/9442Jason Zaugg2015-09-061-0/+14
|\ \ \ | |_|/ |/| | SI-9442 Fix the uncurry-erasure types
| * | SI-9442 Fix the uncurry-erasure typesVlad Ureche2015-08-231-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using the "uncurry-erased" type (the one after the uncurry phase) can lead to incorrect tree transformations. For example, compiling: ``` def foo(c: Ctx)(l: c.Tree): Unit = { val l2: c.Tree = l } ``` Results in the following AST: ``` def foo(c: Ctx, l: Ctx#Tree): Unit = { val l$1: Ctx#Tree = l.asInstanceOf[Ctx#Tree] val l2: c.Tree = l$1 // no, not really, it's not. } ``` Of course, this is incorrect, since `l$1` has type `Ctx#Tree`, which is not a subtype of `c.Tree`. So what we need to do is to use the pre-uncurry type when creating `l$1`, which is `c.Tree` and is correct. Now, there are two additional problems: 1. when varargs and byname params are involved, the uncurry transformation desugares these special cases to actual typerefs, eg: ``` T* ~> Seq[T] (Scala-defined varargs) T* ~> Array[T] (Java-defined varargs) =>T ~> Function0[T] (by name params) ``` we use the DesugaredParameterType object (defined in scala.reflect.internal.transform.UnCurry) to redo this desugaring manually here 2. the type needs to be normalized, since `gen.mkCast` checks this (no HK here, just aliases have to be expanded before handing the type to `gen.mkAttributedCast`, which calls `gen.mkCast`)
* | | Merge pull request #4692 from JanBessai/Fix-SI-6636Adriaan Moors2015-08-312-0/+24
|\ \ \ | |_|/ |/| | SI-6636 Fix macro expansion in toolboxes
| * | SI-6636 Fix macro expansion in toolboxesJan Bessai2015-08-232-0/+24
| | |
* | | SI-9450 Fix triple quoted strings in REPL :power modeJason Zaugg2015-08-272-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some extra synthetic code generated under this mode failed to escape input before adding it to a literal string. It used to get away with this most of the time by triple quoting the literal. This commit reuses Scala string escaping logic buried in `Constant` to do this properly. Actually, the proper approach would be to build the synthetic code with trees and quasiquotes, and avoid the mess of stringly-genererated code. I threw in some defensive hygiene for the reference to `Nil` while I was in the neighbourhood.
* | | Fix typos in spec, docs and commentsMichał Pociecha2015-08-2312-13/+13
| |/ |/|
* | Revert "SI-8346 Rebuild invariant sets in #toSet, avoiding CCE"Adriaan Moors2015-08-182-40/+0
|/
* Merge pull request #4554 from som-snytt/issue/1931Seth Tisue2015-08-0622-73/+116
|\ | | | | SI-1931 Hide Predef.any2stringadd in REPL