summaryrefslogtreecommitdiff
path: root/test/files/neg
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #626 from retronym/ticket/4818Adriaan Moors2012-05-262-0/+13
|\ | | | | Test case closes SI-4818
| * Test case closes SI-4818Jason Zaugg2012-05-252-0/+13
| | | | | | | | Fixed between 2.10.0 M2 and M3, with both the old and new pattern matcher.
* | Merge pull request #625 from retronym/ticket/5318-3Adriaan Moors2012-05-256-0/+45
|\ \ | | | | | | SI-5318 Make implicit divergence checking PolyType aware.
| * | SI-5318 Make implicit divergence checking PolyType aware.Jason Zaugg2012-05-256-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaces the two active subclasses of `SymCollector` with direct use of traversal methods of `Type`. Wildcard free class type parameters, not just method type parameters, when stripping the core type of candidate implicits. The spec doesn't make any such distinction, and the enclosed test, t5318c, crashes without this change.
* | | Merge pull request #613 from hubertp/issue/5821Adriaan Moors2012-05-253-1/+16
|\ \ \ | | | | | | | | Closes SI-5821.
| * | | Closes SI-5821.Hubert Plociniczak2012-05-243-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was an interesting one. Basically an erroneous import was creating an erroneous symbol for Array (similary for other symbols that were 'found' in this import) which was leading to all sorts of inconsistencies and spurious errors. This wasn't a bug in ContextErrors but rather something that existed for ages and was hidden from the general audience. Review by @paulp.
* | | | don't error when not emitting required switchAdriaan Moors2012-05-251-0/+1
| |_|/ |/| | | | | | | | | | | we don't handle switches with guards, whereas the old patmat did to ease the transition, let's not error out and see how we can resolve this
* | | Pending and passing tests.Paul Phillips2012-05-232-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | Move now-passing SI-963 test into neg. Test for partial specialization. Pending test for SI-5008. Pending test for SI-4649. Abstract array type test.
* | | more tests for SI-3761Lukas Rytz2012-05-232-0/+26
| | |
* | | Merge pull request #601 from adriaanm/3f7b8b58748eb70aec4269f1ef63853b5ad4af60Adriaan Moors2012-05-2317-83/+75
|\ \ \ | | | | | | | | virtpatmat: treemaker approximation refactorings and exhaustivity
| * | | Exhaustivity: TreeMakers as boolean propositionsAdriaan Moors2012-05-2217-83/+75
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We check exhaustivity by representing a match as a formula in finite-domain propositional logic (FDPL) that is false when the match may fail. The variables in the formula represent tested trees in the match (type tests/value equality tests). The approximation uses the same framework as the CSE analysis. A matrix of tree makers is turned into a DAG, where sharing represents the same value/type being tested. We reduce FDPL to Boolean PL as follows. For all assignments, V_i = c_i_j, we introduce a proposition P_i_j that is true iff V_i is equal to the constant c_i_j, for a given i, and all j, P_i_j are mutually exclusive (a variable cannot have multiple values). If the variable's domain is closed, we assert that one of P_i_j must be true for each i and some j. The conjunction of these propositions constitutes the equality axioms. After going through negational normal form to conjunctive normal form, we use a small SAT solver (the DPLL algorithm) to find a model under which the equational axioms hold but the match fails. The formula: EqAxioms /\ -MatchSucceeds. Note that match failure expresses nicely in CNF: the negation of each case (which yields a disjunction) is anded. We then turn this model into variable assignments (what's the variable (not) equal to, along with recursive assignments for its fields). Valid assignments (no ill-typed field assignments) are then presented to the user as counter examples. A counter example is a value, a type test, a constructor call or a wildcard. We prune the example set and only report the most general examples. (Finally, we sort the output to yield stable, i.e. testable, warning messages.) A match is only checked for exhaustivity when the type of the selector is "checkable" (has a sealed type or is a tuple with at least one component of sealed type). We consider statically known guard outcomes, but generally back off (don't check exhaustivity) when a match has guards or user-defined extractor calls. (Sometimes constant folding lets us statically decide a guard.) We ignore possibly failing null checks (which are performed before calling extractors, for example), though this could be done easily in the current framework. The problem is false positives. People don't usually put nulls in tuples or lists. To improve the exhaustivity checks, we rewrite `List()` to Nil. TODO: more general rewrite of List(a, b, ..., z) to `a :: b :: ... :: z`. When presenting counter examples, we represent lists in the user-friendly List(a,...,z) format. (Similarly for tuples.) There are no exhaustivity checks for a match-defined PartialFunction. misc notes: - fix pure case of dpll solver impure set (symbol that occurs both as a positive and negative literal) was always empty since I was looking for literals (which are not equal if positivity is not equal) but should have been looking for symbols - FDPL -> BoolPL translation collects all syms in props since propForEqualsTo generates an Or, must traverse the prop rather than assuming only top-level Syms are relevant... also, propForEqualsTo will not assume Or'ing a whole domain is equivalent to True (which it isn't, since the type test may fail in general) - improve counter example description - treat as constructor call when we either have definite type information about a real class, or we have no equality information at all, but the variable's type is a class and we gathered constraints about its fields (typically when selector is a tuple) - flatten a :: b :: ... :: Nil to List(a, b, ...) - don't print tuple constructor names, so instead of "Tuple2(a, b)", say "(a, b)" - filter out more statically impossible subtypes the static types convey more information than is actually checkable at run time this is good, as it allows us to narrow down the subtypes of a sealed type, however, when modeling the corresponding run-time checks we need to "erase" the uncheckable parts (using existentials so that the types are still well-kinded), so that we can use static subtyping as a sound model for dynamic type checks - experimental java enum handling seals enum class before, we created a refinement class as the placeholder for the sealed children it seems more direct to use the enum class for that this way, the new pattern matcher's exhaustiveness checker just works for java enums
* | | Merge pull request #602 from hubertp/issue/5735Adriaan Moors2012-05-222-0/+13
|\ \ \ | | | | | | | | Closes SI-5735. Review by @adriaanm.
| * | | Closes SI-5735, this could also potentially fix a SO problem that @adriaanm ↵Hubert Plociniczak2012-05-212-0/+13
| | | | | | | | | | | | | | | | was experiencing in IDE but could not reproduce it.
* | | | Merge pull request #588 from retronym/ticket/5305Adriaan Moors2012-05-222-0/+7
|\ \ \ \ | | | | | | | | | | Don't hop to the first enclosing, non-silent context typing refinements
| * | | | Don't hop to the first enclosing, non-silent context when typing refinements.Jason Zaugg2012-05-062-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes SI-5305. This reverts a few lines of e5cfe47a19, which was a remedy for SI-3614 and SI-3856*. I added a test case for the former, the latter was already tested. Both tests pass after this change, and they do so with the old and new pattern matcher. But does this change still "avoid trees with null types in presentation compiler"? What was the intent of the context hopping in the first place? * Based on this comment: https://issues.scala-lang.org/browse/SI-3614?focusedCommentId=50477&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-50477, which elaborates further than the commit comment of e5cfe47a19.
* | | | | SI-2405 Confer implicit privileges to renamed imports.Jason Zaugg2012-05-222-0/+18
| |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Yin and yang would be pleased: A fix in two parts. 1. Use the name of the imported symbol, rather than the alias, in the generated `Select(qual, name)` tree. 2. Do the opposite in `isQualifyingImplicit`, which performs one part of the shadowing check. But there is still work to do. The second part of the shadowing check, `nonImplicitSynonymInScope`, fails to notice this case (irrespective of aliased imports). // Expecting shadowing #2. Alas, none is cast! object Test1 { object A { implicit val x: Int = 1 } import A.x def x: Int = 0 implicitly[Int] } I'm hitching the residual problem to SI-4270's wagon.
* | | | SI-5760: Improve error message for package$Klass conflict with KlassSom Snytt2012-05-203-0/+26
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a clarification to DoubleDefError for when the previous symbol was in the package object but current symbol is not. This was actually supposed to be an opportunity to hack partest to run the two-step failing compilation, but somebody beat me to it and my rebase failed. The next hacking opportunity might be to add .pt script files! The possibilities are endless.
* | | Merge pull request #578 from lrytz/wip/t5044-squashedAdriaan Moors2012-05-193-1/+23
|\ \ \ | | | | | | | | fix SI-5044: better error message on cyclic error and named/default args
| * | | better feedback for SI-5044Lukas Rytz2012-05-183-1/+23
| | | |
* | | | Merge pull request #577 from lrytz/wip/t2488Adriaan Moors2012-05-192-0/+43
|\ \ \ \ | | | | | | | | | | Fix SI-2488: allow named arg, in original position, before positionals
| * | | | Fix SI-2488Lukas Rytz2012-05-182-0/+43
| | |_|/ | |/| |
* | | | Merge pull request #568 from hubertp/issue/5801Adriaan Moors2012-05-192-0/+38
|\ \ \ \ | | | | | | | | | | Fix SI-5801: error messages regression.
| * | | | Fixes SI-5801, error messages regression. Review by @adriaanmHubert Plociniczak2012-05-182-0/+38
| | | | |
* | | | | Fix SI-5544Lukas Rytz2012-05-183-0/+15
| |/ / / |/| | | | | | | | | | | Type-check annotations in a context with a localDummy owner
* | | | Merge pull request #566 from lrytz/wip/t4928Adriaan Moors2012-05-183-6/+15
|\ \ \ \ | | | | | | | | | | Fix SI-4928
| * | | | Fix SI-4928Lukas Rytz2012-05-163-6/+15
| | |/ / | |/| | | | | | | | | | better error message when a parameter is first defined positionally, then with a named argument.
* / | | A band-aid solution for SI-5803.Jason Zaugg2012-05-172-0/+8
|/ / / | | | | | | | | | | | | | | | | | | | | | Since ae5ff662, resetAttrs duplicates trees, which doesn't preserve ApplyConstructor. My attempt to modify TreeCopier to do so proved trickier than expected. In any case, ApplyConstructor is not long for this world, and is only used in tree printing to distinguish `new X` from regular Apply trees, so this should suffice pending full surgery.
* | | Debugging output tweaks.Paul Phillips2012-05-141-1/+1
| | | | | | | | | | | | And undeprecated Positional.
* | | Forbid forward refs from self constructor invocations.Jason Zaugg2012-05-112-0/+35
| | | | | | | | | | | | | | | | | | | | | Prevents the wheels falling off during later compiler phases, or, worse, during bytecode verification. Closes SI-4098.
* | | Fixes SI-5564.Aleksandar Prokopec2012-05-082-0/+13
|/ / | | | | | | Catching typer errors in specialization.
| |
| \
*-. \ Merge commit 'refs/pull/486/head'; commit 'refs/pull/487/head'; commit ↵Paul Phillips2012-05-071-4/+4
|\ \ \ | | |/ | |/| | | | 'refs/pull/488/head'; commit 'refs/pull/489/head'; commit 'refs/pull/490/head' into develop
| | * minor tag-related fixesEugene Burmako2012-05-071-4/+4
| |/
| |
| \
| \
| \
*---. \ Merge commit 'refs/pull/479/head'; commit 'refs/pull/480/head'; commit ↵Paul Phillips2012-05-062-0/+17
|\ \ \ \ | | | |/ | | |/| | | | | 'refs/pull/481/head'; commit 'refs/pull/482/head'; commit 'refs/pull/483/head'; commit 'refs/pull/484/head'; commit 'refs/pull/485/head' into develop
| * / | Test case closes SI-4568.Jason Zaugg2012-05-062-0/+17
| |/ / | | | | | | | | | What's the opposite of regression? Progression!
* / / Test that primitive arrays aren't accepted as a Java generic array.Jason Zaugg2012-05-066-0/+52
|/ / | | | | | | | | | | | | | | They exercise both joint and separate compilation. This resolves SI-750 (which was somewhat unfairly merged with another ticket). The error message itself could do with refinement: in particular instance of the much beloved: found X, required X.
* | A couple checkfile updates which snuck by.Paul Phillips2012-05-041-1/+3
| |
* | Updated Symbol to record classfile origin.Paul Phillips2012-05-0415-17/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change should be transparent to anything using sourceFile, unless it was drinking from the inheritance well too deeply. Rather than squander the already allocated field for every ClassSymbol not being compiled from source, I'm now populating it with the file representing the class. This will make a broad range of things easier, like debugging, issuing useful error messages, symbol invalidation, signature verification, you name it. def sourceFile - still returns only source code files def binaryFile - returns only class files def associatedFile - returns whatever is there, if anything Performance: I may be mistaken, but I believe this is a zero-impact change. No new fields are allocated; fields which were null now hold a useful reference. The reference is to a file instance which was already being allocated and already long-lived. Compare error messages: // Version 1 % scalac a.scala error: type _$1 is defined twice // Version 2 % scalac a.scala error: type _$1 is defined twice conflicting symbols both originated in file './foo/package.class' Note: this may be due to a bug in the compiler involving wildcards in package objects one error found Bonus for people who read commit logs. Try this in the repl after starting power mode. ListClass.info.members groupBy (_.associatedFile) foreach { case (k, vs) => println("%s\n %s\n".format(k, vs map (_.defString) mkString "\n ")) }
* | Fix for one of the oldest open soundness bugs.Paul Phillips2012-05-043-4/+34
|/ | | | | | | | | | | | | | | | | | | Closes SI-963, since it was one of my random 30 it won the prize. The trick after adding the stability check (which has been sitting there commented out for 3+ years) was that implicit search depended on the wrongness, because memberWildcardType would create scopes with members of the form ?{ val name: tp } And since a def shouldn't match that, fixing it broke everything until I flipped it around: memberWildcardType should be seeking ?{ def name: tp } It could also search for a mutable value: the relevant quality is that it not be stable so it doesn't have a tighter type than the members it hopes to match.
* Test case for SI-5106.Paul Phillips2012-05-032-0/+16
|
* Moved passing tests from pending to files.Paul Phillips2012-05-032-0/+15
| | | | | | | | Most are pattern matcher bugs fixed by virtpatmat. A few are reifier, package object, or miscellaneous. I threw in an original test for SI-2337, to go with those for SI-1697, SI-3705, SI-4415, and SI-1357, all of which (in the interests of making sure this basket has all the eggs) I am closing.
* Hardening implicit classes.Paul Phillips2012-05-032-0/+11
| | | | Closes SI-5728.
* Moved a warning behind -Xlint.Paul Phillips2012-05-031-1/+1
| | | | | | Eventually "-Xlint would have told you not to do that" will be a catchphrase, like "I love it when a plan comes together" or "respect mah authoritah."
* SI-5703: normalize refined types moreAdriaan Moors2012-05-031-1/+1
| | | | | | | | | to improve Array[T] java-interop with T[], normalize Object with Object{} to Object fix #SI-5688 by flattening refined types in parents updated check files to reflect flattening of refined types and updated position for refined types
* moving patmat to its own phaseAdriaan Moors2012-05-028-39/+9
| | | | | | | | | | | | | | | | | | | | sort field accessors, necessary after typers -- apparently... don't throw TypeError, use issueTypeError don't run patmat phase when -Xoldpatmat only virtualize matches when -Xexperimental recycle cps type of match for re-typechecking: when one of the internal cps-type-state annotations is present, strip all CPS annotations a cps-type-state-annotated type makes no sense as an expected type (matchX.tpe is used as pt in translateMatch) don't synth FunctionN impls during typer, only do this for PartialFunction updated check now function synth for match is deferred until uncurry patmat-transform try/catch with match in cps cleanup in selective anf remove TODO: can there be cases that are not CaseDefs -- nope
* Hackaround for people who like to instantiate the uninstantiable.Paul Phillips2012-05-011-1/+28
| | | | | | Closes SI-5666 again. (I don't have the least clue how I'm supposed to issue the error.)
* Fixes #SI-5578.Paul Phillips2012-05-012-0/+43
| | | | | | | | ResetAttrs shouldn't be side-effecting on the original tree, since it can lead to NPEs in erroneous trees (or maybe even for valid ones?). Review by @odersky (Patch by plocinic, applied without his complicity by extempore)
* Optimization of Predef implicits.Paul Phillips2012-04-301-2/+2
| | | | | | | All those wildcards in a default-scoped implicit are expensive, they each lead to a typevar on every search. Restructured the Tuple2/Tuple3 Zipped classes, they're better this way anyway. This also gets all that Tuple[23] code out of genprod.
* Removed a few more @deprecated members.Paul Phillips2012-04-284-9/+9
| | | | | The ones which remain I'm not removing on purpose, as I know from experience it's more trouble than it's yet worth.
* Revert "Moved ancillary methods off specialized traits."Paul Phillips2012-04-272-7/+7
| | | | | | This reverts commit 1d0372f84f9a7325a47beb55169cc454895ef74b. I forgot about polymorphic dispatch. Have to seek another way.
* Merge commit 'refs/pull/443/head'; commit 'refs/pull/444/head' into developPaul Phillips2012-04-2614-19/+179
|\