summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Infer.scala
Commit message (Collapse)AuthorAgeFilesLines
...
* Wipe some dirt off protoTypeArgs's face.Paul Phillips2013-05-201-14/+8
| | | | He's a good kid, even if not the most hygenic.
* Splashed soap and water on checkAccessible.Paul Phillips2013-05-201-67/+29
| | | | | | | Yes checkAccessible, you patiently waited your turn. Do you like your new clothes? Oh, still not clean enough? I understand, but we must leave time for the other methods. Now run along and check something.
* Pull some big chunks out of checkAccessible.Paul Phillips2013-05-201-0/+43
| | | | To streamline the essential logic.
* Remove isPossiblyMissingArgs.Paul Phillips2013-05-201-10/+0
| | | | It has been hardcoded to return false for a long while anyway.
* Annotated return type of a method.Paul Phillips2013-05-201-4/+3
| | | | | | Because nobody should have to guess a return type like (List[Type], Array[Int], Boolean). In fact nobody should ever experience such a return type at all.
* Commented out code from 2008.Paul Phillips2013-05-201-7/+0
|
* Commented out code from 2007.Paul Phillips2013-05-201-43/+0
| | | | It's not exactly 2006-era code but it's still a little ripe.
* Commented out code from 2006.Paul Phillips2013-05-201-13/+0
| | | | | | Yes, 2006. Perhaps we should have a "sunset provision" which removes commented-out code after seven years. Or even slightly sooner.
* Scrubbing up inferPolyAlternatives.Paul Phillips2013-05-201-77/+67
| | | | Now you can take inferPolyAlternatives home to meet your mother.
* Moving on to checkBounds.Paul Phillips2013-05-201-26/+19
| | | | So much dust and debris, so little time.
* Cleaning crew moves down the hall.Paul Phillips2013-05-201-98/+70
| | | | | | | Swabbing the decks of isAsSpecific and isApplicableSafe. Wow isApplicableSafe, you don't really need to declare and allocate a two-argument case class in order to manage a second method call.
* Cleaning up isApplicable and neighbors.Paul Phillips2013-05-201-99/+70
| | | | | I'd really like these methods to receive greater scrutiny. To that end I'm scrutinizing them.
* Merge pull request #2483 from adriaanm/merge-2.10.xPaul Phillips2013-05-021-3/+9
|\ | | | | Merge 2.10.x
| * Merge 2.10.x into masterAdriaan Moors2013-05-021-3/+9
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bincompat-forward.whitelist.conf src/compiler/scala/tools/nsc/matching/Patterns.scala src/compiler/scala/tools/nsc/transform/patmat/Logic.scala src/compiler/scala/tools/nsc/typechecker/Infer.scala src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala test/files/neg/t5663-badwarneq.check
| | * Merge pull request #2420 from retronym/ticket/6675-2Jason Zaugg2013-04-231-3/+9
| | |\ | | | | | | | | SI-6675 Avoid spurious warning about pattern bind arity.
| | | * SI-6675 Avoid spurious warning about pattern bind arity.Jason Zaugg2013-04-211-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 692372ce, we added a warning (under -Xlint) when binding a `TupleN` in to a single pattern binder, which wasn't allowed before 2.10.0, and more often than not represents a bug. However, that warning overstretched, and warned even when using a Tuple Pattern to bind to the elements of such a value. This commit checks for this case, and avoids the spurious warnings. A new test case is added for this case to go with the existing test for SI-6675: $ ./tools/partest-ack 6675 % tests-with-matching-paths ... 3 % tests-with-matching-code ... 2 # 3 tests to run. test/partest --show-diff --show-log \ test/files/neg/t6675-old-patmat.scala \ test/files/neg/t6675.scala \ test/files/pos/t6675.scala \ "" Testing individual files testing: [...]/files/pos/t6675.scala [ OK ] Testing individual files testing: [...]/files/neg/t6675-old-patmat.scala [ OK ] testing: [...]/files/neg/t6675.scala [ OK ] All of 3 tests were successful (elapsed time: 00:00:03)
* | | | Merge pull request #2447 from paulp/pr/bynamePaul Phillips2013-04-261-8/+4
|\ \ \ \ | |/ / / |/| | | Created utility function for dropping by-name-ness.
| * | | Created utility function for dropping by-name-ness.Paul Phillips2013-04-251-8/+4
| | | | | | | | | | | | | | | | And applied it in three locations.
* | | | Merge pull request #2436 from paulp/pr/lub-productionPaul Phillips2013-04-251-0/+1
|\ \ \ \ | |/ / / |/| | | Minor overhaul of lub-producing typer methods.
| * | | Added ensureFullyDefined.Paul Phillips2013-04-231-0/+1
| | | | | | | | | | | | | | | | Obvious fusion of "isFullyDefined" and "makeFullyDefined".
* | | | Merge remote-tracking branch 'origin/master' into ticket/7345-2Jason Zaugg2013-04-211-1/+5
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala
| * | | Merge remote-tracking branch 'origin/2.10.x' into ↵Jason Zaugg2013-04-201-1/+5
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | merge/v2.10.1-245-g5147bb2-to-master Conflicts: src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala
| | * | SI-7388 Be more robust against cycles in error symbol creation.Jason Zaugg2013-04-181-1/+5
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Symbol#toString` was triggering `CyclicReferenceError` (specifically, `accurateKindString` which calls `owner.primaryConstructor`.) The `toString` output is used when creating an error symbol to assign to the tree after an error (in this case, a non-existent access qualifier.) This commit catches the error, and falls back to just using the symbol's name.
* | | SI-7345 Move `inSilentMode` from Infer to Context.Jason Zaugg2013-04-211-14/+3
| | |
* | | SI-7345 Prefer using a throwaway silent context over buffer flushing.Jason Zaugg2013-04-211-10/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we are using a throwaway silent context, we can just let it drift out of scope and over the horizon, rather than ceremoniously flushing its buffers on completion. - Applied to Scaladoc. - Applied to Infer#isApplicableSafe. Less manual error buffer management affords greater opportunity to cleanly express the logic. - Applied to `typerReportAnyContextErrors`. The reasoning for the last case is as follows: - There were only two callers to `typerReportAnyContextErrors`, and they both passed in as `c` a child context of `context`. - That child context must share the error reporting mode and buffer with `context`. - Therefore, extracting an error from `c` and issuing it into `context` is a no-op. Because the error buffer is Set, it was harmless. This part will probably textually conflict with the same change made in SI-7319, but the end results are identical.
* | | SI-7345 More refactoring and documentation in ContextsJason Zaugg2013-04-211-9/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | - Use `firstError match {}` rather than `if (c.hasErrors) c.firstError ..` - Convert implementation comments to doc comments - Add new doc comments - Refactor `Context#make` for better readability. - Note a few TODOs. - Roughly delineate the internal structure of Contexts with comments. - Combine `mode` and `state` methods into `contextMode`. - Move `isNameInScope` closer to its compadres. - Improving alignment, tightening access.
* | SI-7261 Implicit conversion of BooleanSetting to Boolean and BooleanFlagSom Snytt2013-03-271-3/+3
| | | | | | | | | | | | | | This commit shortens expressions of the form `if (settings.debug.value)` to `if (settings.debug)` for various settings. Rarely, the setting is supplied as a method argument. The conversion is not employed in simple definitions where the Boolean type would have to be specified.
* | Merge pull request #2285 from vigdorchik/silence_scaladocPaul Phillips2013-03-231-15/+13
|\ \ | | | | | | Remove unrecognized doc comments
| * | Doc -> C-style comments for local symbols to avoid "discardingEugene Vigdorchik2013-03-211-15/+13
| | | | | | | | | | | | | | | unmoored doc comment" warning when building distribution for scala itself.
* | | Merge pull request #2259 from Blaisorblade/issue/6123-try-3Paul Phillips2013-03-221-2/+4
|\ \ \ | | | | | | | | SI-6123: -explaintypes should not explain errors which won't be reported, new attempt
| * | | SI-6123: -explaintypes should not explain errors which won't be reportedPaolo G. Giarrusso2013-03-151-2/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -explainTypes means that only type tests which *fail* should be reported in more detail by using explainTypes. Hence, callers of explainTypes should check if type errors are being ignored, by checking context.reportErrors. Hence, this check is added to Inferencer, and another call site is redirected to that method. Moreover, explainTypes should only be called if an error exists. Enforce that in checkSubType, and remove spurious home-made explainTypes output. Finally, in ContextErrors, stop checking `settings.explaintypes.value` before calling `explainTypes` which will check it again. Note that this patch does not fix all occurrences, but only the ones which showed up during debugging. The other ones never cause problems, maybe because they occur when contextErrors is in fact guaranteed to be true. We might want to fix those ones anyway. This fixes regressions in c800d1fec5241ed8c29e5af30465856f9b583246 and 78f9ef3906c78413ff8835fdad3849bfe5516be2. Thanks to hubertp (Hubert Plociniczak) for the first round of review. Refs #6123 backport to _2.10.x_
* / / Eliminate a bunch of -Xlint warnings.Paul Phillips2013-03-121-1/+1
|/ / | | | | | | | | | | Mostly unused private code, unused imports, and points where an extra pair of parentheses is necessary for scalac to have confidence in our intentions.
* | Enabling commit for interactive/scaladoc modules.Paul Phillips2013-03-091-1/+1
| | | | | | | | | | | | This is a non-behaviorally-changing setup commit which re-routes bits of code through avenues which can more easily be influenced by subclasses of Global.
* | Name boolean arguments in src/compiler.Jason Zaugg2013-03-051-6/+6
| | | | | | | | | | | | | | | | | | | | What would you prefer? adaptToMemberWithArgs(tree, qual, name, mode, false, false) Or: adaptToMemberWithArgs(tree, qual, name, mode, reportAmbiguous = false, saveErrors = false)
* | Add some logging to sinful typevar methods.Paul Phillips2013-03-041-31/+26
| | | | | | | | | | | | | | These super-mutation-oriented methods should enthusiastically communicate what they are doing, especially when they encounter anything unexpected. None of this work should be taken as an endorsement of any of the worked-upon code.
* | Address some ScaladocrotJason Zaugg2013-02-251-8/+5
| | | | | | | | | | | | - @param tags whose name drifted from the corresponding parameter - Remove or complete a few stray stub comments (@param foo ...) - Use @tparam where appropriate.
* | Be explicit about empty param list calls.Jason Zaugg2013-02-241-1/+1
| | | | | | | | With the exception of toString and the odd JavaBean getter.
* | Merge commit '81d8f9d3da' into merge-210Paul Phillips2013-02-091-28/+42
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * excluded from merge: [nomerge] SI-6667 Demote a new ambiguity error to a lint warning. Revert "SI-6422: add missing Fractional and Integral alias in scala package" [backport] SI-6482, lost bounds in extension methods. * commit '81d8f9d3da': (31 commits) reflecting @throws defined in Scala code pullrequest feedback SI-5833 Fixes tail-of-Nil problem in RefinedType#normalizeImpl SI-6017 Scaladoc: Show all letters without dangling links SI-6017 Generate Scaladoc's index links in Scala side SI-5313 Minor code cleanup for store clobbering SI-5313 Test clobbers on the back edge of a loop SI-7033 Be symful when creating factory methods. SI-7022 Additional test case for value class w. bounds SI-7039 unapplySeq result type independent of subpattern count evicts javac-artifacts.jar SI-7008 @throws annotations are now populated in reflect Fix SI-6578. Deprecated `askType` because of possible race conditions in type checker. SI-7029 - Make test more robust SI-7029 - Makes sure that uncaught exceptions are propagated to the UEH for the global ExecutionContext SI-6941 tests SI-6686 drop valdef unused in flatMapCond's block ... Conflicts: src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala src/reflect/scala/reflect/internal/Definitions.scala
| * Merge pull request #2051 from adriaanm/ticket-7039Adriaan Moors2013-02-041-28/+42
| |\ | | | | | | SI-7039 unapplySeq result type independent of subpattern count
| | * SI-7039 unapplySeq result type independent of subpattern countAdriaan Moors2013-02-011-28/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a bug in the implementation of the `unapplySeq` part of the spec below. An `unapply` method with result type `R` in an object `x` matches the pattern `x(p_1, ..., p_n)` if it takes exactly one argument and, either: - `n = 0` and `R =:= Boolean`, or - `n = 1` and `R <:< Option[T]`, for some type `T`. The argument pattern `p1` is typed in turn with expected type `T`. - Or, `n > 1` and `R <:< Option[Product_n[T_1, ..., T_n]]`, for some types `T_1, ..., T_n`. The argument patterns `p_1, ..., p_n` are typed with expected types `T_1, ..., T_n`. An `unapplySeq` method in an object `x` matches the pattern `x(p_1, ..., p_n)` if it takes exactly one argument and its result type is of the form `Option[S]`, where either: - `S` is a subtype of `Seq[U]` for some element type `U`, (set `m = 0`) - or `S` is a `ProductX[T_1, ..., T_m]` and `T_m <: Seq[U]` (`m <= n`). The argument patterns `p_1, ..., p_n` are typed with expected types `T_1, ..., T_m, U, ..., U`. Here, `U` is repeated `n-m` times.
| * | Merge pull request #2022 from lrytz/analyzerPlugins210Lukas Rytz2013-02-031-2/+2
| |\ \ | | | | | | | | Analyzer Plugins
| * | | [backport] SI-6482, lost bounds in extension methods.Jason Zaugg2013-02-021-0/+11
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashed commit of the following: commit 5c156185306ba797c0443d9dccae0ae7ce462a1f Author: Paul Phillips <paulp@improving.org> Date: Sat Oct 6 15:42:50 2012 -0700 A little more housecleaning in ExtensionMethods. The only real contribution is readability. (cherry picked from commit 61f12faacaaccf366f9211ba6493fb042a91f1d2) Conflicts: src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala commit 79f443edf584745d614e24fb9ca6644c6b18d439 Author: Paul Phillips <paulp@improving.org> Date: Sat Oct 6 14:22:19 2012 -0700 Incorporated pull request feedback. (cherry picked from commit 153ccb4757718cceb219988f30381f73362e6075) commit 707f580b0cdcb01e27ca4c76991dea427945b5bd Author: Paul Phillips <paulp@improving.org> Date: Sat Oct 6 10:20:45 2012 -0700 Fix for SI-6482, lost bounds in extension methods. That was a good one. How to create a new method with type parameters from multiple sources, herein. (cherry picked from commit ff9f60f420c090b6716c927ab0359b082f2299de) commit 8889c7a13f74bc175e48aa2209549089a974c2af Author: Paul Phillips <paulp@improving.org> Date: Fri Oct 5 22:19:52 2012 -0700 Responded to comment about how many isCoercibles there are. I make the case that there is only one. (cherry picked from commit 883f1ac88dd7cec5882d42d6b48d7f267d1f6e00)
* | | Merge commit 'f3cdf146709e0dd98533ee77e8ca2566380cb932'Lukas Rytz2013-02-041-2/+2
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/compiler/scala/tools/nsc/typechecker/Namers.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala src/reflect/scala/reflect/internal/AnnotationCheckers.scala src/reflect/scala/reflect/internal/Symbols.scala
| * | Analyzer PluginsLukas Rytz2013-02-031-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AnnotationCheckers are insufficient because they live outside the compiler cake and it's not possible to pass a Typer into an annotation checker. Analyzer plugins hook into important places of the compiler: - when the namer assigns a type to a symbol (plus a special hook for accessors) - before typing a tree, to modify the expected type - after typing a tree, to modify the type assigned to the tree Analyzer plugins and annotation checker can be activated only during selected phases of the compiler. Refactored the CPS plugin to use an analyzer plugin (since adaptToAnnotations is now part of analyzer plugins, no longer annotation checkers).
| * SI-5859, inapplicable varargs.Paul Phillips2013-01-301-12/+15
| | | | | | | | | | [backport] And other polishing related to varargs handling.
* | Add PolyType to Infer#normalize.Paul Phillips2013-01-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | It arises when inferring the type of an overloaded call: def g(s: String): String = s def f: String = ??? def f[C](c: C): String = g(f) Also refined warning when isHKSubType is called with arguments which very likely were never meant to be compared.
* | Cleaning up dummy applied types and friends.Paul Phillips2013-01-261-4/+2
| | | | | | | | Incorporates feedback from dealias/widen PR.
* | Renamed methods to be less ambiguous in intent.Paul Phillips2013-01-261-1/+1
| | | | | | | | | | | | | | | | isNamed => isNamedArg isIdentity => allArgsArePositional nameOf => nameOfNamedArg Moved mkNamedArg into TreeGen.
* | Merge branch '2.10.x'Adriaan Moors2013-01-161-25/+38
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/doc/Settings.scala src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala src/compiler/scala/tools/nsc/matching/Patterns.scala src/compiler/scala/tools/nsc/transform/UnCurry.scala src/compiler/scala/tools/nsc/typechecker/Infer.scala src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/reflect/scala/reflect/internal/settings/MutableSettings.scala src/reflect/scala/reflect/runtime/Settings.scala src/swing/scala/swing/SwingActor.scala src/swing/scala/swing/SwingWorker.scala test/files/run/t6955.scala
| * Merge pull request #1888 from retronym/ticket/6675Paul Phillips2013-01-151-4/+11
| |\ | | | | | | SI-6675 -Xlint arity enforcement for extractors