summaryrefslogtreecommitdiff
path: root/test/files
Commit message (Collapse)AuthorAgeFilesLines
* SI-5189 detect unsoundness when inferring type of matchAdriaan Moors2013-01-142-0/+14
| | | | | | | | | | | GADT skolems encode type slack that results from pattern matching on variant type constructors I thought they would not longer be relevant after cases have been typed, and since they caused weird issues with the old pattern matcher, I deskolemized in typedCase however, when we don't have an expected type for the match, we need to keep the skolems around until the skolemized type makes it out of the match and it becomes the result of type inference for that match when you do have an expected type, it will propagate to the case-level and the confrontation will thus already take place when typing individual cases
* Merge commit 'refs/pull/1844/head' into merge/pr-1844Paul Phillips2013-01-1125-12/+88
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'refs/pull/1844/head': macroExpandAll is now triggered by typed SI-5923 adapt macros when they are deferred generalizes macroExpand typedPrimaryConstrBody now returns supercall more precise errors for macros parentTypes => typedParentTypes changes isTermMacro checks to something more universal fixes printing of AppliedTypeTree adds Trees.replace(Tree, Tree) makes macro override error more consistent refactors handling of macros in repl SI-5903 extractor macros do work adds c.macroRole Conflicts: src/compiler/scala/tools/nsc/typechecker/Macros.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala
| * macroExpandAll is now triggered by typedEugene Burmako2013-01-094-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously delayed macro expansions (the sole purpose of macroExpandAll) were triggered by `typedArgs`. Probably I wanted to save CPU cycles on not checking whether we have pending macro expansions on every iteration of typecheck. However this optimization is uncalled for, because the check just entails reading a var, therefore benefits of the current approach are negliible, whereas the robustness hit is tangible. After delayed macro expansion mechanism became more robust, it exposed a bug, well-hidden before. If one first delays a macro and then finds out that the expandee is erroneous, subsequent `macroExpandAll` will crash, because it expects a macro runtime attachment to be present. Previously the erroneous code path never got triggered, because the macro expansion never commenced. Luckily the fix was easy.
| * SI-5923 adapt macros when they are deferredEugene Burmako2013-01-099-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amazingly enough, the fix for the "macro not expanded" problem was super easy. (And I remember spending a day or two trying to find a quick fix somewhen around Scala Days 2012!) The problem was in the implementation of the macro expansion trigger, which was buried in a chain of if-elif-elif. This meant that macro expansion was mutually exclusive with a lot of important adaptations, e.g. with `instantiate`. More precisely, if an expandee contains an undetparam, its expansion should be delayed until all its undetparams are inferred and then retried later. Sometimes such inference can only happen upon a call to instantiate in one of the elif's coming after the macro expansion elif. However this elif would never be called for expandees, because control flow would always enter the macro expansion branch preceding the inference branch. Consequences of this fix are vast. First of all, we can get rid of the "type parameter must be specified" hack. Secondly and most importantly, we can now remove the `materializeImplicit` method from Implicits and rely on implicit macros to materialize tags for us. (This is a tricky change, and I'll do it later after we merge as much of my pending work as possible). Finally, we learn that the current scheme of interaction between macros, type inference and implicits is, in principle, sound!
| * makes macro override error more consistentEugene Burmako2013-01-093-3/+3
| |
| * refactors handling of macros in replEugene Burmako2013-01-092-2/+2
| | | | | | | | | | | | | | | | Macros now have a dedicated member handler, so that the logic of their processing doesn't get mixed up with vanilla DefHandler. I've also factored out an abstract MacroHandler to provides a basis to build the upcoming type macro handler upon.
| * SI-5903 extractor macros do workEugene Burmako2013-01-098-0/+72
| | | | | | | | | | | | | | | | | | Apparently it is already possible to use macros to customize pattern matching as described in the comments to the aforementioned JIRA issue. What's even better - with the incoming addition of c.introduceTopLevel it becomes possible to generate arbitrarily complex unappliers, even with heterogeneous types of arguments varying from expansion to expansion
* | Merge pull request #1874 from paulp/pr/mode-value-classPaul Phillips2013-01-111-1/+1
|\ \ | | | | | | Made "mode" into a value class.
| * | Made "mode" into a value class.Paul Phillips2013-01-091-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an obvious place to apply value class goodness and collect some safety/sanity in typing modes. It does show off a challenge in introducing value classes without disruption: there's no way to deprecate the old signature of 'typed', 'adapt', etc. because they erase the same. class Bippy(val x: Int) extends AnyVal class A { @deprecated("Use a bippy") def f(x: Int): Int = 5 def f(x: Bippy): Int = x.x } ./a.scala:5: error: double definition: method f:(x: Bippy)Int and method f:(x: Int)Int at line 4 have same type after erasure: (x: Int)Int An Int => Mode implicit handles most uses, but nothing can be done to avoid breaking anything which e.g. extends Typer and overrides typed.
* | Moved repl javap tests into pending.Paul Phillips2013-01-118-118/+0
| | | | | | | | For not passing on java6.
* | Merge pull request #1873 from paulp/pr/variance-bonanzaPaul Phillips2013-01-1013-1/+741
|\ \ | | | | | | a painstaking examination of Variance
| * | SI-5378, unsoundness with type bounds in refinements.Paul Phillips2013-01-092-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the comment says: Not enough to look for abstract types; have to recursively check the bounds of each abstract type for more abstract types. Almost certainly there are other exploitable type soundness bugs which can be seen by bounding a type parameter by an abstract type which itself is bounded by an abstract type. SPECIAL: BUY ONE UNSOUNDNESS, GET ONE FREE In refinement types, only the first parameter list of methods was being analyzed for unsound uses of abstract types. Second parameter list and beyond had free unsoundness reign. That bug as well is fixed here.
| * | SI-6566, unsoundness with alias variance.Paul Phillips2013-01-096-1/+55
| | | | | | | | | | | | | | | | | | | | | This wasn't as bad as it could have been. All these changes plug soundness holes in trunk. Mostly we're looking at type aliases which were merely protected when they had to be protected[this] not to allow unsound variance crossover.
| * | Boosted test coverage.Paul Phillips2013-01-095-0/+601
| |/
* | Merge pull request #1849 from som-snytt/issue/6894-javap-appPaul Phillips2013-01-108-0/+118
|\ \ | |/ |/| Repl javap decodes various synthetic names for us (fixing SI-6894)
| * Repl javap decodes various synthetic names for us (fixing SI-6894)Som Snytt2013-01-098-0/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For instance, javap -app Test is equivalent to javap Test$delayedInit$App with the correct line and iw prepended. This works by taking Test as a name in scope, translating that, and then supplying the suffix. Then javap -fun Test shows Test$$anonfun*, and for member m, javap -fun Test#m shows Test$$anonfun$$m*. This also works for classes and values defined in the repl. javap -fun -raw m shows $line3.$read$$iw$$iw$$anonfun$m$1. E.g., javap -fun scala.Enumeration obviates knowing or guessing scala/Enumeration$$anonfun$scala$Enumeration$$populateNameMap$1.class. Also, scala> :javap -fun scala.Array#concat but still to do is using imported syms. Both files and replout are supported for searching for artifacts. The trigger is detecting the synthetic name (has an interior dollar). Still to do, filter the output on Test#m to show only m. Need a way to explore the list of artifacts; ideally, related symbols would be available reflectively. Prefer companion class to object, otherwise it's not showable; for object, require dollar when both exist. A JavapTest is supplied that is a ReplTest that asserts something about its output instead of printing it.
* | Merge branch '2.10.x'Adriaan Moors2013-01-0826-87/+314
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patches applied: - rename of `dropRepeatedParamType` to `dropIllegalStarTypes` -- required since 8886d22cd6 - fixed test/files/neg/t6406-regextract.flags -- how could this have worked before? Conflicts: src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala src/library/scala/collection/LinearSeqOptimized.scala src/library/scala/util/Properties.scala test/files/run/streams.check test/files/run/streams.scala
| * \ Merge pull request #1834 from paulp/issue/6897Paul Phillips2013-01-061-0/+6
| |\ \ | | | | | | | | SI-6897, lubs and varargs star.
| | * | SI-6897, lubs and varargs star.Paul Phillips2012-12-311-0/+6
| | | | | | | | | | | | | | | | | | | | Don't allow lubs to calculate refinement types which contain a varargs star outside of legal varargs star position.
| * | | Merge pull request #1835 from paulp/issue/6896Paul Phillips2013-01-062-0/+8
| |\ \ \ | | | | | | | | | | SI-6896, spurious warning with overloaded main.
| | * | | SI-6896, spurious warning with overloaded main.Paul Phillips2012-12-312-0/+8
| | |/ / | | | | | | | | | | | | | | | | Make sure there's no legit main signature before issuing any warnings about missing main methods.
| * | | Merge pull request #1840 from paulp/issue/6911Paul Phillips2013-01-063-69/+106
| |\ \ \ | | | | | | | | | | SI-6911, regression in generated case class equality.
| | * | | SI-6911, regression in generated case class equality.Paul Phillips2013-01-033-69/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Caught out by the different semantics of isInstanceOf and pattern matching. trait K { case class CC(name: String) } object Foo extends K object Bar extends K Foo.CC("a") == Bar.CC("a") That expression is supposed to be false, and with this commit it is once again.
| * | | | Merge pull request #1841 from adriaanm/rebase-6827-2.10.xAdriaan Moors2013-01-042-0/+46
| |\ \ \ \ | | | | | | | | | | | | Fix Iterator#copyToArray (fixes SI-6827).
| | * | | | Fix Iterator#copyToArray (fixes SI-6827).Erik Osheim2013-01-042-0/+46
| | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As pointed out in #scala, when using a non-zero start it's possible to get an ArrayIndexOutOfBoundsException due to an incorrect bounds check. This patch fixes this, as well as another potential bounds error, and adds test cases. Incorporates some other suggestions by Som-Snytt to ensure that callers will get useful error messages in cases where the start parameter is wrong (negative or out-of-array-bounds). Review by @som-snytt.
| * | | | Merge pull request #1739 from jedesah/Array_optPaul Phillips2013-01-042-0/+15
| |\ \ \ \ | | |/ / / | |/| | | SI-5017 Poor performance of :+ operator on Arrays
| | * | | SI-5017 Poor performance of :+ operator on ArraysJean-Remi Desjardins2012-12-232-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Control performance of :+ and +: operator on my machine were 700-800 ms After adding size hint on the implementation in SeqLike, it went down to 500-600 ms But with specialixed implementation in ArrayOps, brings it down to 300-400 ms Unfortunatly, this method will only be called when the Array object is being referenced directly as it's type, but that should be the case enough times to justify the extra method. I ended up removing the sizeHint in SeqLike because it made the execution of the "benchmark" slower when the Array was being manipulated as a Seq. Side note: Interestingly enough, the benchmark performed better on my virtualized Fedora 17 with JDK 7 than natively on Mac OS X with JDK 6
| * | | | Merge pull request #1822 from paulp/issue/6194Paul Phillips2013-01-032-0/+9
| |\ \ \ \ | | |_|/ / | |/| | | SI-6194, repl crash.
| | * | | SI-6194, repl crash.Paul Phillips2012-12-272-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Always a bad idea to use replaceAll on unknown strings, as we saw here when windows classpaths arrived containing escape-requiring backslashes.
| * | | | Merge pull request #1824 from paulp/pr/partest-likes-deprecationPaul Phillips2012-12-317-3/+7
| |\ \ \ \ | | | | | | | | | | | | Remove -deprecation from partest default options.
| | * | | | Remove -deprecation from partest default options.Paul Phillips2012-12-277-3/+7
| | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Who knows why it was ever like this; it's not like anyone sees the deprecation warnings. In PR #1807 there is now a test which depends on partest not making this move, so it's a good time to finally expunge it.
| * | | | LinearSeq lengthCompare without an iterator.Paul Phillips2012-12-282-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Had to fix up an iffy test: not only was it testing undefined behavior, it demanded just the right numbers be printed in a context where all negative or positive numbers are equivalent. It's the ol' "get them coming and going" trick.
| * | | | SI-6415, overly eager evaluation in Stream.Jean-Remi Desjardins2012-12-282-0/+34
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | The lengthCompare method in LinearSeqOptimized was looking one step further than it needed to in order to give the correct result, which was creating some unwanted side effects related to Streams.
| * | | SI-6829, SI-6788, NPEs during erroneous compilation.Paul Phillips2012-12-244-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | Have to intercept trees which have a null type due to errors before they leave the warm confines of 'def typed' because from that point everything assumes tree.tpe != null.
* | | | Merge pull request #1817 from scalamacros/topic/introduce-top-levelv2.11.0-M1Eugene Burmako2013-01-0619-7/+139
|\ \ \ \ | | | | | | | | | | adds c.introduceTopLevel
| * | | | adds c.introduceTopLevelEugene Burmako2013-01-0519-7/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first in the family of mutators for the global symbol table, `introduceTopLevel` is capable of creating synthetic top-level classes and modules. The addition of nme.EMPTY_PACKAGE_NAME is necessary to let programmers insert definitions into the empty package. That's explicitly discouraged in the docs, but at times might come in handy. This patch introduce workarounds to avoid incompatibilities with SBT. First of all SBT doesn't like VirtualFiles having JFile set to null. Secondly SBT gets confused when someone depends on synthetic files added by c.introduceTopLevel. Strictly speaking these problems require changes to SBT, and that will be done later. However the main target of the patch is paradise/macros, which needs to be useful immediately, therefore we apply workarounds.
* | | | | Merge pull request #1847 from JamesIry/SI-6916_masterPaul Phillips2013-01-062-0/+19
|\ \ \ \ \ | | | | | | | | | | | | SI-6916 makes FlatHashTable#remove a Boolean not Option[A]
| * | | | | SI-6916 makes FlatHashTable#remove a Boolean not Option[A]James Iry2013-01-042-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes FlatHashTable#remove return a boolean instead of Option[A]. Updates HashSet accordingly. Adds a test to make sure remove works as advertised.
* | | | | | SI-6918 Changes REPL output from "defined module" to "defined object"Simon Ochsenreither2013-01-057-10/+10
|/ / / / /
* | | | | Merge pull request #1839 from JamesIry/SI-6908_masterAdriaan Moors2013-01-042-0/+74
|\ \ \ \ \ | |/ / / / |/| | | | SI-6908 Makes FlatHashTable as well as derived classes support nulls
| * | | | SI-6908 Makes FlatHashTable as well as derived classes support null valuesJames Iry2013-01-032-0/+74
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | This change adds a null sentinel object which is used to indicate that a null value has been inserted in FlatHashTable. It also makes a strong distinction between logical elements of the Set vs entries in the hash table. Changes are made to mutable.HashSet and ParHashSet accordingly.
* | | | Merge pull request #1785 from non/bug/fix-copyToArrayAdriaan Moors2013-01-042-0/+46
|\ \ \ \ | | | | | | | | | | Fix Iterator#copyToArray (fixes SI-6827).
| * | | | Fix Iterator#copyToArray (fixes SI-6827).Erik Osheim2012-12-202-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As pointed out in #scala, when using a non-zero start it's possible to get an ArrayIndexOutOfBoundsException due to an incorrect bounds check. This patch fixes this, as well as another potential bounds error, and adds test cases. Incorporates some other suggestions by Som-Snytt to ensure that callers will get useful error messages in cases where the start parameter is wrong (negative or out-of-array-bounds). Review by @som-snytt.
* | | | | Updated copyright to 2013Carlo Dapor2013-01-022-2/+2
| |/ / / |/| | |
* | | | Merge pull request #1816 from scalamacros/topic/enclosuresEugene Burmako2012-12-305-1/+59
|\ \ \ \ | | | | | | | | | | enclosures are now strongly typed and are no longer vals
| * | | | enclosures are now strongly typed and are no longer valsEugene Burmako2012-12-255-1/+59
| | | | |
* | | | | Merge pull request #1807 from scalamacros/topic/ident-deprecation-warningsEugene Burmako2012-12-303-0/+20
|\ \ \ \ \ | | | | | | | | | | | | the scanner is now less eager about deprecations
| * | | | | changes the flags to not depend on partestEugene Burmako2012-12-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to some reason, partest always enables -deprecation. Since Paul has just submitted a pull request, which removes this behavior, I'm updating the flags to make sure this test works even after Paul's change.
| * | | | | the scanner is now less eager about deprecationsEugene Burmako2012-12-253-0/+20
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | When healing braces it isn't very useful to report deprecation warnings, especially since this process is just simple context-free skimming, which can't know about what positions can accept what identifiers.
* | | | | Merge pull request #1809 from scalamacros/topic/ident-attachmentsPaul Phillips2012-12-294-0/+23
|\ \ \ \ \ | | | | | | | | | | | | fixes the typedIdent problem for good