Commit Graph

2687 Commits

Author SHA1 Message Date
Anders Hejlsberg ccad31bf24 Equality comparisons for null/undefined in strict null checking mode 2016-05-03 17:05:12 -07:00
Anders Hejlsberg c3186a452c Include accessors in control flow type analysis 2016-05-03 11:09:21 -07:00
Anders Hejlsberg 2ff9c915a0 Merge pull request #8429 from Microsoft/declaredTypeAsInitialType
Declared type as initial type in control flow analysis
2016-05-02 21:57:56 -07:00
Anders Hejlsberg adc860893e Initial type of variable is union of declared type and undefined 2016-05-02 16:24:06 -07:00
Vladimir Matveev 50390bb586 check usage before declaration for computed properties in destructuring inside for-of variable declaration 2016-05-02 13:31:35 -07:00
Anders Hejlsberg a7e40469ff Merge pull request #8421 from Microsoft/controlFlowNestedLoops
Fix control flow analysis in nested loops
2016-05-02 12:02:57 -07:00
Anders Hejlsberg f183f1ab38 Quicker bail out for type analysis in nested loops 2016-05-02 09:21:54 -07:00
Daniel Rosenwasser ee4baef51f Applied suggested change. 2016-05-01 21:08:53 -07:00
Daniel Rosenwasser fa67cb86b3 Merge remote-tracking branch 'origin/master' into thisTypesInBasePropAndContainer 2016-05-01 20:52:51 -07:00
Nathan Shively-Sanders d1b60f8bfb Merge pull request #8389 from Microsoft/make-object-literal-this-any-typed
Make `this` in object literal always of type `any`
2016-04-29 19:15:04 -07:00
Anders Hejlsberg f0e2d817ca Merge pull request #8390 from Microsoft/narrowingOfDottedNames
Fix narrowing of dotted names
2016-04-29 16:58:29 -07:00
Anders Hejlsberg bd4923a295 Reset dotted name narrowed types when type guards affect base name 2016-04-29 16:20:21 -07:00
Nathan Shively-Sanders 0a2ba0cc15 Make this in object literal always of type any
Previously, `this` was implicitly typed by the shape of its containing object literal.
This is not correct for JavaScript-style inheritance uses of object literals, and the previous fix was not correct either.
So we're going back to `this: any` in object literals for now.
2016-04-29 15:36:29 -07:00
Anders Hejlsberg 798257cdde Merge pull request #8387 from Microsoft/controlFlowDestructuringParameter
Fix control flow analysis for destructuring parameters
2016-04-29 14:40:29 -07:00
Anders Hejlsberg bd08e882fa Correct handling of destructuring parameters in control flow analysis 2016-04-29 13:57:28 -07:00
Nathan Shively-Sanders c12cb83fb7 Type 'this' in object literal function properties
Previously, methods of object literals would give a type to 'this'.
Now function properties of object literals also give a type to 'this'.
2016-04-29 10:31:01 -07:00
Nathan Shively-Sanders 9f7621c7e2 Contextual signatures without thisType return anyType
If a contextual signature is found, if its thisType is undefined, then the contextual type of `this` is now `any`.
Previously `checkThisExpression` would keep looking for a different type for `this`.

Also update tests to show this new behaviour.
2016-04-28 14:17:11 -07:00
Nathan Shively-Sanders 88854d2c0f Address PR comments.
1. Remove intersection code. The any-defaulting code means that it's never hit.
2. Remove some code duplication.
2016-04-28 13:17:06 -07:00
Nathan Shively-Sanders 3a74f483ba this in object literals intersects contextual type and literal type 2016-04-28 10:09:04 -07:00
Anders Hejlsberg 8cd32535ac Display the name 'nothing' for the empty union type 2016-04-27 13:54:40 -07:00
Anders Hejlsberg 700435bb8e Properly display narrowed types when hovering in IDE 2016-04-26 17:32:00 -07:00
Anders Hejlsberg ecc936167f Variable of type any has initial type any in control flow analysis 2016-04-25 17:22:06 -07:00
Anders Hejlsberg b88269bace Cache control flow types only at loop-back junctions 2016-04-25 11:23:56 -07:00
Anders Hejlsberg 5ed6f30f1f Merge pull request #8010 from Microsoft/controlFlowTypes
Control flow based type analysis
2016-04-22 14:18:56 -07:00
Anders Hejlsberg f06d3f6981 Only narrow to {} in getNarrowedType when types are completely unrelated 2016-04-22 06:52:14 -07:00
Anders Hejlsberg e12b2a7d27 Correct issue with exported variables in code flow analysis 2016-04-21 16:06:05 -07:00
Anders Hejlsberg ab4b03983b Removing unused logic 2016-04-21 13:40:57 -07:00
Anders Hejlsberg 8a0bc3b992 Support assignments in truthiness type guards 2016-04-21 13:02:52 -07:00
Anders Hejlsberg a0101c0787 Improve consistency of instanceof and user defined type guards 2016-04-21 10:48:34 -07:00
Sheetal Nandi fba1dfb72b Merge pull request #8201 from Microsoft/jsDocCommentAndEmit
Do not emit transform rest parameter if its declared as rest parameter type through jsDoc comment
2016-04-20 10:24:18 -07:00
Anders Hejlsberg e9a7d3d98c Removing unused logic 2016-04-20 09:15:57 -07:00
Anders Hejlsberg ea96dfd364 Support comma operator in type guards 2016-04-20 06:59:28 -07:00
Sheetal Nandi 6f24144f05 Do not transform the emit of function with rest parameter unless declared in AST
Fixes #7749
2016-04-19 16:02:29 -07:00
Vladimir Matveev 950571b049 do not validate module names in augmentations defined in ambient context 2016-04-19 15:50:31 -07:00
Anders Hejlsberg c8bf6d821a Variables from different module declarations default to their declared type 2016-04-19 10:14:02 -07:00
Anders Hejlsberg d735b7acbf Variables from different source files default to their declared type 2016-04-19 10:04:17 -07:00
Anders Hejlsberg d28a4feeba typeof x === "function" type guards include Function interface 2016-04-18 16:58:22 -07:00
Anders Hejlsberg 87f55fa683 Only evaluate assigned type when declared type is a union type 2016-04-18 16:37:58 -07:00
Sheetal Nandi dc4871a12a Parenthesize the fn or constructor type with type parameter when writing it in type argument
Fixes #8105
2016-04-18 15:44:40 -07:00
Anders Hejlsberg b83dc88f9b Improve expression type caching to ensure consistent results 2016-04-18 13:51:40 -07:00
Daniel Rosenwasser 25d7229cbb O -> Of 2016-04-18 10:08:48 -07:00
Daniel Rosenwasser c05fac72fb Use an element access when displaying literal members. 2016-04-16 18:46:27 -07:00
Anders Hejlsberg 921efec6b8 Improved handing of evolving types in iteration statements 2016-04-16 15:11:34 -07:00
Vladimir Matveev 79a3e77dd8 Merge pull request #8104 from Microsoft/newEntitiesInGlobalAugmentations
permit global augmentations to introduce new names
2016-04-15 15:09:22 -07:00
Daniel Rosenwasser 0cfe24ea47 Merge pull request #8051 from Microsoft/cannotExportName
Elaborate on the name of a declaration when telling users we can't export it
2016-04-15 14:31:36 -07:00
Vladimir Matveev 0f323ea74a allow top level 'import x = identifier | qname' in module augmentations 2016-04-14 17:57:17 -07:00
Vladimir Matveev 78177cfc2c permit global augmentations to introduce new names 2016-04-14 17:16:53 -07:00
Sheetal Nandi 41c1a5b497 Merge pull request #7945 from Microsoft/renameAndFindRef
Fixes rename for destructuring, named imports and default imports
2016-04-13 15:46:43 -07:00
Sheetal Nandi c492fc6369 Update the entry point to return property symbol of destructuring assignment 2016-04-13 14:50:41 -07:00
Anders Hejlsberg b689c07820 Improving error reporting as suggested in code review 2016-04-13 06:48:55 -07:00