summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2979 from retronym/ticket/7870Jason Zaugg2013-09-262-0/+7
|\ | | | | SI-7870 Detect default getter clashes in constructors
| * SI-7870 Detect default getter clashes in constructorsJason Zaugg2013-09-232-0/+7
| | | | | | | | | | | | | | | | | | | | Default getters for constructors live in the companion module. These eluded the check for clashes in default getter names due to overloading, which aims to give a more user friendly error than "double definition: meth$default$1". This commit checks for default getters in the companion module, in addition to those in the template itself.
* | SI-7876 Less dealiasing in Scaladoc's type printing.Jason Zaugg2013-09-263-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Scaladoc renders tuple and function types with the syntactic sugar. To do so, it was using `isFunctionType` and `isTupleType`. Internally, these methods dealias, so one can't simply take the type arguments from the given type to get the element types of the tuple. In ac96200c92, a Scaladoc crasher in this area was resolved by normalizing a type before extracting Tuple type arguments. Similar code already existed in the handling of FunctionTypes. This commit goes in the opposite direction, and instead queries the `direct` versions of those methods, which do not perform dealiasing. Conseqeuently, the type aliases that appear in the source code signatures for members will be rendered as such in Scaladoc. Which seems like an improvement.
* | SI-7876 Scaladoc crasher due to regression in isFunctionType.Jason Zaugg2013-09-263-0/+46
| | | | | | | | | | | | | | | | | | | | | | `isFunctionType` and `isTupleType` started returing true for type constructors as of aeb73314. This led to a crash in type printing in ScalaDoc (specfically, in ModelFactoryTypeSupport.scala) This commit: - fixes those methods by guarding with !isHigherKinded - unit tests said methods - tests the reported crasher with a ScalaDoc test.
* | Merge pull request #2982 from retronym/topic/checkinitAdriaan Moors2013-09-242-0/+8
|\ \ | | | | | | SI-4742 Make -Xcheckinit aware of constants.
| * | SI-4742 Make -Xcheckinit aware of constants.Jason Zaugg2013-09-242-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Members defined as `final val x = <literal>` are given a ConstantType. The constant is folded into the accessor method `x`, and the field itself is never initialized. (Related discussion: SI-4605) As such, -Xcheckinit spuriously warns when calling that accessor. This commit disables the checks for constants. This will also fix the checkinit build (failure tracked as SI-7839), which is the victim of this a spurious scolding.
* | | Merge pull request #2980 from huitseeker/revert-2957Jason Zaugg2013-09-2455-244/+177
|\ \ \ | |/ / |/| | Revert #2957
| * | Add position check for regression introduced by #2957François Garillot2013-09-242-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | The starting bound for ValDefs in #2957 is distinct from the expected result, e.g. [4:9]val x = [8:9]0 instead of [0:9]val x = [8:9]0
| * | Revert "Merge pull request #2957 from paulp/pr/parser-improvements"François Garillot2013-09-2453-244/+121
| | | | | | | | | | | | | | | This reverts commit 884e1ce762d98b29594146d37b85384581d9ba96, reversing changes made to f6fcc4431f272c707d49de68add532c452dd4b0f.
* | | Merge pull request #2975 from retronym/ticket/7868Jason Zaugg2013-09-233-0/+30
|\ \ \ | |/ / |/| | SI-7868 Account for numeric widening in match translation
| * | SI-7868 Account for numeric widening in match translationJason Zaugg2013-09-233-0/+30
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pattern match translation was unprepared for trees of the shape: (0: Short) match { case A.unapply(<unapply-selector>.toInt) <unapply> (_) => () case _ => () } While a scrutinee is inelibigle for implicit views in order to conform to the type of the extractor call, it is allowed to weakly conform. In this case, the typechecker will add the numeric widening with a `toInt` call. This commit: - Changes treeInfo.Unapplied to recognize this tree shape - Changes spliceApply to recognize and preserve the widening when substituting the unapply selector with the binder - Tests reification of such pattern matches, which also depends on treeInfo.Unapplied.
* | Merge pull request #2956 from som-snytt/issue/7848-forgotten-interp-msgJason Zaugg2013-09-235-3/+73
|\ \ | | | | | | SI-7848 Xlint says what looks interpolated
| * | SI-7848 Xlint no warn on $sym with paramsSom Snytt2013-09-182-1/+48
| | | | | | | | | | | | This idea brought to you by retronym.
| * | SI-7855 No missing interpolator warning post-typerSom Snytt2013-09-181-4/+1
| | | | | | | | | | | | Avoid extra work, extra warnings.
| * | SI-7848 Xlint says what looks interpolatedSom Snytt2013-09-174-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The motivating use case was an Expecty debug string getting flagged for `$eq`. The test case demonstrates a different bug, in which the position of the literal tree is changed when typer gets rid of the unused local, so that when the tree is re-typed in erasure, a second, spurious warning is emitted at the start of the method. Specifically, the second warning is not suppressed because of the different position.
* | | Merge pull request #2962 from densh/topic/syntactic-assignJason Zaugg2013-09-233-1/+45
|\ \ \ | | | | | | | | Quasiquotes: add syntactic extractor for assignment-like trees
| * | | add syntactic extractor for assignment-like treesDen Shabalin2013-09-183-1/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are three kinds of assign-like trees: 1. Assign(lhs, rhs) // $lhs = $rhs 3. AssignOrNamedArg(lhs, rhs) // $lhs = $rhs 2. Apply(Select(f, nme.update), args :+ rhs) // $f(..$args) = $rhs New syntactic combinator unifies all of them and lets users not to think about these implementations details.
* | | | Merge pull request #2974 from retronym/ticket/7864Jason Zaugg2013-09-232-0/+6
|\ \ \ \ | | | | | | | | | | SI-7864 Harden "looks like an interpolated String" warning
| * | | | SI-7864 Harden "looks like an interpolated String" warningJason Zaugg2013-09-222-0/+6
| | |_|/ | |/| | | | | | | | | | | | | | We can't rely on the qualifier of an `Apply` having a non-null symbol in general.
* | | | Merge pull request #2954 from retronym/ticket/7852Jason Zaugg2013-09-233-0/+40
|\ \ \ \ | |/ / / |/| | | Avoid null checks when emitting "".== and SomeModule.==
| * | | SI-7852 Refactor null-elision tests to be more focussedJason Zaugg2013-09-182-49/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Directly count null checks, rather than diffing the textual bytecode of the entire method - Add a test to show that the LHS needs to be a direct module reference, not just a tree with a module type, to elide the null check.
| * | | SI-7852 Omit null check for SomeModule.==Jason Zaugg2013-09-181-17/+5
| | | | | | | | | | | | | | | | For the same reasons outlined in the previous commits.
| * | | SI-7852 Test to show status quo of for SomeModule.==Jason Zaugg2013-09-172-7/+48
| | | | | | | | | | | | | | | | | | | | For which we can also elide the null check, and will in the next commit.
| * | | SI-7852 Omit null check for "".==Jason Zaugg2013-09-171-17/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although the same the code would be later optimized by -Yconst-opt, we can offer the same lean byte code to those compiling without that option by being more discerning when translating ==. This helps people using bytecode based code coverage tools such as jacoco that would emit "branch not covered" warnings for the impossible null check.
| * | | SI-7852 Test to show the status quo bytecode for "" == ...Jason Zaugg2013-09-173-0/+51
| | |/ | |/| | | | | | | Will be somewhat leaner after the next commit.
* | | add test case for SI-6719Den Shabalin2013-09-202-0/+9
| | | | | | | | | | | | | | | | | | The bug itself was fixed earlier in 95fe19545d60ae9aa79d2c8d5665c7f3b0cbdb1a It was caused by improper wrapping of blocks in the toolbox's parse method.
* | | SI-7854, SI-6768 better parsing/positioning in parserPaul Phillips2013-09-1847-111/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parser hole I found while working on the generated positions serves as the umbrella for a host of improvements. Upgraded positions assigned during some specific challenging situations mostly involving the creation of synthetic trees, e.g. for comprehensions and closures. While doing so improved some error messages. Eliminated some of the most glaring duplication in the parser. It's written like there is some payoff associated with being spectacularly imperative. Not so far.
* | | Position#show prints the point.Paul Phillips2013-09-1812-34/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Can't ensure range position points are meaningful when we never see them. To limit noise, only print the point when it != start. [x:y] // point=x, start=x, end=y [p/x:y] // point=p, start=x, end=y I'm open to a different syntax. Also prints NoPosition as [X] rather than [NoPosition] because noise is for construction workers and attenders of rock concerts. Some range position and parser tests are included so we can see the checkfile change when the forthcoming fix happens (either an error message improvement or a positional one.)
* | | Merge pull request #2961 from paulp/pr/whitespaceJason Zaugg2013-09-18964-3659/+3453
|\ \ \ | |_|/ |/| | Cull extraneous whitespace.
| * | Cull extraneous whitespace.Paul Phillips2013-09-18964-3659/+3453
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One last flurry with the broom before I leave you slobs to code in your own filth. Eliminated all the trailing whitespace I could manage, with special prejudice reserved for the test cases which depended on the preservation of trailing whitespace. Was reminded I cannot figure out how to eliminate the trailing space on the "scala> " prompt in repl transcripts. At least reduced the number of such empty prompts by trimming transcript code on the way in. Routed ConsoleReporter's "printMessage" through a trailing whitespace stripping method which might help futureproof against the future of whitespace diseases. Deleted the up-to-40 lines of trailing whitespace found in various library files. It seems like only yesterday we performed whitespace surgery on the whole repo. Clearly it doesn't stick very well. I suggest it would work better to enforce a few requirements on the way in.
* | | Merge pull request #2955 from retronym/ticket/7853Paul Phillips2013-09-184-2/+52
|\ \ \ | |/ / |/| | SI-7853 Regression in explicit outer
| * | SI-7853 A less ad-hoc place to call memberTypeJason Zaugg2013-09-181-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than localizing the fix to the outerAccessor, this commit pushed the call to `memberType` into *all* usages of `newValDef` and `newDefDef`. The TPT of `applyOrElse` in synthetized partial functions must be set explicitly to pass the pos/t7853-partial-function.scala. Otherwise, the as-seen-from ends up cloning the type parameter `B1` of `applyOrElse` as it transforms (questionably) its bound from `List[Int @unchecked]` to `List[Int]`. Partial Function synthesis was already a delicate area, and this makes things more explicit which could be counted as an improvement.
| * | SI-7853 An unsatisfying fix regression in explicit outerJason Zaugg2013-09-183-2/+45
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The attempt to placate pos/t4970.scala in 55c6fd4 roused another dragon. We've got two levers here: the type of the symbol of the outer accessor, and the type of its DefDef. They have been historically out of sync due to the vaguaries of finalResultType (which is far less vague since 671e6e03c7), but the finicky operation of ExplicitOuter now has a hard time when we try to bring them into line. This stuff is notoriously difficult to understand because the trees you see from `-Xprint` show a tpt derived from the method symbol's info, and discards the actual tpt in the tree. Rather than letting `DefDef(acc)` call `TypeTree(sym)` and use `sym.tpe_*.finalResultType`, this commit computes the member type of the accessor from the current class and explicitly uses that as the return type of the outer accessor def. We should try to push this a little deeper. I tried to put it into `def TypeTree`, but that broke, among others, run/concurrent-stream.scala. Maybe `def DefDef` and `def ValDef`? But a localised fix is the right start as it addresses the regression in a minimal fashion to get the IDE building again.
* | Longer timeout for repl test.Paul Phillips2013-09-171-1/+1
| | | | | | | | | | 15 seconds is crazy aggressive. I have fast hardware and it's still really easy for a test to take to fifteen seconds under load.
* | Merge pull request #2951 from retronym/ticket/7847Grzegorz Kossakowski2013-09-172-0/+15
|\ \ | | | | | | SI-7847 Static forwarders for case apply/unapply
| * | SI-7847 Static forwarders for case apply/unapplyJason Zaugg2013-09-162-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were excluded in f901816b3f because at the time they were compiler fiction and translated to calls to the case class constructor or accessors. But since they are now bona-fide methods (albeit still occasionally bypassed as an optimization), we can expose them conveniently to our Java brethren. The cut-and-pastiness of GenBCode starts to hinder maintenance. Here's a report of further duplication that we have to fix up post haste: https://gist.github.com/retronym/6334389
* | | Merge pull request #2950 from retronym/ticket/7841Grzegorz Kossakowski2013-09-171-0/+46
|\ \ \ | |_|/ |/| | Damage control related to AnyRef specialization
| * | SI-7841 More robust unspecialization of namesJason Zaugg2013-09-161-0/+46
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Names like `T1$sp`, which can arise from `AnyRef` specialization, were leading to negative length Names if they ever passed through `unspecializedName` or `splitSpecializedName`. This code path was touched when printing the tree of a certain AnyRef specialized classes after specialization, such as `AbstractPartialFunction` (which had such specialization until a few commits ago.) This commit handles that case correctly, and generally hardens against unexpected names, which could pop up from third party classes. The documentation for `splitSpecializedName` transposed the class and method specializations. The things you discover when you turn examples in documentation in to test cases! In addition, we now require non-negative length and offset in `newTermName`
* | Merge pull request #2935 from densh/topic/si-7304-6489-6701Jason Zaugg2013-09-169-2/+96
|\ \ | | | | | | SI-6701, SI-7304, SI-6489, variable arity definitions refactoring
| * | SI-6489 parsing in macros should provide proper positionsDen Shabalin2013-09-127-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. macro parsing doesn't use toolbox any more but calls parser directly 2. in order for this to work parser has to be refactored to limit usage of currentUnit and rewire it into parser's local unit method which might use currentUnit for some parsers but will user proper unit for UnitParser 3. similar change has to be done to make compilation unit's reporter overridable
| * | SI-7304 improve deprecation warnings for tree factory methodsDen Shabalin2013-09-112-1/+54
| | |
* | | SI-7845 Disable test for JSR 233Jason Zaugg2013-09-162-0/+8
| |/ |/| | | | | | | | | | | | | | | | | | | | | For Paul, it steals focus when it runs. For me, it fails with some platform specific extra output: -ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider apple.applescript.AppleScriptEngineFactory could not be instantiated: java.lang.UnsatisfiedLinkError: no AppleScriptEngine in java.library.path n: Object = 10 12345678910 So off to the holding pen for now.
* | Merge pull request #2884 from retronym/ticket/3832Jason Zaugg2013-09-1512-1/+87
|\ \ | | | | | | SI-1909 SI-3832 SI-7007 SI-7223 Improved handling of larval objects
| * | SI-7223 More finesse in setting INCONSTRUCTORJason Zaugg2013-09-122-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's a clunky flag used to determine very early on whether we're in the self-call, super-call or early-init section. In SI-6666 / fd6125428, the check was improved to consider nesting. But, that caused this regression, as Function's haven't been translated to classes yet, so our check for enclosing non-term owners failed wrongly flagged definitins body of a anonymous function as INCONSTRUCTOR. With this patch, we correctly flag: class C extends D { // INCONSTRUCTOR () => { !INCONSTRUCTOR } // INCONSTRUCTOR }
| * | SI-7007 Test case shows we disallow premature `this` accessJason Zaugg2013-09-112-0/+21
| | | | | | | | | | | | | | | | | | | | | Rather than the old behaviour, which compiled successfully but led us into the jaws of a LinkageError. Related to SI-6666.
| * | SI-3832 Don't lift methods in aux constructor trailing stats as STATICJason Zaugg2013-09-115-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SI-1909 modified LambdaLift to lift in auxiliary constructors methods as STATIC so they could be called before the self-constructor was called. That allowed for: class Foo (x: Int) { def this() = this( { def bar() = 5 bar }) } However, if the method is in a statement that trails the self constructor call, this is unnecessary and in fact incorrect as it robs the lifted method of `this`. This commit uses the machinery established in SI-6666 to limit the STATIC-ness of lifted methods to those used in arguments for self-constructor calls. This is used exclusively; the `isAuxillaryConstructor` check wasn't the right way to solve this, as was seen by the regression it caused in SI-3832. A new test case shows that we can statically lift methods in super-constructor calls, rather than just self-constructor calls. We also have to avoid statically lifting objects in these positions. For now, I just emit a dev warning that a VerifyError is in your future. With some more thought we could escalate that to a implementation restriction and emit an error.
| * | SI-1909 Move tests from pos to runJason Zaugg2013-09-113-1/+11
| |/ | | | | | | | | | | | | | | When we're in the neighbourhood of VerifyErrors, it's better to run the code. This change is leading up to a fix for SI-3832, which regressed with fix for SI-1909.
* | Merge pull request #2931 from paulp/pr/TreeDSLJason Zaugg2013-09-157-14/+162
|\ \ | | | | | | Reducing variation of tree creation methods.
| * | Reducing variation of tree creation methods.Paul Phillips2013-09-134-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TreeDSL has no future - it was always a temporary measure waiting for something like quasiquotes to come along. In this commit I cull as much of it as I can, especially the delicate matter of creating new DefDefs and ValDefs, which I completely turn over to the old style creators. I unified all the symbol-based DefDef and ValDef creators under a single method, since it was yet another place where ctrl-C and ctrl-V were being punched with glee. Was beaten to the punch on adding copyTypeDef to fill out the *Def creators. Eliminated as many redundant positioning calls as I could find. If you are creating a DefTree tree based on a symbol, it will always have an atPos(sym.pos) { ... } wrapped around it. You don't need another one. All of this is motivated by positions work: positions are assigned in so many places and in such an ad hoc fashion that it is impossible to bring consistency to that without first bringing some consistency to tree creation.
| * | Widen type of outer accessor.Paul Phillips2013-09-131-2/+2
| | | | | | | | | | | | | | | This is the key ingredient so TypeTree(sym) can resist widening the type.