summaryrefslogtreecommitdiff
path: root/test/files/neg
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3041 from gkossakowski/merge-2.10.xJason Zaugg2013-10-183-0/+34
|\ | | | | Merge 2.10.x into master
| * Merge remote-tracking branch 'scala/2.10.x' into merge-2.10.xGrzegorz Kossakowski2013-10-163-0/+34
| |\ | | | | | | | | | | | | | | | Conflicts: build.number test/files/neg/classmanifests_new_deprecations.check
| | * SI-7783 Don't issue deprecation warnings for inferred TypeTreesJason Zaugg2013-09-274-7/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecation checks in RefChecks were looking into all TypeTrees to find references to deprecated type aliases. However, when the compiler infers a type argument or type of a member it creates a TypeTree (with a null original) that was also leading to warnings. I ran into this problem often when upgrading a build from SBT 0.12 to 0.13: a plugin I was using used the deprecated type alias, and I suffered transitively when I used methods from its API. This commit disables the checks for inferred TypeTree-s.
* | | Test cases for SAM restrictions.Jason Zaugg2013-10-173-0/+95
|/ / | | | | | | | | | | | | | | | | | | Only one seems to indicate something new: ((x: Int) => 0): NonClassType I believe that we shouldn't pursue SAM translation for that case, and fallthrough to Function1. That would allow for an implicit view to finish the job.
* | Merge remote-tracking branch 'scala/master' into fix-merge-3018Grzegorz Kossakowski2013-10-1440-69/+220
|\ \ | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala
| * \ Merge pull request #3032 from retronym/ticket/7239-testPaul Phillips2013-10-122-0/+16
| |\ \ | | | | | | | | SI-7239 A bonus test case from [scala-user]
| | * | SI-7239 A bonus test case from [scala-user]Jason Zaugg2013-10-112-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Thanks to Ilya Denisov for another sample [1] that progressed with the fix for SI-7239, 174334b. [1] https://groups.google.com/forum/#!topic/scala-user/8rZeCeiTYDo
| * | | Merge pull request #3024 from retronym/ticket/7895Paul Phillips2013-10-1226-45/+156
| |\ \ \ | | | | | | | | | | SI-7895 Error reporting: avoid cascading, truncation
| | * | | SI-7985 Typecheck args after failure to typecheck functionJason Zaugg2013-10-098-7/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `missing1.foo(missing2)` now reports `missing1` and `missing2` as not found. Previously, only the first was reported. The arguments are typed with an expected type ErrorType. We propagate this through as the inferred type of anonymous function parameters to avoid issuing cascading "missing parameter type" errors in code like: scala> Nil.mapp(x => abracadabra) <console>:8: error: value mapp is not a member of object Nil Nil.mapp(x => abracadabra) ^ <console>:8: error: not found: value abracadabra Nil.mapp(x => abracadabra) ^ This was in response to unwanted changes in the output of existing neg tests; no new test is added. Similarly, we refine the errors in neg/t6436b.scala by to avoid cascaded errors after: type mismatch; found: StringContext, required: ?{def q: ?}
| | * | | SI-7895 Issue all buffered errors after silent mode.Jason Zaugg2013-10-098-6/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than just the first. For example, `foo(wizzle, wuzzle, woggle)` should report all three not-found symbols.
| | * | | SI-7895 Avoid cascade of "symbol not found" in pattern matchesJason Zaugg2013-10-0910-32/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we can't type check the `Foo` in `case Foo(a, b) => (a, b)`, we should enter error symbols for `a` and `b` to avoid further errors being reported in the case body.
| * | | | Merge pull request #3020 from paulp/pr/overriding-pairsJason Zaugg2013-10-0910-24/+35
| |\ \ \ \ | | |_|/ / | |/| | | Generalize OverridingPairs to SymbolPairs.
| | * | | Generalize OverridingPairs to SymbolPairs.Paul Phillips2013-10-0510-24/+35
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Increases your chance of knowing what is going on in OverridingPairs. Introduces some new abstractions which I hope for your own sakes you will put to use in some way: RelativeTo: operations relative to a prefix SymbolPair: two symbols being compared for something, and the enclosing class where the comparison is being performed Fixed a minor bug with access by accident by way of more principled pair analysis. See run/private-override.scala. Upgraded the error message issued on certain conflicts to give the line numbers of both conflicting methods, as opposed to just one and you go hunting.
| * / / SI-7899 Don't infer by-name types during, e.g. eta-expansionJason Zaugg2013-10-072-0/+13
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given: def id[A](a: A): A = a def foo(f: (=> Int) => Int) = () foo(id) We eta-expanded `id` and inferred `A` to be `=> Int` to satisfy the expected type set forth by the formal parameter `f`. We really shouldn't go about inferring types that we can't *write*. Our attempt to do so led promptly into a `ClassCastException` in the enclosed test. This commit: - drops by-name-ness during `inferExprInstance` - tests that this results in a type error for the reported bug (neg/t7899) - tests that a method with a by-name parameter can still be eta expanded to match function with a corresponding by-name parameter (run/t7899) - discovers the same latent CCE in pos/t7584 - now that would be a type error - so we compensate by using placeholder functions rather than eta-expansion. - and move that that test to `run` for good measure.
* / / Don't pursue SAM translation after an arity mismatch.Jason Zaugg2013-10-083-0/+75
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change: scala> trait T { def apply(a: Int): Int } defined trait T scala> ((x: Int, y: Int) => 0): T <console>:9: error: object creation impossible, since method apply in trait T of type (a: Int)Int is not defined ((x: Int, y: Int) => 0): T ^ After the change, these cases report the same errors as they do *without* -Xexperimental.
* | Merge pull request #3005 from paulp/pr/7886Paul Phillips2013-10-0319-5/+162
|\ \ | | | | | | SI-7886 unsoundness in pattern matcher.
| * | SI-6680 unsoundness in gadt typing.Paul Phillips2013-10-0114-0/+129
| | | | | | | | | | | | | | | | | | | | | Introduces -Xstrict-inference to deal with the significant gap between soundness and what presently compiles. I'm hopeful that it's TOO strict, because it finds e.g. 75 errors compiling immutable/IntMap.scala, but it might be that bad.
| * | SI-7886 unsoundness in pattern matcher.Paul Phillips2013-10-015-5/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I tracked down what was behind the issue described here: // TODO: fix the illegal type bound in pos/t602 -- type inference // messes up before we get here: /*override def equals(x$1: Any): Boolean = ... // Span[Any] --> Any is not a legal type argument for Span! val o5: Option[com.mosol.sl.Span[Any]] = */ ...which led straight to the unsoundness seen in neg/t7886. It is dangerous to have an expected type of "Any" because the type system will blithely ignore kind errors, since "Any" can absorb anything. The consequence in this instance was that inferring the case constructor for a type like Foo[T <: Bound] if done with expected type Any, this would come up with Foo[Any]. I altered it to use expected type Foo[T], which lets the dummy type parameter survive to carry the bound forward and restores sense to the inference. The before/after output for -Xprint:patmat on pos/t602.scala is: 15c15 < if (x1.isInstanceOf[com.mosol.sl.Span[Any]]) --- > if (x1.isInstanceOf[com.mosol.sl.Span[K]]) 17c17 < <synthetic> val x2: com.mosol.sl.Span[Any] = \ (x1.asInstanceOf[com.mosol.sl.Span[Any]]: com.mosol.sl.Span[Any]); --- > <synthetic> val x2: com.mosol.sl.Span[K] = \ (x1.asInstanceOf[com.mosol.sl.Span[K]]: com.mosol.sl.Span[K]); 19,20c19,20 < val low$0: Option[Any] = x2.low; < val high$0: Option[Any] = x2.high; --- > val low$0: Option[K] = x2.low; > val high$0: Option[K] = x2.high; A file in the library depended (needlessly) on the unsoundness. It was easy to fix but reminds us this may affect existing code.
* | | Merge pull request #2965 from retronym/ticket/7859Grzegorz Kossakowski2013-10-036-26/+67
|\ \ \ | | | | | | | | SI-7859 Value classes may wrap a non-public member
| * | | SI-7859 Value classes may wrap a non-public memberJason Zaugg2013-09-296-26/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We allow value class constructors to be non-public, so to be regular, we should also allow the same for the param accessor. This commit uses the 'makeNotPrivate' machinery to ensure that the backend can generate the requisite unboxing calls. This commit: - refactors the code that enforced the restrictions, improving a few error messages and positions. The remaining restrictions needed some rewording in light of this change. - allows value classes to have non-public, val parameters. private[this] / protected[this] are still disallowed as value classes don't have a concept of `this`, and because trying to accomdate then would complicate the implementation. This means that `class C(x: Int) extends AnyVal` is not allowed, the user still must write `private val x: Int` or `val x: Int`. - Outlaw `class C()()(val x: Int) extends AnyVal` to curtail any bugs that might lurk in such a formulation. The tests: - Show that the privacy is respected in the typer phase, under joint and separate compilation. We don't want a repeat performance of SI-6601. - Show that code that needs compiler-generated unboxes works under both compilation scenarios - Checks that the remaining restrictions are enforced and well communicated.
* | | | clearly establishes what macro bundles areEugene Burmako2013-10-0212-0/+102
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously it was enough to just extend scala.reflect.macros.Macro, which created some loopholes, but now scalac enforces that bundles: 1) Are static (not necessarily top-level, but just static) 2) Are traits (objects shouldn't be bundles anyway, and classes bring complications with their ctors which require special treatment in generated classes, so why support them if they don't bring anything new to the table?) 3) Are monomorphic (again, this brings unnecessary complications wrt auxiliary code generation, so I don't see merit in supporting polymorphic bundles, whatever that a polymorphic bundle could mean) 4) Don't provide concrete implementation for Macro.c (if they do then what is the point?)
* | | Some refinement of -Xlint interpolation warning.Paul Phillips2013-09-272-1/+44
| | | | | | | | | | | | | | | | | | | | | I had covered a few more cases working on this recently. The warnings in several more cases involving polymorphism, currying, and selects vs. idents receive more refined handling.
* | | Merge pull request #2909 from soc/SI-7629-deprecate-view-boundsJason Zaugg2013-09-273-0/+16
|\ \ \ | | | | | | | | SI-7629 Deprecate view bounds
| * | | SI-7629 Deprecate view boundsSimon Ochsenreither2013-09-253-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | This introduces a warning(/error with -Xfuture) with a general migration advice. The IDE can use the warning to offer a quick fix with the specific refactoring necessary.
* | | | Merge pull request #2992 from retronym/ticket/7877Jason Zaugg2013-09-272-0/+20
|\ \ \ \ | | | | | | | | | | Only look for unapplies in term trees
| * | | | SI-7877 Only look for unapplies in term treesJason Zaugg2013-09-272-0/+20
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Scala 2.10.2, the enclosed test case has crashed in the backend. Before, we correctly rejected this pattern match. My bisection landed at a merge commit f16f4ab157, although both parents were good. So I don't quite trust that. I do think the regression stems from the changes to allow: case rx"AB(.+)" => Examples of this are in run/t7715.scala. This commit limits the search for extractors to cases where the function within the Apply is a term tree.
* | | | Merge pull request #2978 from som-snytt/issue/7848-forgotten-interp-msg-lgtmPaul Phillips2013-09-2710-28/+73
|\ \ \ \ | | | | | | | | | | SI-7848 Xlint no warn on $sym with params
| * | | | SI-7848 Xlint no warn on $sym with paramsSom Snytt2013-09-2310-28/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This idea brought to you by retronym. Also improve implicitNotFound detection at typer; and avoid checking the standard interpolation expression for cases like s"some $$x". Some minor refactorings of implicitNotFound strings. The intersobralator allows extra spaces, i.e., trims.
* | | | | Merge pull request #2996 from paulp/pr/3971Jason Zaugg2013-09-272-0/+33
|\ \ \ \ \ | | | | | | | | | | | | SI-3971 error message carat mispoints at curried methods.
| * | | | | SI-3971 error message carat mispoints at curried methods.Paul Phillips2013-09-272-0/+33
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Point at the beginning of the first argument list when reporting an error, as this is most easily associated with the application taking place (which may involve multiple applies in succession.) Thanks to retronym for figuring out why issuing a better error message broke the compiler on non-erroneous compile runs. The changes to "treesInResult" are the consequence.
* / | | | SI-6120 multiple warnings at same position.Paul Phillips2013-09-2714-11/+93
|/ / / / | | | | | | | | | | | | | | | | An error suppresses all further warnings at the same position, but multiple warnings can be heard.
* | | | 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.
* | | | Revert "Merge pull request #2957 from paulp/pr/parser-improvements"François Garillot2013-09-2443-182/+88
| |/ / |/| | | | | | | | | | | This reverts commit 884e1ce762d98b29594146d37b85384581d9ba96, reversing changes made to f6fcc4431f272c707d49de68add532c452dd4b0f.
* | | 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-231-1/+1
|\ \ \ \ | |_|/ / |/| | | Quasiquotes: add syntactic extractor for assignment-like trees
| * | | add syntactic extractor for assignment-like treesDen Shabalin2013-09-181-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | SI-7854, SI-6768 better parsing/positioning in parserPaul Phillips2013-09-1842-101/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-184-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
* | | Cull extraneous whitespace.Paul Phillips2013-09-18152-345/+342
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #2884 from retronym/ticket/3832Jason Zaugg2013-09-155-0/+38
|\ \ | | | | | | SI-1909 SI-3832 SI-7007 SI-7223 Improved handling of larval objects
| * | 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-113-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Reducing variation of tree creation methods.Paul Phillips2013-09-133-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #2859 from som-snytt/issue/7622-phaserGrzegorz Kossakowski2013-09-1224-9/+193
|\ \ \ | | | | | | | | SI-7622 Clean Up Phase Assembly
| * | | SI-7622 Scaladoc and error message polishSom Snytt2013-08-212-2/+2
| | | | | | | | | | | | | | | | Restores the verbiage "run right after".
| * | | SI-7622 Clean Up Phase AssemblySom Snytt2013-08-2122-0/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let optimiser components and continuations plugin opt-out when required flags are not set. Wasted time on a whitespace error in check file, so let --debug dump the processed check file and its diff.