Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This function types #6739

Merged
merged 46 commits into from
Apr 7, 2016
Merged

This function types #6739

merged 46 commits into from
Apr 7, 2016

Commits on Jan 29, 2016

  1. Parse this type using parameter syntax

    Syntax is the same as a normal parameter:
    
    ```ts
    function f(this: void, x: number) {
    }
    ```
    sandersn committed Jan 29, 2016
    Configuration menu
    Copy the full SHA
    0a968f0 View commit details
    Browse the repository at this point in the history
  2. Check this type in functions.

    If `this` is not provided, it defaults to `void` for functions and `this`
    for methods. The rules for checking are similar to parameter checking, but
    there's still quite a bit of duplication for this implementation.
    sandersn committed Jan 29, 2016
    Configuration menu
    Copy the full SHA
    d8a77c0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a639b71 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9bd7afb View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ca16209 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    22e571f View commit details
    Browse the repository at this point in the history
  7. Add overloads for Function.apply/call/bind

    The new overloads use this types to specify the return type of these
    functions as well as the type of `thisArg`.
    sandersn committed Jan 29, 2016
    Configuration menu
    Copy the full SHA
    5fe8478 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    04e7d81 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    a4f1154 View commit details
    Browse the repository at this point in the history
  10. Update baselines

    1. Display of `this` changes for quick info.
    2. The type of Function.call/apply/bind is more precise.
    sandersn committed Jan 29, 2016
    Configuration menu
    Copy the full SHA
    d030889 View commit details
    Browse the repository at this point in the history

Commits on Feb 2, 2016

  1. Configuration menu
    Copy the full SHA
    675e081 View commit details
    Browse the repository at this point in the history

Commits on Feb 3, 2016

  1. Undo strictThis-clean changes

    Also fix other lint.
    sandersn committed Feb 3, 2016
    Configuration menu
    Copy the full SHA
    f6361ce View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8032b06 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0af56c0 View commit details
    Browse the repository at this point in the history

Commits on Feb 4, 2016

  1. First round of review comments addressed.

    Only major thing is a bug fix in
    `isContextSensitiveFunctionLikeDeclaration`, and turning on context
    sensitivity to `this` even with `--strictThis` off.
    sandersn committed Feb 4, 2016
    Configuration menu
    Copy the full SHA
    8c87da5 View commit details
    Browse the repository at this point in the history

Commits on Feb 5, 2016

  1. Add specific error messages for out-of-place this

    Also remove lint in checker.
    sandersn committed Feb 5, 2016
    Configuration menu
    Copy the full SHA
    2f74da1 View commit details
    Browse the repository at this point in the history
  2. Refactorings from review comments

    1. Add `getThisArgumentOfCall` (and correct the code)
    2. Remove `getParameterTypeAtIndex` in favour of `getTypeAtPosition`.
    Simplify calling code.
    sandersn committed Feb 5, 2016
    Configuration menu
    Copy the full SHA
    71488fc View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5821b87 View commit details
    Browse the repository at this point in the history

Commits on Feb 6, 2016

  1. Get contextual type of this parameter correctly

    Now the language service also sees the contextual type.
    
    Note that with this change, the type display for contextually typed this
    parameters goes away because there is no symbol. I'll fix type display
    next.
    sandersn committed Feb 6, 2016
    Configuration menu
    Copy the full SHA
    80de700 View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2016

  1. Improve display and contextual typing of this

    1. Always display `this` type if annotated.
    2. Contextually type un-annotated `this` parameters in addition to `this`
    expressions.
    sandersn committed Feb 8, 2016
    Configuration menu
    Copy the full SHA
    fa59875 View commit details
    Browse the repository at this point in the history
  2. Improve error reporting

    1. Fix bug in error reporting in compareSignaturesRelated.
    2. When the this-argument is a union type, allow assignability when the
    method's signature is assignable to *any* member of the union.
    sandersn committed Feb 8, 2016
    Configuration menu
    Copy the full SHA
    738713b View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2016

  1. Revert unioning of this argument types

    The right solution is to not instantiate this-types of unions, which is a
    separate problem more to do with this-class types.
    sandersn committed Feb 9, 2016
    Configuration menu
    Copy the full SHA
    41bb446 View commit details
    Browse the repository at this point in the history

Commits on Feb 16, 2016

  1. Address more comments and remove temp test.

    I added the temp test by mistake.
    sandersn committed Feb 16, 2016
    Configuration menu
    Copy the full SHA
    a014edf View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e7aa7e4 View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2016

  1. Union this-types of unioned call signatures

    And and tests and baselines
    sandersn committed Mar 8, 2016
    Configuration menu
    Copy the full SHA
    482accc View commit details
    Browse the repository at this point in the history

Commits on Mar 9, 2016

  1. Check this expressions in object literal methods

    Add a test and baseline
    sandersn committed Mar 9, 2016
    Configuration menu
    Copy the full SHA
    7b531fc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4012587 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3297824 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fa22250 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3a46e72 View commit details
    Browse the repository at this point in the history

Commits on Mar 11, 2016

  1. Rename --strictThis to --strictThisChecks

    Use the upcoming naming scheme for --strict.*Checks and --strictChecks
    flags.
    sandersn committed Mar 11, 2016
    Configuration menu
    Copy the full SHA
    1032cc5 View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2016

  1. Remove --strictThisChecks

    sandersn committed Mar 25, 2016
    Configuration menu
    Copy the full SHA
    c9f5f3d View commit details
    Browse the repository at this point in the history
  2. Add --noImplicitThis flag

    It's basically another --noImplicitAny error, but one that would break
    large amount of JavaScript-style code.
    sandersn committed Mar 25, 2016
    Configuration menu
    Copy the full SHA
    a91cdcc View commit details
    Browse the repository at this point in the history

Commits on Mar 28, 2016

  1. Configuration menu
    Copy the full SHA
    9e5f260 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f64110a View commit details
    Browse the repository at this point in the history

Commits on Mar 30, 2016

  1. Error on all uses of this that are implicitly any

    Previously it was only an error inside an function.
    sandersn committed Mar 30, 2016
    Configuration menu
    Copy the full SHA
    0113ad5 View commit details
    Browse the repository at this point in the history
  2. Address PR comments

    sandersn committed Mar 30, 2016
    Configuration menu
    Copy the full SHA
    e4ed7f9 View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2016

  1. Configuration menu
    Copy the full SHA
    0060b4d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    da98258 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ce68932 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    81f0d86 View commit details
    Browse the repository at this point in the history
  5. Improve error messages and always return any from newed functions

    Previously, functions that specified a type for `this` would return that
    type. Now they return `any`. This helps prevent unintentional use of this
    feature when --noImplicitAny is turned on.
    
    The type of `this` is still checked in the body of these functions.
    sandersn committed Mar 31, 2016
    Configuration menu
    Copy the full SHA
    4197a30 View commit details
    Browse the repository at this point in the history

Commits on Apr 1, 2016

  1. Configuration menu
    Copy the full SHA
    9e5fba6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2a9f39b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    921d5f8 View commit details
    Browse the repository at this point in the history

Commits on Apr 7, 2016

  1. Configuration menu
    Copy the full SHA
    6c735b5 View commit details
    Browse the repository at this point in the history