summaryrefslogtreecommitdiff
path: root/test/files/neg
Commit message (Collapse)AuthorAgeFilesLines
* Better error message than 'bad symbolic reference'.Adriaan Moors2014-07-221-4/+5
| | | | | | Let's not scare people, and try to give them some advice. PS: we should really come up with a better mechanism for testing errors/warnings
* SI-8736 Restore -language to former glorySom Snytt2014-07-203-0/+19
| | | | | | | | | | | | | | | | | | | | | | MultiChoice allows -language to work like -Xlint. The bug as described was that the setting value was set instead of updated (++=) with additional flags. The unreported bug was that `_` no longer set all settings. The corrected behavior is that "contains" means "it was enabled, or _ was set and it was not disabled explicitly." That is the behavior of `-Xlint` but with a different mechanism, since each lint option is a Setting. A semantic difference is that -Xlint enables all the lint options, but -language does not enable all the language features. `scalac -X` does not explain this additional behavior of the `-Xlint` flag. Also worth noting that `scalac -feature -language unused.scala` failed in 2.11.1 but succeeds silently now.
* SI-8525 Clarify usage of -Xlint:_,flagSom Snytt2014-07-162-14/+2
| | | | | | | | | | | | | | | | | | | | | Also clarify usage of -Xlint flag. Align more with javac -Xlint:all,-flag,flag where once a flag is explicitly enabled it cannot be disabled, but where the wildcard is a backstop only. (There is no all option yet here.) -Xlint and -Xlint:_ just set a flag which is consulted by any unset lint warning. Xlint warnings consult the state of Xlint when they are unset. Individual -Ywarn-ings do not. Other warnings are explicitly set to false. They can only be enabled programmatically. Some tests are corrected. Also, option order is no longer significant, see the unit test.
* Merge pull request #3792 from som-snytt/issue/8525Lukas Rytz2014-07-1613-13/+97
|\ | | | | SI-8525 -Xlint:nowarn-missing-interpolator
| * SI-8525 No anonymous lintSom Snytt2014-07-105-5/+20
| | | | | | | | | | | | | | | | | | Turn anonymous references to `settings.lint` into named settings. After that, trust to Adriaan to make them filterable. There are a few remaining top-level -Y lint warnings that are deprecated.
| * SI-8525 Add -Xlint:-warn-missing-interpolatorSom Snytt2014-07-089-20/+49
| | | | | | | | | | | | | | | | | | | | Turn off lint warnings with negating prefix, and add a lint-only warning for the infamously nagging "Did you forget the interpolator?" That message is made more dignified. Without `-Xlint:false`, there is no mechanism to turn off anonymous linters once `-Xlint` is selected.
| * SI-8610 -Xlint is multichoice optionSom Snytt2014-07-086-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make -Xlint a "multichoice" option for purposes of option parsing. This allows turning on "lint with these warnings" instead of only "turn off these warnings but enable other lint warnings". ``` $ scalac -Xlint:warn-adapted-args linty.scala # lint plus a warning $ scalac -Xlint warn-adapted-args linty.scala # same $ scalac -Xlint linty.scala # same as now $ scalac -Xlint -- linty.scala # ok, not necessary $ scalac -Xlint _ -- linty.scala # another funky underscore ``` This would also enable Xlint options that are not standalone options, although that is not implemented in this commit. For example, `-Xlint:no-missing-interpolator` could be used to disable that warning. (There is no `-Xoption:flavor=off` syntax.) (`no-` switches would not be enabled by `_`.)
* | Fix -Yno-adapted-args, it would just warn, not errLukas Rytz2014-07-153-0/+28
| |
* | Merge pull request #3867 from lrytz/t8708Lukas Rytz2014-07-094-0/+19
|\ \ | |/ |/| SI-8708 Fix pickling of LOCAL_CHILD child of sealed classes
| * SI-8708 Fix pickling of LOCAL_CHILD child of sealed classesLukas Rytz2014-07-074-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | When a sealed class or trait has local children, they are not pickled in as part of the children of the symbol (introduced in 12a2b3b to fix Aladdin bug 1055). Instead the compiler adds a single child class named LOCAL_CHILD. The parents of its ClassInfoType were wrong: the first parent should be a class. For sealed traits, we were using the trait itself. Also, the LOCAL_CHILD dummy class was entered as a member of its enclosing class, which is wrong: it represents a local (non-member) class, and it's a synthetic dummy anyway.
* | Use countElementsAsString for summarized warnings.Adriaan Moors2014-07-042-2/+2
| |
* | Move reporting logic into Reporting traitAdriaan Moors2014-07-046-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move code from Global/SymbolTable to separate Reporting traits to start carving out an interface in scala.reflect.internal.Reporting, with internals in scala.tools.nsc. Reporting is mixed into the cake. It contains a nested class PerRunReporting. Should do the same for debugging/logging. The idea is that CompilationUnit and Global forward all reporting to Reporter. The Reporting trait contains these forwarders, and PerRunReporting, which accumulates warning state during a run. In the process, I slightly changed the behavior of `globalError` in reflect.internal.SymbolTable: it used to abort, weirdly. I assume that was dummy behavior to avoid introducing an abstract method. It's immediately overridden in Global, and I couldn't find any other subclasses, so I don't think the behavior in SymbolTable was ever observed. Provide necessary hooks for scala.reflect.macros.Parsers#parse. See scala/reflect/macros/contexts/Parsers.scala's parse method, which overrides the reporter to detect when parsing goes wrong. This should be refactored, but that goes beyond the scope of this PR. Don't pop empty macro context stack. (Ran into this while reworking -Xfatal-warnings logic.) Fix -Xfatal-warnings behavior (and check files): it wasn't meant to influence warning reporting, except for emitting one final error; if necessary to fail the compile (when warnings but no errors were reported). Warnings should stay warnings. This was refactored in fbbbb22946, but we soon seem to have relapsed. An hour of gitfu did not lead to where it went wrong. Must've been a merge.
* | Unclutter Reporter. Move truncation to ReplReporter.Adriaan Moors2014-07-044-4/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor to reduce the Reporter interface. Working towards minimal interfaces in scala.reflect.internal that can be consumed by sbt/IDE/.... The scala.tools.nsc package is entirely private to the compiler (in principle). A `Reporter` should only be used to inform (info/warning/error). No state. Ideally, we'd move to having only one reporter, whose lifetime is adjusted appropriately (from per-run in general to per-context for type checking, so errors can be buffered -- "silenced" -- during nested type checking calls). Start the clean up by moving truncation to the REPL, since it's not relevant for regular reporting. Perversely, we were checking truncation all the time, even though it's only on during a repl run. (Truncation is now always turned off in the repl under -verbose.) Untangle error resetting on symbols from error reporting (reportAdditionalErrors). This fixes a nice&subtle bug that caused feature warnings to be suppressed under `-Xfatal-warnings`: ``` def reportCompileErrors() { if (!reporter.hasErrors && reporter.hasWarnings && settings.fatalWarnings) globalError("No warnings can be incurred under -Xfatal-warnings.") if (reporter.hasErrors) { ... } else { // will erroneously not get here if // `reporter.hasWarnings && settings.fatalWarnings` // since the `globalError` call above means `reporter.hasErrors`... allConditionalWarnings foreach (_.summarize()) ... } } ``` The second `if`'s condition depends on the `globalError` call in the first `if`...
* Merge pull request #3828 from retronym/ticket/8675Adriaan Moors2014-07-034-0/+63
|\ | | | | SI-8675 Avoid unreported error after second try using implicit view
| * SI-8675 Add another test case for swallowed type errorsJason Zaugg2014-06-262-0/+28
| | | | | | | | | | | | | | | | As reported on scala-internals. After tightening up the treatment of undetermined type parameters in SI-7944, the enclosed test case no longer typechecks. And since the regression fixed in the previous commit, the error was swallowed by the typechecker only to be burped up by a crash in the backend.
| * SI-8675 Avoid unreported error after second try using implicit viewJason Zaugg2014-06-252-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is specific to situations in which we first typecheck an application `qual.m(arg)` against the method `m` directly provided by `qual`, and then fall back to `implicitView(qual).m(arg)`. Regressed in SI-3971 / 7fa77af, in which error reports were moved to the innermost `Apply`, and the check for `errorInResult` was accordingly changed to recurse through `Apply` trees. Before that change, we did not fall back to using a view. After the change, we do try a view. We retypecheck the arguments under the `retyping` mode (see `tryTypedArgs`), but this doesn't seem to be enough to avoid leaking the error typed nested trees from the first try. Here's an example from the enclosed test case: a.update(0, x[A]({new isString(true)})) `-- error typed refArrayOps(a).update(0, x[A]({new isString(true)})) ` `-- error type persists `-- this tree is retypecked by tryTypedArgs This commit changes `onError` to only proceed with the second try if the retyped argument trees are error free.
* | Merge pull request #3832 from jrudolph/w/fix-tailrecJason Zaugg2014-06-272-0/+51
|\ \ | | | | | | SI-8657 don't miss tailrec defs in more positions
| * | SI-8657 don't miss tailrec defs in more positionsJohannes Rudolph2014-06-252-0/+51
| |/ | | | | | | | | | | | | 1) First operand of boolean expression using `&&` or `||`. Second operands of those boolean exprs were already treated specially here but handling for first operands was missing. 2) Condition of `If`. Also added a test for guards.
* | Merge pull request #3749 from huitseeker/issue/DeprecWarningJason Zaugg2014-06-271-1/+1
|\ \ | |/ |/| SI-8185 Correct grammar for single-warning compilation run
| * SI-8185 Correct grammar for single-warning compilation runFrançois Garillot2014-05-141-1/+1
| |
* | SI-8631 Treat `A with Sealed` as enumerable for pattern matchingJason Zaugg2014-06-103-0/+45
| | | | | | | | | | | | | | | | Enumerate the subtypes of sealed parent types of refinement types, and filter those that conform to the refinement type. Such types can crop up easily when LUB-bing case classes which add `Product with Serializable` to the mix.
* | Support Java 8 in the checkfile for neg/t6289Jason Zaugg2014-06-041-1/+1
| |
* | SI-8630 lineToString no longer long by one at eofSom Snytt2014-05-272-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One more EOL crasher, or lack-of-EOL crasher, when the text is at EOF. It was not caught by the last round of excellent and thorough tests because ``` // If non-whitespace tokens run all the way up to EOF, // positions go wrong because the correct end of the last // token cannot be used as an index into the char array. // The least painful way to address this was to add a // newline to the array. ```
* | Eliminate some N^2 performance in type checkingJason Zaugg2014-05-265-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Where N is the number of members of the enclosing package. Double definition errors for top level classes/objects are issued elsewhere, as demonstrated by the enclosed test. So we can omit the call to `checkNoDoubleDefs` in this content. We can't omit the call to `addSynthetics` for package class owners (case- and value-class synthetic companions are added here), but we can make the process cheaper by moving the expensive-but-usually-true call to `shouldAdd`. Here's an example of the improvement. % rm -rf /tmp/pkg; (for i in {1..50}; do for j in {1..100}; do echo "package pkg { class A_${i}_${j}___(val a: Int, val b: Int) }"; done; done) > sandbox/A1.scala && time scalac-hash v2.11.0 -Ybackend:GenASM -J-Xmx1G -J-XX:MaxPermSize=400M -d /tmp sandbox/A1.scala; real 0m49.762s user 1m12.376s sys 0m2.371s % rm -rf /tmp/pkg; (for i in {1..50}; do for j in {1..100}; do echo "package pkg { class A_${i}_${j}___(val a: Int, val b: Int) }"; done; done) > sandbox/A1.scala && time qbin/scalac -Ybackend:GenASM -J-Xmx1G -J-XX:MaxPermSize=400M -d /tmp sandbox/A1.scala; real 0m35.662s user 0m58.275s sys 0m2.355s We've still got another source of pathological performance in creating nested scopes that I'll fix in the next commit.
* | SI-8574 Copy @SerialVersionUID, etc, to specialized subclassesJason Zaugg2014-05-161-7/+1
|/ | | | | | | | | | | | The test case demonstrates that this is important for serialization and for strictfp. (Although the latter is still pretty broken, see SI-7954.) Now that the synthetic subclass of `Tuple2[Int, Int]` also has the `@deprecatedInheritance` annotation, I had to change the spot that issues this warning to be silent after the typer phase. Otherwise, we get two warnings in `run/t3888.scala`. This also remedies double warnings that were incurred in `neg/t6162-inheritance`.
* Merge pull request #3719 from retronym/ticket/8546Jason Zaugg2014-05-092-3/+1
|\ | | | | SI-8546 Pattern matcher analysis foiled by over-widening
| * SI-8546 Pattern matcher analysis foiled by over-wideningJason Zaugg2014-05-072-3/+1
| | | | | | | | | | | | | | | | | | In the enclosed test, the prefix checkable type `ModuleTypeRef(F2.this, C)` was being inadvertently widened to `ModuleTypeRef(F2[?], C)`. This started after some misguided future-proofing in SI-6771 / 3009916. This commit changes the `dealiasWiden` to a `delias`.
* | Merge pull request #3711 from retronym/ticket/8549-2Jason Zaugg2014-05-082-0/+17
|\ \ | | | | | | SI-8549 Serialization: fix regression with @SerialVersionUID / start enforcing backwards compatibility
| * | SI-6988 Test case for non-literal / non-constant SerialVersionUIDJason Zaugg2014-05-052-0/+17
| |/ | | | | | | | | | | | | The `neg` test was already working since `SerialVersionUID` was changed to a `ClassFileAnnotation`; the `run` test only started working since the recently preceding commit that made a compensatory test in the backend.
* / SI-8325 Accept infix star type outside patternsSom Snytt2014-05-056-0/+51
|/ | | | | | | | | | | | | | | This is a follow-up to SI-5702 which enabled use of `*` in infix notation in patterns. Most of the work is in distinguishing infix from a sequence pattern. Also, do not take backticked star as the repeated parameter marker in postfix position. That is, `Int``*``` is not `Int*` -- I hope double-tick renders as tick. There is not a special use case except that backticks mean "I am an identifier, as is, and not a keyword."
* Merge pull request #3670 from retronym/ticket/8463Jason Zaugg2014-04-212-0/+48
|\ | | | | SI-8463 Avoid unpositioned errors from search for views
| * SI-8463 Avoid unpositioned errors from search for viewsJason Zaugg2014-04-022-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ideally, I'd like to fix this using `saveErrors = false` here to firewall the enclosing context from the ambiguiouty error encountered during implicit search. I originally proposed that patch as a fix for SI-8419 in https://github.com/scala/scala/pull/3460 but withdrew from that approach as I uncovered a deeper bug that meant that we actually shouldn't have even been looking for views in that case. But, this runs into SI-8230 and these failures: test/partest --update-check \ /Users/jason/code/scala/test/files/pos/t2504.scala \ /Users/jason/code/scala/test/files/pos/t4457_1.scala \ /Users/jason/code/scala/test/files/neg/t4457_2.scala Turns out that typechecking the ostensible straight forward application, `Array("abc")`, hinges on us leaking an ambiguity error from `viewExists` to find a path through overload resolution! This commit takes a tiny step forward by using `context.tree` rather than `EmptyTree` as the argument to `inferImplicit`. This avoids unpositioned type errors.
* | Merge pull request #3645 from retronym/ticket/8430Jason Zaugg2014-04-213-0/+60
|\ \ | | | | | | SI-8430 Less non-determinism in patmat exhautiveness warnings
| * | SI-8430 Less non-determinism in patmat exhautiveness warningsJason Zaugg2014-03-243-0/+60
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Another mole whacked on the head by using `LinkedHashMap`. Caution: `LinkedHashMap` doesn't preserve its runtime type if you map through the generic interface. I've noted this gotcha as SI-8434. I've structured this patch to enforce that concrete collection with types, which is a good idea anyway. My method to track this down was to place breakpoints in `Hash{Map,Set}`.{foreach,iterator}` to see where that was used from within pattern match translation. This approach was drastically faster than my previous rounds of whack-a-mole. The counter-examples are still a bit off; I'm going to merge that aspect of this ticket with SI-7746, in which we've pinpointed the culpable part of the implementation, but haven't had success in fixing the bug.
* | Merge pull request #3658 from adriaanm/t8450Jason Zaugg2014-04-213-0/+19
|\ \ | | | | | | SI-8450 no "implicit numeric widening" in silent mode
| * | SI-8450 no "implicit numeric widening" in silent modeAdriaan Moors2014-03-263-0/+19
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this fix, we get a second, spurious warning. ``` t8450.scala:5: warning: implicit numeric widening def elapsed: Foo = (System.nanoTime - 100L).foo ^ t8450.scala:11: warning: implicit numeric widening def elapsed: Foo = (System.nanoTime - 100L).foo ^ error: No warnings can be incurred under -Xfatal-warnings. two warnings found one error found ``` By respecting silent contexts, we now get only one. I sneakily fixed similar occurrences without adding a test.
* / SI-8460 Fix regression in divergent implicit recoveryJason Zaugg2014-03-311-1/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicit search detects likely cycles by looking at the stack of open implicits and checking the same implicit appears twice, and if the second occurrence is trying satisfy an implicit search for a "dominant" type. Originally, this condition immediately failed the entire implicit search. However, since Scala 2.10, this mechanism has been refined to continue searching after the first divergent implicit is detected. If a second divergence is found, we fail immediately. If the followup search fails, we report the first divergence. Otherwise, we take the successful result. This mechanism was originally built around exceptions. This proved to be fragile, and was refactored in SI-7291 / accaa314 to instead use the `Context.errors` to control the process. But, since that change, the pattern of implicits in scalanlp/breeze and Shapeless have been prone to reporting the divergent implicit errors where they used to recover. So long as we left the `DivergentImplictTypeError` that originates from a nested implicit search in `context.errors`, we are unable to successfully typecheck other candidates. This commit instead stashes the first such error away in `DivergentImplicitRecovery`, to clear the way for the alternative path to succeed. We must retain any other divergent implicit errors, as witnessed by test/files/neg/t2031.scala, which loops unless we retain divergent implicit errors that we don't stash in `DivergentImplicitRecovery`.
* SI-8341 minor fixup for comments in testAdriaan Moors2014-03-181-3/+3
|
* SI-8341 Refine handoff of undet. params from implicit searchJason Zaugg2014-03-182-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In SI-7944 / 251c2b93, we discovered that typechecking of an implicit candidate could leave orphaned undetermined type parameters in the implicit search context. This resulted in naked type parameters leaking into implicit expansions. The fix seemed easy: just copy any symbols from `implicitSearchContext.undetparams` to the enclosing context (other than ones in `SearchResult#subst`). However, the test case in this ticket reveals a subtle flaw in that fix: `implicitSerachContext.undetparams` only contains the type params from the most recently typechecked candidate! Why? Implicit search uses the same context to typecheck all plausibly compatible candidates. The typechecking itself is driven by `typedImplicit1`. Side note, that explains the heisenbug behaviour noted in the ticket: Not *all* plausibly implicit candidates are typechecked. If the current 'best' eligible candidate is more specific than the next candidate, we can skip that altogether.Implicit search actually exploits this for performance by ordering the candidates according to usage statistics. This reordering, means that commenting out lines elsewhere in the file changed the behaviour! This commit simply stores the undet. tparams in the `SearchResult`, where it is safe from the vaguries of typechecking other candidates. That makes `Test1` and `Test2` with in the enclosed test case fail uniformly, both with each other, and with an explicit call to the view. This is ostensibly a regression from 2.10.3. To get there, we need an implicit search that has to infer `Nothing` in a covariant position. In 2.10.3, we would just let the `G` out into the wild, which did the right thing for the wrong reasons.
* Merge pull request #3631 from adriaanm/t4492Adriaan Moors2014-03-161-4/+4
|\ | | | | SI-4492 More informative error when class not found on classpath
| * SI-4492 More informative error when class not found on classpathAdriaan Moors2014-03-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | Position the error based on Select tree that failed to type check, presumably due to an underlying MissingRequirementError, which has no position. There are lots of other ways we could rewrap a MRE and supplement position info, but that remains TODO. Jason's review comment is recorded in the code. Also try to detect the case of a missing module and provide some advice, as well as linking to the forthcoming 2.11 guide at http://docs.scala-lang.org/overviews/core/scala-2.11.html.
* | SI-8265 Restore 2.10 variance behavior under -Xsource:2.10Paul Phillips2014-03-123-0/+8
|/ | | | | | | Issue deprecation warning under -Xsource:2.10 so time travelers can have an authentic deprecation experience before finding that their unsound code no longer compiles in 2.11. The relevant ticket to the soundness issue is SI-6566.
* SI-8376 Better type printing for Java varargsJason Zaugg2014-03-103-0/+15
| | | | | `T*` rather than `<repeated>[T]`, as we alreday do for Scala repeated parameters.
* Merge pull request #3606 from xeno-by/ticket/8375Jason Zaugg2014-03-1016-7/+73
|\ | | | | SI-8375 saner binary incompat errors for macros
| * Addresses pull request feedbackEugene Burmako2014-03-081-1/+1
| |
| * SI-8375 saner binary incompat errors for macrosEugene Burmako2014-03-0716-7/+73
| | | | | | | | | | | | Inspired by Brian McKenna's RC1 migration experience, this commit improves macro impl binding validation in order to provide more helpful diagnostic for this quite frequent class of errors.
* | SI-8372: unspliceable type printed in error messageGrzegorz Kossakowski2014-03-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The b8a76f688c6ce2a4c305da064303bb46b53be875 introduced ArrayOps.{unzip, unzip3} methods. Both of those methods have ClassTags as context bounds on their type parameters so they can create (and return) instances of Arrays. The type inference for those methods is supposed to be guided by implicit evidence that T <: (T1, T2) (or T <: (T1, T2, T3) in unzip3 case). However, context bounds are desugared into implicit parameters that prepended in front of implicit parameters declared in source code. That means the implicit evidence won't have a chance to guide type inference because it comes as last implicit parameter. This commit desugars context bounds and puts them at the end of implicit parameter list. This way type inference is guided properly and we get expected compiler errors for missing class tags. The change to parameters order breaks binary compatibility with respect to 2.11.0-RC1. I added filters to our binary compatibility configuration files. We can get rid of them as soon as 2.11.0 is out.
* | Test case for SI-8372: issue with ArrayOps.unzipGrzegorz Kossakowski2014-03-072-0/+17
|/ | | | | This commit merely documents current (suboptimal) error message printed for the code reported in SI-8372. The next commit will fix the problem.
* SI-8285 use correct kind of map for quasiquote positionsDenys Shabalin2014-02-282-1/+18
| | | | | | | Previously mutable.ListMap was used with assumption that it preserved order of inserted elements (but it doesn't). Surprisingly logic that assumed ordered elements worked mosly fine on unordered ones. I guess two bugs can cancel each other out.
* SI-4728 test caseLukas Rytz2014-02-262-0/+18
|