Commit Graph

2891 Commits

Author SHA1 Message Date
Anders Hejlsberg
3a89c8cc5c Use isReachableFlowNode to check for implicit return 2019-09-13 14:38:12 -07:00
Anders Hejlsberg
5a180bac03 Merge branch 'master' into assertionsInControlFlow
# Conflicts:
#	tests/baselines/reference/api/tsserverlibrary.d.ts
#	tests/baselines/reference/api/typescript.d.ts
2019-09-10 22:47:15 -07:00
Anders Hejlsberg
21528748c6 Address CR feedback 2019-09-10 16:24:00 -07:00
Alexander T
f0e8518010 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-09-04 11:35:45 +03:00
Sheetal Nandi
0589d2dd1e Value for transpile option in CommandLineOption 2019-09-03 14:24:41 -07:00
Alexander T
049f5dacbf Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-23 14:18:27 +03:00
Jack Williams
ec39d41287 Change doc-string for Unreliable variance flag. (#33036) 2019-08-22 17:44:11 -07:00
Alexander T
acc653a23f Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-22 09:46:22 +03:00
Nathan Shively-Sanders
3c42760765 Cache JS inferred class type symbol (#33010)
* Cache JS inferred class type symbol

Note that many sources merge into a single target, so the *source*
[links] is the one that caches the merged target.

The reason this is a problem is not that many sources merge into a
single target, but that both getTypeOfSymbol and getDeclaredTypeOfSymbol
end up calling mergeJSSymbols with the same [source,target] pair. The
merge should not happen twice.

* Remove more verbose debug assertion message

* Fix isJSConstructor check + update baselines

* inferClassSymbol cache now track multiple targets
2019-08-21 15:36:35 -07:00
Alexander T
fea9e11174 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-20 11:07:18 +03:00
Nathan Shively-Sanders
6ca9d04b60 Constructor functions as classes (#32944)
* Initial implementation

The original test passes but I haven't run any other tests yet, so I
assume the world is now broken.

* Append constructor function construct sigs

Instead of overwriting them

* Grab bag of improvements.

1. Mark @class-tagged functions with Class too.
2. Only gather local type parameters of constructor functions.
3. Remove getJSClassType calls with getDeclaredTypeOfSymbol.
4. Add a couple more failing tests.

getDeclaredTypeOfClassOrInterface now needs to understand prototype
assignment. That's next, I think.

* Prototype assignments work now

1. Binder marks prototype assignments as Class now.
2. Checker merges prototype assignments using the same merge code as for
functions and their declarations. No more intersections.

Many fewer failing tests now.

* Mark prototype-property assignments as Class

Even if there are no this-property assignments in them. (Then why are
you using a class?).

* Simplify getJSClassType, remove calls to its guts

It's probably not needed because now it's just a conditional call to
getDeclaredTypeOfSymbol, and I think most callers already know whether
they have a JS constructor function beforehand.

* isJSDocConstructor doesn't need to check prototype anymore

Because all the properties are merged during getDeclaredTypeOfSymbol.

* outer type parameter lookup follow prototype assignment

* this-type and -expression support in ctor funcs

Pretty cool!

* Fix remaining tests

* Fix minor lint

* Delete now-unused code

* Add class flag to nested class declarations

Also remove old TODOs
2019-08-19 14:12:53 -07:00
Alexander T
fd72a1c76b @typescript-eslint/unified-signatures 2019-08-19 13:38:58 +03:00
Alexander
a7f41621fb Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-17 16:37:39 +03:00
Anders Hejlsberg
0599f84857 Support 'asserts this' and 'asserts this is T' type predicates 2019-08-17 06:23:07 -07:00
Anders Hejlsberg
489abcacd4 Merge pull request #32919 from microsoft/fix32752
Stricter criteria for eliminating types in unions during inference
2019-08-16 10:55:48 -07:00
Alexander T
b6d981aec8 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-16 12:13:57 +03:00
Anders Hejlsberg
abc61a0949 Add InferencePriority.Circularity per CR feedback 2019-08-15 18:08:01 -07:00
Ryan Cavanaugh
0bc3468733 small refactor to cut back on type assertions (#32920) 2019-08-15 15:18:27 -07:00
Anders Hejlsberg
a81ce061de Stricter criteria for eliminating types in unions during inference 2019-08-15 08:55:50 -07:00
Alexander T
f20a2828f2 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-15 10:32:45 +03:00
Alexander T
21d296b0cf set augmentations, moduleAugmentations as readonly 2019-08-15 09:55:10 +03:00
Sheetal Nandi
31a26120f9 Merge pull request #32788 from microsoft/tsbuildFixes
Fixes for tsbuild scenarios
2019-08-14 09:07:24 -07:00
Alexander T
b728bf4bfa Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-14 13:42:02 +03:00
Wesley Wigham
602966ba4e Fix references to path-mapped ambient modules in declaration files (#32878)
* Fix references to path-mapped ambient modules in declaration files

* Fix lint
2019-08-13 16:34:03 -07:00
Ron Buckton
a74f109f95 Do not escape actual template literals on emit (#32844) 2019-08-13 15:54:35 -07:00
Wesley Wigham
4ab85bbf35 Add error message for keywords with escapes in them (#32718)
* Add error message for keywords with escapes in them

* Move check into parser during advance to next token to utilize context for contextual keywords

* git add .

* Add tests for extended escapes

* Better error courtesy of @DanielRossenwaser

* Add test of browser-inconsistent case and alter condition to match spec

* Merge adjacent conditions

* Use seperate functions for checking keywords vs not

* Use flags to track unicode escape presence

* Adjust error text
2019-08-12 16:00:38 -07:00
Ron Buckton
bf054ae796 Add support for import.meta in System modules (#32797) 2019-08-12 13:00:58 -07:00
Alexander
23a3b340b0 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-10 09:58:25 +03:00
Anders Hejlsberg
9791f1d28f Merge branch 'master' into assertionsInControlFlow
# Conflicts:
#	tests/baselines/reference/api/tsserverlibrary.d.ts
#	tests/baselines/reference/api/typescript.d.ts
2019-08-10 08:50:42 +02:00
Anders Hejlsberg
cdeddf14e9 Call getResolvedSignature only when needed for generics or overloads 2019-08-10 08:38:18 +02:00
Orta
2a2866c3a9 Merge pull request #32563 from orta/fix_31298
Handle namepaths inside JSDoc type expressions a bit better
2019-08-09 16:15:50 -07:00
Wesley Wigham
f2719f95b4 Allow functions and ambient classes to merge (#32584) 2019-08-09 16:10:10 -07:00
Sheetal Nandi
8ac45805c0 Add error related to file not in rootDir and file not part of included root files at the references 2019-08-09 14:19:40 -07:00
Ron Buckton
05af8faac6 Support tree-shakable imports for --target es2015 (#32742)
* Support tree-shakable imports for --target es2015

* Alias external helper imports for --module es2015
2019-08-09 14:02:18 -07:00
Sheetal Nandi
94d54b967d Circular reference in the build queue is build stoppable error 2019-08-09 13:38:25 -07:00
Anders Hejlsberg
259ba77346 Merge branch 'master' into assertionsInControlFlow 2019-08-09 18:33:15 +02:00
Anders Hejlsberg
19f1d3ba0a Less aggressive monomorphism for flow nodes 2019-08-09 12:35:28 +02:00
Anders Hejlsberg
99ab53edcd Make flow nodes more monomorphic 2019-08-09 10:15:47 +02:00
Alexander
ceccfd8867 array-type: [ default: array, generic: array ] 2019-08-08 21:30:18 +03:00
Anders Hejlsberg
df02ad6e59 Reflect control flow effects of calls to never-returning functions 2019-08-08 10:48:45 +02:00
Orta Therox
487e2ffe2a Merge master 2019-08-06 15:34:06 -04:00
Alexander
a292ae1789 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-04 15:35:41 +03:00
Alexander
a37d34a5b6 lint src/, scripts/ folders separately 2019-08-04 15:33:01 +03:00
Alexander T
afafd3fcb3 simple-indent 2019-08-04 08:45:14 +03:00
Anders Hejlsberg
1f5bb970d9 Remove unused code 2019-08-03 08:28:53 -07:00
Anders Hejlsberg
77f2a412e1 Support 'asserts' type predicates in control flow analysis 2019-08-02 17:57:26 -07:00
Wesley Wigham
6b4f730535 Fix binding of jsdoc typedefs with no in-comment name attached to an expression statement (#32610)
* Fix binding of jsdoc typedefs with no in-comment name attached to an expression statement

* Check toplevel flag before bind

* Small renames
2019-08-02 16:14:19 -07:00
Anders Hejlsberg
e89acb6358 Reflect effects of assertion calls in control flow analysis 2019-07-31 16:30:54 -07:00
Sheetal Nandi
c25e7dd873 Wire in compilerOptions of the program in to the host's resolveModuleNames and resolveTypeReferenceDirectives api
Fixes #31056
2019-07-31 12:01:49 -07:00
Alexander T
1b4dfbc7d6 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-07-29 18:39:29 +03:00