summaryrefslogtreecommitdiff
path: root/test/files/pos
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #1989 from adriaanm/rework-pr-1945Paul Phillips2013-01-312-32/+0
|\ | | | | SI-6968 Simple Tuple patterns aren't irrefutable
| * SI-6968 Simple Tuple patterns aren't irrefutableJason Zaugg2013-01-272-32/+0
| | | | | | | | | | | | | | | | | | | | | | | | Reverts part of c82ecab. The parser can't assume that a pattern `(a, b)` will match, as results of `.isInstanceOf[Tuple2]` can't be statically known until after the typer. The reopens SI-1336, SI-5589 and SI-4574, in exchange for fixing this regression SI-6968. Keeping all of those fixed will require a better definition of irrefutability, and some acrobatics to ensure safe passage to the ambiguous trees through typechecking.
* | Merge pull request #1997 from retronym/ticket/7035Paul Phillips2013-01-301-0/+15
|\ \ | | | | | | SI-7035 Centralize case field accessor sorting.
| * | SI-7035 Centralize case field accessor sorting.Jason Zaugg2013-01-281-0/+15
| |/ | | | | | | | | | | It is both burdensome and dangerous to expect callers to reorder these. This was seen in the field permutation in the unapply method; a regression in 2.10.0.
* | SI-6516, macros comparing types with == instead of =:=.Paul Phillips2013-01-301-0/+19
| | | | | | | | | | | | | | | | | | I gift-wrapped this ticket four months ago: 'I think it will be enough to say "tpe =:= MacroContextClass.tpe" rather than == .' Indeed. Had to open my own gift. Thanks, paulp!
* | SI-6551 Expand test case into uncomfortable areas.Jason Zaugg2013-01-291-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | trait T { type U } class A(val a: T) extends AnyVal { def foo[TT <: a.U] = 0 } It works! But it's pure serendipity. After extmethods, the careful student of ASTs will find: object A { final def foo$extension[TT >: Nothing <: A.this.a.U]($this: A): Int = 0; } `A.this` doesn't belong. For now we just include this case under our test umbrella.
* | SI-6651 Substitute `this` in extension method sigsJason Zaugg2013-01-291-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows for the likes of: class A[X](val x: X) extends AnyVal { def foo(xy: x.Y) {} } We have to do this in both directions, when synthesizing the extension method in `Extender#transform`, and later on when Erasure tries to find the corresponding extension methods by backing out the original signatures from the signatures of the synthesized methods in the companion. In the first case, we have to be careful to use a stable reference to the `self` parameter, which can satisfy the dependent types.
* | Merge pull request #1981 from retronym/backport/1187Adriaan Moors2013-01-281-0/+29
|\ \ | | | | | | [backport] SI-3577 BoundedWildcardType handling
| * | [backport] SI-3577 BoundedWildcardType handlingJason Zaugg2013-01-261-0/+29
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 3c91b32d699a9e29d685ac20c9805f96c9f2db2c Author: Jason Zaugg <jzaugg@gmail.com> Date: Fri Aug 24 01:16:47 2012 +0200 Mention BoundedWildcardType in "a standard type pattern match". (cherry picked from commit 00e46b3dbcea2b72fd3941b7ffc2efba382871e9) commit 0664be2b69b1ce013e937bc93f4e84b891676f1f Author: Jason Zaugg <jzaugg@gmail.com> Date: Fri Aug 24 01:05:07 2012 +0200 Make RefChecks#validateVariance aware of BoundedWildcardType. The only test case that I know for this will be neutered by the imminent fix for SI-6258; so I haven't been able to test this. But trying this manually, you can see that this patch defers the the SI-6258 to the erasure phase. Original: scala.MatchError: ? (of class scala.reflect.internal.Types$BoundedWildcardType) at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer$$anon$3.scala$tools$nsc$typechecker$RefChecks$RefCheckTransformer$$anon$$validateVariance$1(RefChecks.scala:894) at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer$$anon$3.validateVariance(RefChecks.scala:965) Modified: java.lang.ClassCastException: scala.reflect.internal.Types$TypeRef$$anon$6 cannot be cast to scala.reflect.internal.Types$TypeBounds at scala.reflect.internal.Types$TypeMap.mapOver(Types.scala:4160) at scala.reflect.internal.transform.Erasure$ErasureMap.apply(Erasure.scala:156) (cherry picked from commit 2b4e7183fd24113cca5e868456668fd05c848168) commit 6ad651c94faf463133c742feb2aee59ef782ea1f Author: Jason Zaugg <jzaugg@gmail.com> Date: Fri Aug 24 00:54:59 2012 +0200 SI-3577 Make varianceInType aware of BoundedWildcardType. (cherry picked from commit 21105654c40ed0c462142bcbb6c8eced77f8b07a)
* | Merge pull request #1936 from retronym/ticket/6891Adriaan Moors2013-01-282-0/+27
|\ \ | |/ |/| SI-6891 Fix value class + tailrec crasher.
| * SI-6891 Fix value class + tailrec crasher.Jason Zaugg2013-01-262-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rhs.substituteSymbols(old, new) leaves us with: def loop#12225(x#12226: A#15491): scala#21.this.Unit#1615 = loop#12225(x#12226) In which the TermSymbol x#12226 has a stale info, pointing at the A#7274, the class type parameter, rather than A#15491, the corresponding type parameter of the synthetic backing method. I've improved `TreeSymSubstituter` to substitute not only `Tree#{tpe, symbol}`, but also `DefTree#sym.info`. The `pos` test that triggered the new code path are listed here: https://gist.github.com/4575687 AFAICS, no special treatment of Function, Return, or Import is needed in TreeSymSubstutor.
* | Merge pull request #1956 from JamesIry/SI-7011_2.10.xJames Iry2013-01-252-0/+8
|\ \ | | | | | | SI-7011 Fix finding constructor type in captured var definitions
| * | SI-7011 Fix finding constructor type in captured var definitionsJames Iry2013-01-232-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a captured var was initialized with an empty tree then finding the type of the empty tree was being handled improperly. The fix is to look for primary constructors on the tree's type symbol rather than the tree's symbol. A test is included. In order to make the problem more testable the debug logging of the issue is changed to a debug warn.
* | | Merge pull request #1910 from retronym/ticket/6976Paul Phillips2013-01-253-0/+44
|\ \ \ | | | | | | | | SI-6976 Fix value class separate compilation crasher.
| * | | SI-6976 Fix value class separate compilation crasher.Jason Zaugg2013-01-163-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't guarantee that the owner of the value class is initialized, and if it isn't, the search for the companion module will turn up bubkis. This is a localized fix, but I'd be suprised if there weren't other places that suffered from the same problem. Wouldn't it be nicer to have something like: // doesn't force info sym.raw.info sym.raw.companionModule // forces info sym.info sym.companionModule
* | | | Merge pull request #1935 from retronym/ticket/6994Paul Phillips2013-01-242-0/+9
|\ \ \ \ | |_|/ / |/| | | SI-6994 Avoid spurious promiscuous catch warning
| * | | SI-6994 Avoid spurious promiscuous catch warningJason Zaugg2013-01-202-0/+9
| | |/ | |/| | | | | | | | | | It was being issued upon re-typechecking of a transformed tree. Now we disable the warning post-typer.
* / | SI-6942 more efficient unreachability analysisAdriaan Moors2013-01-173-0/+300
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid blowing the stack/the analysis budget by more eagerly translating the propositions that model matches to CNF. First building a large proposition that represents the match, and then converting to CNF tends to blow the stack. Luckily, it's easy to convert to CNF as we go. The optimization relies on `CNF(P1 /\ ... /\ PN) == CNF(P1) ++ CNF(...) ++ CNF(PN)`: Normalizing a conjunction of propositions yields the same formula as concatenating the normalized conjuncts. CNF conversion is expensive for large propositions, so we push it down into the conjunction and then concatenate the resulting arrays of clauses (which is cheap). (CNF converts a free-form proposition into an `Array[Set[Lit]]`, where: - the Array's elements are /\'ed together; - and the Set's elements are \/'ed; - a Lit is a possibly negated variable.) NOTE: - removeVarEq may throw an AnalysisBudget.Exception - also reworked the interface used to build formula, so that we can more easily plug in SAT4J when the time comes
* | Merge pull request #1892 from retronym/ticket/6479Paul Phillips2013-01-151-0/+56
|\ \ | | | | | | SI-6479 Don't lift try exprs in label arguments.
| * | SI-6479 Don't lift try exprs in label arguments.Jason Zaugg2013-01-131-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new pattern matcher uses label jumps to GOTO the next case. Uncurry treated these like regular method arguments, and performed the liftedTree() transformation, which ensures that try expressions are only used in a statement position. Even try in statement position of a block used as such an argument are subject to the same transform. This transform stems from the JVM limitation, that try/catch does not leave a value on the stack. See b194446. This commit changes Uncurry to avoid this transform for arguments to label jumps. This avoids needlessly indirect code, and enables tail call elimination in more cases. As an example, Scala 2.10.0 transforms the last method of the enclosed test case to: try { case <synthetic> val x1: Int = 1; case5(){ if (2.==(x1)) { val x2: Int = x1; matchEnd4({ { def liftedTree2(): Unit = try { throw new scala.runtime.NonLocalReturnControl[Unit](nonLocalReturnKey1, ()) } catch { case (e @ (_: ClassNotFoundException)) => () }; liftedTree2() }; TailrecAfterTryCatch.this.bad() }) } else case6() }; case6(){ matchEnd4(throw new MatchError(x1)) }; matchEnd4(x: Unit){ x } } catch { case (ex @ (_: scala.runtime.NonLocalReturnControl[Unit @unchecked])) => if (ex.key().eq(nonLocalReturnKey1)) ex.value() else throw ex } After this patch: @scala.annotation.tailrec final def bad(): Unit = { case <synthetic> val x1: Int = 1; case5(){ if (2.==(x1)) { <synthetic> val x2: Int = x1; matchEnd4({ try { return () } catch { case (e @ (_: ClassNotFoundException)) => () }; TailrecAfterTryCatch.this.bad() }) } else case6() }; case6(){ matchEnd4(throw new MatchError(x1)) }; matchEnd4(x: Unit){ x } }
* | | Merge pull request #1878 from adriaanm/ticket-6925Adriaan Moors2013-01-142-0/+27
|\ \ \ | | | | | | | | SI-6925 use concrete type in applyOrElse's match's selecto
| * | | rework partial function synthesisAdriaan Moors2013-01-091-0/+18
| | | | | | | | | | | | | | | | | | | | no behavioral changes, just highly overdue cleanup some TODOs for further improvements
| * | | SI-6925 use concrete type in applyOrElse's match's selectorAdriaan Moors2013-01-091-0/+9
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a regression introduced in 28483739c3: PartialFunction synthesis was broken so that we'd get: ``` scala> def f[T](xs: Set[T]) = xs collect { case x => x } f: [T](xs: Set[T])scala.collection.immutable.Set[_ <: T] ``` rather than ``` scala> def f[T](xs: Set[T]) = xs collect { case x => x } f: [T](xs: Set[T])scala.collection.immutable.Set[T] ```
* | | SI-5954 Implementation restriction preventing companions in package objsJames Iry2013-01-135-0/+5
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Companion objects (and thus also case classes) in package objects caused an assert about an overloaded symbol when everything was compiled twice. It's a hairy problem that doesn't fit in 2.10.1. So this fix adds an implementation restriction. It also has a test to make sure the error messages are clean and reasonably friendly, and does not catch other things defined in package objects. The test includes a commented out test in case somebody thinks they've solved the underlying problem. A handful of tests were falling afoul of the new implementation restriction. I verified that they do in fact fail on second compile so they aren't false casualties. But they do test real things we'd like to work once the re-compile issue is fixed. So I added a -X flag to disable the implementation restriction and made all the tests accidentally clobbered by the restriction use that flag.
* | Backport of SI-6846.Jason Zaugg2013-01-081-0/+28
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashed commit of the following: commit 55806cc0e6177820c12a35a18b4f2a12dc07bb39 Author: Paul Phillips <paulp@improving.org> Date: Wed Dec 19 07:32:19 2012 -0800 SI-6846, regression in type constructor inference. In 658ba1b4e6 some inference was gained and some was lost. In this commit we regain what was lost and gain even more. Dealiasing and widening should be fully handled now, as illustrated by the test case. (cherry picked from commit dbebcd509e4013ce02655a2687b27d0967b3650e) commit e6ef58447d0f4ef6de956fcc03ee283bb9028c02 Author: Paul Phillips <paulp@improving.org> Date: Fri Dec 21 15:11:29 2012 -0800 Cleaning up type alias usage. I determined that many if not most of the calls to .normalize have no intent beyond dealiasing the type. In light of this I went call site to call site knocking on doors and asking why exactly they were calling any of .normalize .widen.normalize .normalize.widen and if I didn't like their answers they found themselves introduced to 'dropAliasesAndSingleTypes', the recursive widener and dealiaser which I concluded is necessary after all. Discovered that the object called 'deAlias' actually depends upon calling 'normalize', not 'dealias'. Decided this was sufficient cause to rename it to 'normalizeAliases'. Created dealiasWiden and dealiasWidenChain. Dropped dropAliasesAndSingleTypes in favor of methods on Type alongside dealias and widen (Type#dealiasWiden). These should reduce the number of "hey, the type alias doesn't work" bugs. (cherry picked from commit 3bf51189f979eb0dd41744ca844fd12dfdaa0dee) Conflicts: src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala commit c1d8803cea1523f458730103386d8e14324a9446 Author: Paul Phillips <paulp@improving.org> Date: Sat Dec 22 08:13:48 2012 -0800 Shored up a hidden dealiasing dependency. Like the comment says: // This way typedNew always returns a dealiased type. This // used to happen by accident for instantiations without type // arguments due to ad hoc code in typedTypeConstructor, and // annotations depended on it (to the extent that they worked, // which they did not when given a parameterized type alias // which dealiased to an annotation.) typedTypeConstructor // dealiases nothing now, but it makes sense for a "new" to // always be given a dealiased type. PS: Simply running the test suite is becoming more difficult all the time. Running "ant test" includes time consuming activities of niche interest such as all the osgi tests, but test.suite manages to miss the continuations tests. (cherry picked from commit 422f461578ae0547181afe6d2c0c52ea1071d37b) commit da4748502792b260161baa10939554564c488051 Author: Paul Phillips <paulp@improving.org> Date: Fri Dec 21 12:39:02 2012 -0800 Fix and simplify typedTypeConstructor. Investigating the useful output of devWarning (-Xdev people, it's good for you) led back to this comment: "normalize to get rid of type aliases" You may know that this is not all the normalizing does. Normalizing also turns TypeRefs with unapplied arguments (type constructors) into PolyTypes. That means that when typedParentType would call typedTypeConstructor it would find its parent had morphed into a PolyType. Not that it noticed; it would blithely continue and unwittingly discard the type arguments by way of appliedType (which smoothly logged the incident, thank you appliedType.) The simplification of typedTypeConstructor: There was a whole complicated special treatment of AnyRef here which appears to have become unnecessary. Removed special treatment and lit a candle for regularity. Updated lots of tests regarding newly not-so-special AnyRef. (cherry picked from commit 394cc426c1ff1da53146679b4e2995ece52a133e) commit 1f3c77bacb2fbb3ba9e4ad0a8a733e0f9263b234 Author: Paul Phillips <paulp@improving.org> Date: Fri Dec 21 15:06:10 2012 -0800 Removed dead implementation. Another "attractive nuisance" burning off time until I realized it was commented out. (cherry picked from commit ed40f5cbdf35d09b02898e9c0950b9bd34c1f858)
* 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.
* | 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 #1790 from paulp/2.10.0-wip-mergeAdriaan Moors2012-12-202-0/+6
|\ | | | | Merge 2.10.0-wip into 2.10.x
| * Merge remote-tracking branch 'origin/2.10.0-wip' into 2.10.0-wip-mergePaul Phillips2012-12-192-0/+6
| |\ | | | | | | | | | | | | | | | | | | | | | | | | # By Eugene Burmako (1) and others # Via Adriaan Moors (2) and others * origin/2.10.0-wip: Fixing OSGi distribution. Fix for rangepos crasher. SI-6685 fixes error handling in typedApply
| | * Fix for rangepos crasher.Paul Phillips2012-12-042-0/+6
| | | | | | | | | | | | | | | wrapClassTagUnapply was generating an unpositioned tree which would crash under -Yrangepos. See SI-6338.
* | | Merge pull request #1788 from retronym/ticket/6848Paul Phillips2012-12-202-0/+4
|\ \ \ | |/ / |/| | Implicit vars should have non-implicit setters.
| * | Implicit vars should have non-implicit setters.Jason Zaugg2012-12-192-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise they trigger spurious feature warnings. scala> trait T { implicit var a: Any } <console>:7: warning: implicit conversion method a_= should be enabled by making the implicit value language.implicitConversions visible.
* | | Merge pull request #1759 from scalamacros/topic/annotatedPaul Phillips2012-12-194-0/+59
|\ \ \ | | | | | | | | fixes incorrect handling of Annotated in lazy copier
| * | | fixes incorrect handling of Annotated in lazy copierEugene Burmako2012-12-134-0/+59
| | | |
* | | | Merge pull request #1707 from retronym/ticket/5390Adriaan Moors2012-12-171-0/+11
|\ \ \ \ | |_|/ / |/| | | SI-5390 Detect forward reference of case class apply
| * | | Test showing the absence of a forward referenceJason Zaugg2012-12-161-0/+11
| | | | | | | | | | | | | | | | | | | | These are only forbidden in terms, they are permitted in types.
* | | | Merge pull request #1766 from scalamacros/topic/typed-ident-attachmentsEugene Burmako2012-12-144-0/+22
|\ \ \ \ | | | | | | | | | | typedIdent no longer destroys attachments
| * | | | typedIdent no longer destroys attachmentsEugene Burmako2012-12-134-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | When transforming Idents to qualified Selects, typedIdent used to forget about carrying original attachments to the resulting tree. Not anymore.
* | | | | Recurse into instantiations when stripping type vars.Hubert Plociniczak2012-12-121-0/+25
|/ / / / | | | | | | | | | | | | | | | | | | | | This led to the inference of weird types as list of lub base types was empty. This change fixes case x3 in the test case.
* | | | Merge pull request #1701 from retronym/ticket/5877Adriaan Moors2012-12-102-0/+27
|\ \ \ \ | | | | | | | | | | SI-5877 Support implicit classes in package objects
| * | | | SI-5877 Support implicit classes in package objectsJason Zaugg2012-12-042-0/+27
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This used to crash, as both the package and the package object had the synthetic method in `decls`, and the typer tried to add the tree to both places. Now, synthetics in the package object are excluded from the pacakge itself.
* | | | Merge pull request #1711 from retronym/ticket/1672Adriaan Moors2012-12-101-0/+10
|\ \ \ \ | | | | | | | | | | SI-1672 Catches are in tail position without finally.
| * | | | SI-1672 Catches are in tail position without finally.Jason Zaugg2012-12-051-0/+10
| |/ / / | | | | | | | | | | | | So we can eliminate tail calls within.
* | | | Merge pull request #1692 from retronym/ticket/6547-2Adriaan Moors2012-12-102-0/+7
|\ \ \ \ | | | | | | | | | | SI-6547: elide box unbox pair only when primitives match
| * | | | SI-6547: elide box unbox pair only when primitives matchMiguel Garcia2012-12-022-0/+7
| |/ / /
* | | | Merge pull request #1670 from paulp/issue/6712Adriaan Moors2012-12-101-0/+5
|\ \ \ \ | |_|/ / |/| | | Fix for SI-6712, bug in object lifting.
| * | | Fix for SI-6712, bug in object lifting.Paul Phillips2012-11-251-0/+5
| |/ /
* / / Test cases for SI-5726, SI-5733, SI-6320, SI-6551, SI-6722.Paul Phillips2012-11-293-1/+29
|/ / | | | | | | | | All tickets involving selectDynamic fixed by the prior commit. It also fixes SI-6663, but that already has a test case.
* | Merge remote-tracking branch 'origin/2.10.0-wip' into merge-2.10.wip-xPaul Phillips2012-11-232-0/+52
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # By Jason Zaugg (8) and others # Via Adriaan Moors (6) and Josh Suereth (5) * origin/2.10.0-wip: Removing controversial `either` method from Futures API. SI-6624 set info of case pattern binder to help find case field accessors Fixes SI-6628, Revert "Fix for view isEmpty." SI-6661 - Remove obsolete implicit parameter of scala.concurrent.promise method Fixes SI-6559 - StringContext not using passed in escape function. SI-6648 copyAttrs must preserve TypeTree#wasEmpty Fix raw string interpolator: string parts which were after the first argument were still escaped Update comment. SI-6646 `ident` or Ident is always new binding. SI-6440 Address regressions around MissingRequirementError Refine the message and triggering of MissingRequirementError. SI-6640 Better reporting of deficient classpaths. SI-6644 Account for varargs in extmethod forwarder SI-6646 Fix regression in for desugaring. Update tools/epfl-publish