forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 14
update BB/TS:master branch to MSFT/TS:master #16
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove some useless internal comments
…d accesses are checked (#24700) * Check destructuring validity the same way element accesses and indexed accesses are checked * Accept updated test baseline * Use raw apparent type instead of passing in flag to sometimes make one * Use `checkComputedPropertyName`
# Conflicts: # tests/baselines/reference/objectRest.errors.txt # tests/baselines/reference/objectRest.types
Do not add source files to container only project
Report error summary in pretty mode during normal compilation
* infer from usage's unification uses multiple passes Previously, the unification step of infer-from-usage codefix would stop as soon an answer was found. Now it continues if the result is *incomplete*, with the idea that later passes may provide a better inference. Currently, an *incomplete* inference is 1. The type any. 2. The empty object type `{}` or a union or intersection that contains `{}`. In the checker, any takes priority over other types since it basically shuts down type checking. For type inference, however, any is one of the least useful inferences. `{}` is not a good inference for a similar reason; as a parameter inference, it doesn't tell the caller much about what is expected, and it doesn't allow the function author to use an object as expected. But currently it's inferred whenever there's an initialisation with the value `{}`. With this change, subsequent property assignments to the same parameter will replace the `{}` with a specific anonymous type. For example: ```js function C(config) { if (config === undefined) config = {}; this.x = config.x; this.y = config.y; this.z = config.z; } ``` * Unify all passes of inference from usage In the previous commit, I changed inference from usage to continue inference if a the result was *incomplete*. This commit now runs all 4 inference passes and combines them in a unification step. Currently the unification step is simple, it: 1. Gathers all inferences in a list. 2. Makes properties of anonymous types optional if there is an empty object in the inference list. 3. Removes *vacuous* inferences. 4. Combines the type in a union. An inference is *vacuous* if it: 1. Is any or void, when a non-any, non-void type is also inferred. 2. Is the empty object type, when an object type that is not empty is also inferred. 3. Is an anonymous type, when a non-nullable, non-any, non-void, non-anonymous type is also inferred. I think I might eventually want a concept of priorities, like the compiler's type parameter inference, but I don't have enough examples to be sure yet. Eventually, unification should have an additional step that examines the whole inference list to see if its contents are collectively meaningless. A good example is `null | undefined`, which is not useful. * Remove isNumberOrString * Unify anonymous types @Andy-MS pointed out that my empty object code was a special case of merging all anonymous types from an inference and making properties optional that are not in all the anonymous type. So I did that instead. * Use getTypeOfSymbolAtLocation instead of Symbol.type! * Unify parameter call-site inferences too Because they still have a separate code path, they didn't use the new unification code. Also some cleanup from PR comments. * Add object type unification test Also remove dead code. * Only use fallback if no inferences were found Instead of relying on the unification code to remove the fallback.
* module.exports aliases have correct flags They are marked both as (1) alias and (2) assignment declaration. This fixes alias resolution in cases where multiple module.exports assignments exist, but differ in whether they are aliases or not: ```js function f() { } module.exports = f module.exports = 23 ``` Previously, this construct would fail to resolve the alias `f` because the `export=` symbol would be marked as Alias | Value but not Assignment. This change just adds Assignment so that the assignment declaration alias-following rules apply: you should always follow the alias, regardless of other flags. Also, isAliasSymbolDeclaration needed to be tightened up. Previously, I missed the condition that `module.exports =` aliases required an EntityNameDeclaration on right-hand-side, just like `export default` and `export =` aliases. * Address PR comments 1. Rename test to be more accurate. 2. Always mark module.exports assignments with SymbolFlags.Assignment.
* Refactors can return ReadonlyArray<ApplicableRefactorInfo> * Remove unnecessary type assertions
* Exclude keywords from import completions * Still allow contextual keywords * Add excludes tests
This makes it appear before the ts-ignore codefix, specifically.
…deEdit (#28258) * Improve error message when scriptInfo is missing in mapTextChangeToCodeEdit * Include both fileName and path, and use in more places * Move logErrorForScriptInfoNotFound to editorServices.ts * Update API
* Add related span for mixin constructor error * Remove unneeded casts * Nicer style
…ad-only-property' to be more specific.
... and add explicit delta suppressor for list end tokens
Properly set symbolMeanings when calling getSymbolsInScope
* Handle merging unknownSymbol * mergeSymbol of unknown target returns source, not unknown
* Avoid infinite loop checking yield expression * Revert now-unneeded change * Revert test filename changes
Previously, the compiler would crash when binding a non-top-level property assignment on the symbol of an unresolved module: ```js import x from 'arglebaz' { x.bar = 1 } ``` That's because `x` looks like an alias but doesn't have a valueDeclaration (since there is no file named 'arglebaz'), and the new code for binding Object.defineProperty calls forgot to check for an undefined valueDeclaration. This change adds the checks for an undefined valueDeclaration.
Enable statistics reporting per program through temporary build api
…ference for quick determination of fileName to projectReferenceRedirect
Create map from fileNames in referenced projects to resolvedProjectReference for quick determination of fileName to projectReferenceRedirect
…unts (#28604) * Allow union signatures to merge when they have differing argument counts * Accept updated baselines * Adjust comments io changed tests
update API baselines with new version number
… for .d.ts files across the build (only first time)
… has its own cache logic).
…tics Dont explicitly get declaration diagnostics in --build mode, instead get them as part of emit
Cache results for readFile, fileExists, directory exists, sourceFiles for .d.ts files across the build (only first time)
Elaborate on types in unions with the most overlap in properties
This reverts commit 0c4ceee.
Revert "Don't consider 'typeof a' as using 'a' (#28528)"
Add perf optimizations for path comparisons
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Assign: @mheiber