summaryrefslogtreecommitdiff
path: root/test/files/neg
Commit message (Collapse)AuthorAgeFilesLines
* Add a test case from the comments of SI-6666.Jason Zaugg2013-02-022-0/+21
| | | | | This one lands in the new implementation restriction which beats the VerifyError.
* SI-6666 Restrict hidden `this` access in self/super calls.Jason Zaugg2013-01-202-0/+172
| | | | | | | | | | | | | | | | | Detect when classes (user authored or compiler generated) local to a self or super constructor argument would require premature access to the in-construction instance. The same restriction applies for classes and objects; for objects, the premature access would result in a null via MODULE$ field. A residual error has been lodged as SI-6997. I'd like to remove calls to `Symbol#outerClass` (which relies on the flaky flag INCONSTRUCTOR, see my comments in the JIRA issue for more discussion) from `LambdaLift` and `ExplicitOuter`, and instead use the stack of active self/super calls to know when to skip an enclosing class. That will obviate that flag.
* Merge pull request #1914 from retronym/ticket/6601Grzegorz Kossakowski2013-01-173-0/+8
|\ | | | | SI-6601 Publicise derived value contstructor after pickler
| * SI-6601 Publicise derived value contstructor after picklerJason Zaugg2013-01-163-0/+8
| | | | | | | | | | | | | | Otherwise the access restrictions are not enforced under separate compilation. See also SI-6608.
* | Merge pull request #1854 from pufuwozu/ticket-SI-6923Paul Phillips2013-01-173-2/+21
|\ \ | | | | | | SI-6923 Context now buffers warnings as well as errors
| * | SI-6923 Context now buffers warnings as well as errorsBrian McKenna2013-01-073-2/+21
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Code that was silently typed would not report warnings, even if it returned a successful result. This appeared in the following code which didn't show warnings even with -Ywarn-adapted-args: def foo(a: Any) = a; foo(1, 2) While the following would show the expected warning: def foo[A](a: Any) = a; foo(1, 2)
* | Merge pull request #1895 from JamesIry/SI_6963_2.10.xPaul Phillips2013-01-153-0/+6
|\ \ | | | | | | SI-6963 Deprecates -Xmigration switch
| * | SI-6963 Deprecates -Xmigration switchJames Iry2013-01-143-0/+6
| | | | | | | | | | | | | | | | | | -Xmigration is specific to the 2.7 to 2.8 upgrade and is no longer relevant. There is no plan to maintain it so it will be removed. This commit deprecates it in anticipation.
* | | Merge pull request #1888 from retronym/ticket/6675Paul Phillips2013-01-156-0/+36
|\ \ \ | | | | | | | | SI-6675 -Xlint arity enforcement for extractors
| * | | SI-6675 Test new warning under -Xoldpatmat.Jason Zaugg2013-01-153-0/+18
| | | | | | | | | | | | | | | | This commit should be discarded when merging to master.
| * | | SI-6675 -Xlint arity enforcement for extractorsJason Zaugg2013-01-153-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extractor Patterns changed in 2.10.0 to implement the letter of the spec, which allows a single binding to capture an entire TupleN. But this can hide arity mismatches, especially if the case body uses the bound value as an `Any`. This change warns when this happens under -Xlint.
* | | | Merge pull request #1894 from retronym/ticket/6082Adriaan Moors2013-01-142-0/+15
|\ \ \ \ | | | | | | | | | | SI-6082 Conditionally expand @ann(x) to @ann(value = x)
| * | | | SI-6082 Conditionally expand @ann(x) to @ann(value = x)Jason Zaugg2013-01-132-0/+15
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... if the annotation has an argument with the name `value`. Doing so unconditionally obscures error messages. We still require that arguments to ClassFileAnnotations are named, other than for this special case.
* | | | Merge pull request #1890 from retronym/ticket/5440Adriaan Moors2013-01-143-0/+13
|\ \ \ \ | | | | | | | | | | SI-5440 Test case for exhaustiveness check
| * | | | SI-5440 Test case for exhaustiveness checkJason Zaugg2013-01-133-0/+13
| | |/ / | |/| | | | | | | | | | Reported against patmatclassic, working in virtpatmat.
* | | | Merge pull request #1889 from retronym/ticket/5340Adriaan Moors2013-01-142-0/+35
|\ \ \ \ | | | | | | | | | | SI-5340 Change println to log
| * | | | SI-5340 Change println to logJason Zaugg2013-01-132-0/+35
| |/ / / | | | | | | | | | | | | | | | | | | | | An esoteric implicit search could trigger an "amb prefix ..." message to standard out. Now the message has been improved and sent to the logger.
* | | | Merge pull request #1876 from adriaanm/ticket-5189-infAdriaan Moors2013-01-142-0/+14
|\ \ \ \ | | | | | | | | | | SI-5189 detect unsoundness when inferring type of match
| * | | | SI-5189 detect unsoundness when inferring type of matchAdriaan Moors2013-01-092-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
* | | | SI-5954 Implementation restriction preventing companions in package objsJames Iry2013-01-132-0/+62
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #1859 from retronym/ticket/6912Paul Phillips2013-01-122-0/+13
|\ \ \ | |_|/ |/| | SI-6912 Avoid a typer cycle in overload resolution.
| * | SI-6912 Avoid a typer cycle in overload resolution.Jason Zaugg2013-01-082-0/+13
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c800d1fe, and followup commits 1ddc9358 and b10b5821 modified error handling in `Infer#inferExprAlternative`. After these changes, this method could fail to resolve the overloaded alternative if: best != NoSymbol && !competing.isEmpty && !noAlternatives && pt.isErroneous This commit calls `setError` in that case, which prevents the cycle in `adapt`. While I didn't extract a reproduction from the original code base, I've included a test case that exhibits the same symptom. It was actually pretty tough to find an program that got close to this code path, but luckilly we've been pretty close to this bug in SI-5553 / 4f99c2e5, and those test cases formed the basis for this one.
* | Merge pull request #1869 from retronym/backport/1826Paul Phillips2013-01-1110-16/+16
|\ \ | | | | | | Backport of SI-6846.
| * | Backport of SI-6846.Jason Zaugg2013-01-0810-16/+16
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* / SI-6928, VerifyError with self reference to super.Paul Phillips2013-01-072-0/+17
|/ | | | | | | | | A bug in typers mishandled varargs. We should get more aggressive about eliminating all the ad hoc parameter/argument handling code spread everywhere. For varargs especially: any code which tries to make an adjustment based on a repeated parameter is more likely to be wrong than right. In aggregate these reinventions are a huge source of bugs.
* 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.
* 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 #1778 from JamesIry/p_SI-6795_2.10.xAdriaan Moors2012-12-192-0/+7
|\ | | | | SI-6795 simplify "abstract override" errors on type members
| * SI-6795 Simplify errors related to "abstract override" on type membersJames Iry2012-12-102-2/+2
| | | | | | | | | | | | Instead of saying "only allowed on non-type members of traits" use separate errors for "not allowed on types" and "only allowed on members of traits"
| * SI-6795 Adds negative check for "abstract override" on types in traitsJames Iry2012-12-102-0/+7
| | | | | | | | | | "abstract override" shouldn't was being allowed on types in traits but the result made no sense and the spec says that shouldn't be allowed.
* | Merge pull request #1709 from retronym/ticket/3995Adriaan Moors2012-12-192-0/+38
|\ \ | | | | | | SI-3995 Exclude companions with an existential prefix.
| * | Expand test with a stably qualified example.Jason Zaugg2012-12-052-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the example below, we need a view from `String => l.F0`, and the companion object `FO` is reachable by a stable, non existentially-bound path. class Lift { def apply(f: F0) {} class F0 object F0 { implicit def f2f0(fn: String): F0 = ??? } } object Test { val l = new Lift l.apply("") // okay } Followup for SI-3995
| * | SI-3995 Exclude companions with an existential prefix.Jason Zaugg2012-12-052-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In `(qual: Q).apply(expr)` where `expr` must be implictily converted to a path dependent type `T` defined in `qual`, we were looking for companion implicits via a path prefixed by an existential skolem `_1`. These aren't much good to us, as when we try to feed them into `mkAttributedQualifer`, a crash rightly ensues. This commit excludes companions prefixed by an existentially bound path.
* | | Merge pull request #1707 from retronym/ticket/5390Adriaan Moors2012-12-178-0/+56
|\ \ \ | | | | | | | | SI-5390 Detect forward reference of case class apply
| * | | SI-5390 Detect forward reference of case class applyJason Zaugg2012-12-048-0/+56
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Refchecks performs (among others) two tasks at once: - detecting forward references - translating `qual.Case(...)` to `new qual.Case(...)` As is often the case with such multi-tasking tree traversals, completion of one task precluded the other.
* | | Merge pull request #1706 from retronym/ticket/5361Adriaan Moors2012-12-153-2/+9
|\ \ \ | | | | | | | | SI-5361 Avoid cyclic type with malformed refinement
| * | | SI-5361 Avoid cyclic type with malformed refinementJason Zaugg2012-12-043-2/+9
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The statement `val x = this` in the refinment type: (new {}): {val x = this} is lazily typechecked, in order to, according to the comment in `typedRefinment, "avoid cyclic reference errors". But the approximate type used ends up with: Refinment@1( parents = [...] decls = { val x: Refinement@1 }) This commit eagerly checks that there is no term definitions in type refinments, rather than delaying this. This changes the error message for SI-3614.
* | | Merge pull request #1742 from scalamacros/ticket/4044Paul Phillips2012-12-121-6/+1
|\ \ \ | | | | | | | | prevents spurious kind bound errors
| * | | prevents spurious kind bound errorsEugene Burmako2012-12-101-6/+1
| | | | | | | | | | | | | | | | | | | | The patch adds a check which makes sure that the trees we're about to report aren't already erroneous.
* | | | Merge pull request #1747 from hubertp/2.10.x-issue/6758Adriaan Moors2012-12-125-22/+84
|\ \ \ \ | | | | | | | | | | Fixes SI-6758: force LazyAnnnotationInfo for DefDef and TypeDef
| * | | | Fixes SI-6758: force LazyAnnnotationInfo for DefDef and TypeDefHubert Plociniczak2012-12-115-22/+84
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | Looks like the change in 25ecde037f22ff no longer forced lazy annotations for some of the cases. Also removed forcing for PackageDef annotations as we currently don't support them.
* | | | Merge pull request #1737 from retronym/ticket/6555Adriaan Moors2012-12-111-2/+2
|\ \ \ \ | |/ / / |/| | | SI-6555 Better parameter name retention
| * | | SI-6555 Better parameter name retentionJason Zaugg2012-12-081-2/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were losing track of parameter names in two places: 1. Uncurry was using fresh names for the apply method parameters during Function expansion. (The parameter names in the tree were actually correct, they just had synthetic symbols with "x$1" etc.) 2. When adding specialized overrides, the parameter names of the overriden method were used, rather than the parameter names from the overriding method in the class to which we are adding methods. The upshot of this is that when you're stopped in the debugger in the body of, say, `(i: Int) => i * i`, you see `v1` rather than `i`. This commit changes Uncurry and SpecializeTypes to remedy this.
* | | Merge pull request #1691 from retronym/ticket/6558Adriaan Moors2012-12-104-0/+59
|\ \ \ | | | | | | | | SI-6558: typecheck lazy annotation info using non-silent context
| * | | Split test case to workaround incomplete error report.Jason Zaugg2012-12-034-3/+28
| | | | | | | | | | | | | | | | | | | | Reporting some errors prevents reporting others. This residual issue had been lodged as SI-6758.
| * | | SI-6558 Expand test case for annotation typosJason Zaugg2012-12-022-5/+26
| | | |
| * | | Fixes SI-6558: typecheck lazy annotation info using non-silent context.Hubert Plociniczak2012-12-022-0/+13
| | | | | | | | | | | | | | | | Make context for typing lazy annotations always non-silent. If lazy annotation info was created in local (silent) context, error could go unnoticed because later they would still use silent typer for typing the annotation.
* | | | Merge pull request #1711 from retronym/ticket/1672Adriaan Moors2012-12-102-0/+68
|\ \ \ \ | | | | | | | | | | SI-1672 Catches are in tail position without finally.
| * | | | Addtional test cases for tail calls in catches.Jason Zaugg2012-12-052-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Includes a run test to check bytecode verifies and behaves - Show this isn't possible when try is used as an expression, and a `liftedTree` local method is needed.
| * | | | SI-1672 Catches are in tail position without finally.Jason Zaugg2012-12-052-0/+54
| | |_|/ | |/| | | | | | | | | | So we can eliminate tail calls within.