Wesley Wigham
a792fbb1a1
Forcibly remove submodules
2020-02-27 14:30:50 -08:00
Wesley Wigham
0326534a2a
Update LKG ( #37087 )
2020-02-27 14:24:21 -08:00
csigs
d0c1a520b3
LEGO: Merge pull request 37089
...
LEGO: Merge pull request 37089
2020-02-27 14:11:21 -08:00
csigs
3d23f0888f
LEGO: check in for master to temporary branch.
2020-02-27 22:10:46 +00:00
Pathurs
5c85febb0c
Fix Get/Set being enumerable ( #32264 )
...
* Fix Get/Set being enumerable
fixes #3610
* fix tests
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-27 14:08:20 -08:00
Wesley Wigham
e7c578a67d
Reapply contextual type when recalculating array literals as tuples ( #37071 )
2020-02-27 14:02:28 -08:00
Eli Barzilay
e71614a185
Proper treatment of splicing tuples in array literals
...
Fixes #32465 .
After this was done, I continued to extend the implementation to handle
TupleLike types but it'ss broken since JS doesn't allow splicing
TupleLike values into array literals so pulled that out, and instead
keeping it for reference below. (It Includes tests, which are broken
too.)
modified src/compiler/checker.ts
@@ -22268,6 +22268,21 @@ namespace ts {
else hasNonEndingSpreadElement = true;
}
}
+ else if (spreadType && isTupleLikeType(spreadType)) {
+ let i = 0, tupleEltType: Type | undefined;
+ while (tupleEltType = getTypeOfPropertyOfType(spreadType, "" + i as __String)) {
+ elementTypes.push(tupleEltType);
+ i++;
+ }
+ const stringIndexInfo = getIndexInfoOfType(spreadType, IndexKind.String);
+ const numberIndexInfo = getIndexInfoOfType(spreadType, IndexKind.Number);
+ if (stringIndexInfo || numberIndexInfo) {
+ if (stringIndexInfo) elementTypes.push(stringIndexInfo.type);
+ if (numberIndexInfo) elementTypes.push(numberIndexInfo.type);
+ if (i === elementCount - 1) hasEndingSpreadElement = true;
+ else hasNonEndingSpreadElement = true;
+ }
+ }
else {
if (inDestructuringPattern && spreadType) {
// Given the following situation:
new file tests/cases/compiler/spliceTupleLikesWIntegers.ts
@@ -0,0 +1,23 @@
+declare const sb: { [0]: string, [1]: boolean };
+
+let k1: [number, string, boolean];
+k1 = [1, ...sb];
+
+let k2: [number, string, boolean, number];
+k2 = [1, ...sb, 1];
+
+// declare const sb_: [string, ...boolean[]];
+
+// let k3: [number, string, ...boolean[]];
+// k3 = [1, ...sb_];
+
+// declare const sbb_: [string, boolean, ...boolean[]];
+
+// let k4: [number, string, ...boolean[]];
+// k4 = [1, ...sbb_];
+
+// let k5: [number, string, boolean, ...boolean[]];
+// k5 = [1, ...sbb_];
+
+// let k6: [number, string, boolean, boolean, ...boolean[]];
+// k6 = [1, ...sbb_];
new file tests/cases/compiler/spliceTupleLikesWStrings.ts
@@ -0,0 +1,23 @@
+declare const sb: { 0: string, 1: boolean };
+
+let k1: [number, string, boolean];
+k1 = [1, ...sb];
+
+let k2: [number, string, boolean, number];
+k2 = [1, ...sb, 1];
+
+declare const sb_: { 0: string, [s: string]: (boolean|string) };
+
+let k3: [number, string, ...(boolean|string)[]];
+k3 = [1, ...sb_];
+
+declare const sbb_: { 0: string, 1: boolean, [s: string]: (boolean|string) };
+
+let k4: [number, string, boolean, ...(boolean|string)[]];
+k4 = [1, ...sbb_];
+
+// let k5: [number, string, boolean, ...(boolean|string)[]];
+// k5 = [1, ...sbb_];
+
+// let k6: [number, string, boolean, boolean, ...(boolean|string)[]];
+// k6 = [1, ...sbb_];
2020-02-27 16:43:29 -05:00
Nathan Shively-Sanders
6c5c48c74c
Exempt ambient [#]private from unused error ( #37050 )
...
* Exempt ambient [#]private from unused error
These declarations exist to create nominality so they _must_ be unused.
There should be no error for them.
* Switch to fourslash test
I don't know how to baseline suggestion diagnostics in the compiler
tests.
2020-02-27 13:18:43 -08:00
Ryan Cavanaugh
35aea8bbfa
Remove crashing diagnostic code that wasn't helping us ( #36913 )
2020-02-27 12:45:28 -08:00
Wesley Wigham
d33fb87da8
Include input PR title in bot PR title
2020-02-27 11:07:32 -08:00
Sheetal Nandi
188c3b7046
Measure module and type reference directive times ( #37054 )
2020-02-27 10:22:40 -08:00
Orta
e804dc8900
Update the authors script to generate the content of authors.md ( #36867 )
2020-02-27 12:47:09 -05:00
Orta
2c4155c351
Adds underlines to differences in strings ( #36409 )
2020-02-27 12:46:15 -05:00
Titian Cernicova-Dragomir
f883bf3acb
Adding support for @implements. ( #36292 )
...
* Adding support for @implements.
* Fixed code review issues for @implements, added some more tests.
* Fixed declaration emit for @interface
* Improved getImplementsTypes to not cache the results since it is only used once.
* Removed unnecessary checks from getImplementsTypes
2020-02-27 09:27:37 -08:00
csigs
e3ec3d1942
LEGO: Merge pull request 37080
...
LEGO: Merge pull request 37080
2020-02-27 08:11:08 -08:00
csigs
5d38883d14
LEGO: check in for master to temporary branch.
2020-02-27 16:10:31 +00:00
csigs
a6393b3b85
LEGO: Merge pull request 37074
...
LEGO: Merge pull request 37074
2020-02-27 02:11:09 -08:00
csigs
97157b460d
LEGO: check in for master to temporary branch.
2020-02-27 10:10:32 +00:00
Alexander T
baff821594
fix(36989): 'async' modifier cannot be used in an ambient context.ts ( #37010 )
...
* fix(36989): omit 'async' modifier for methods in declaration files.
* remove useless condition
2020-02-27 00:11:29 -08:00
csigs
60f50e22bb
LEGO: Merge pull request 37068
...
LEGO: Merge pull request 37068
2020-02-26 20:11:06 -08:00
csigs
91df1c8b53
LEGO: check in for master to temporary branch.
2020-02-27 04:10:29 +00:00
Sheetal Nandi
d07761fe39
Allow --composite false or --composite null on the command line ( #36997 )
...
* Add tests for specifying composite as command line option
* Allow passing --composite false on commandline
* Add test to verify tsc --composite false from command line
* Handle "undefined" as option value to be set to undefined for that option
* Support "null" as option to be converted to undefined which is normally end result from our config file as well
* Support null as option for any tsconfig only option as well, and dont support undefined
* Fix public api test case
* Validates objects instead of stringify result
* Add composite true to base source
2020-02-26 15:26:26 -08:00
Sheetal Nandi
05c9ec3f12
Remove unnecessary assert (since we allow already open file to be opened again even through openFile command - partially) from updateOpen command ( #37059 )
...
Fixes #35034
2020-02-26 15:25:51 -08:00
Ryan Cavanaugh
c4e96856ac
Detect circularities when removing 'undefined' from defaulted params ( #37023 )
...
Fixes #37008
Note that referencing a variable in its initializer is a TDZ error;
the OP report had OOB logic that prevented this in practice (?)
2020-02-26 14:59:04 -08:00
csigs
f7d2beb3f5
LEGO: Merge pull request 37058
...
LEGO: Merge pull request 37058
2020-02-26 14:11:15 -08:00
csigs
42058a89ab
LEGO: check in for master to temporary branch.
2020-02-26 22:10:40 +00:00
Andrew Casey
b424f36e9a
Expose call count for instantiateType in extendedDiagnostics ( #36797 )
...
* Expose call count for instantiateType in extendedDiagnostics
* Update API baselines
2020-02-26 12:55:28 -08:00
Nathan Shively-Sanders
3d63401b20
Update baseline ( #37049 )
2020-02-26 10:28:22 -08:00
Nathan Shively-Sanders
af901ba911
No error on this
exprs in static property inits ( #36781 )
...
No error on `this` expressions in static property declaration
initialisers when targetting ESNext and with useDefineForClassFields. In
this case the emit is correct and the types are correct, so the error
should not be issued.
2020-02-26 09:07:45 -08:00
Wesley Wigham
454cdb8279
Retain undefined initializations ( #36806 )
...
* Emit an export assignment even when the initializer is elided
* User a void 0; and elide assignments for enum/namespace-sourced exported variables
* HAHA, SIMPLIFY GREATLY
2020-02-26 08:48:18 -08:00
TypeScript Bot
56b6d0d666
Update user baselines ( #37033 )
2020-02-25 17:47:21 -08:00
Wesley Wigham
15dd0002ef
Unwrap substitutions both before _and_ after potential simplification ( #32116 )
...
* Unwrap substitutions both before _and_ after potential simplification
* Repeatedly unwrap/simplify until no more can be performed
* Use seperate loops for source and target to reduce redundant calls
* Move loop into function
* Inline worker
2020-02-25 17:36:56 -08:00
Wesley Wigham
4d5464e1f9
Revert "Support declaration emit for late bound element accesses assigned to functions in both TS and JS ( #36593 )" ( #37034 )
...
This reverts commit 3e4ce4777d
.
2020-02-25 16:40:38 -08:00
Anders Hejlsberg
9ed73ebbbf
Properly handle control flows from returns in try/catch within IIFE ( #36901 )
...
* Properly handle control flows from returns in try/catch within IIFE
* Accept new baselines
* Add tests
* Accept new baselines
* When end of finally is unreachable, end of try statement is too
* Add additional test case
2020-02-25 16:14:00 -08:00
Sheetal Nandi
e89df5ce6f
Handle getScriptVersion correctly to ensure program structure is checked correctly ( #36808 )
...
* Fix tests when there are project references but has disableSourceOfProjectReferenceRedirect
* Handle getScriptVersion correctly to ensure program structure is checked correctly
Fixes #36748
* Harness's language service host doesnt have getProjectVersion.
This means earlier we were creating fresh program everytime we did LS operation
Now we reuse same program, so quick info depends on order of quickinfo demands
* Because same program is used, it unvails a bug that if `export=` is evaluated before finding references, it cant find all definitions from the merge
* Update src/server/project.ts
Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Make clearSourceMapperCache required
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-25 16:11:21 -08:00
Wesley Wigham
e99173a6f9
Ignore data- props when excess property checking ( #36952 )
2020-02-25 15:52:24 -08:00
Wesley Wigham
d92aca2715
Reduce lerna loglevel ( #37024 )
...
* Reduce lerna loglevel
* Also add silent
2020-02-25 14:23:55 -08:00
Orta
8a797cad2b
Adds floating block comments to the outlining spans response ( #36880 )
...
* Adds floating block comments to the outlining spans response
* Only use one route for grabbing outline nodes, which now includes special casing the EOF token
2020-02-25 17:09:16 -05:00
Ryan Cavanaugh
43863cafe2
Check for undefined source.symbol
( #37021 )
...
Fixes #37014
2020-02-25 13:46:24 -08:00
Wesley Wigham
3e4ce4777d
Support declaration emit for late bound element accesses assigned to functions in both TS and JS ( #36593 )
2020-02-25 13:45:27 -08:00
Wesley Wigham
7d8dc730b7
Baseline arity checks for jsx sfc tags ( #36643 )
...
Finish comment
PR feedback
2020-02-25 13:44:22 -08:00
Wesley Wigham
e536c89872
Add js-equivalent test for the binary expression stress and introduce trampoline into getJSSyntacticDiagnosticsForFile ( #36724 )
...
* Add js-equivalent test for the binary expression stress and introduce trampiline into getJSSyntacticDiagnosticsForFile
* Update src/compiler/parser.ts
Comment text update
Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Fix lint
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-25 13:29:34 -08:00
Wesley Wigham
01f81dfc00
Add helpers to helper list, per comment on #36806
2020-02-25 11:46:05 -08:00
Ryan Cavanaugh
c22cdb446a
Harden telemetryOnOpenFile ( #36993 )
2020-02-25 11:32:32 -08:00
Wesley Wigham
e54b796301
Declare dependencies between helpers in the declaritive fashion introduced by #35967 ( #37001 )
2020-02-25 11:29:59 -08:00
Wesley Wigham
e120762390
Remove unneeded branch from getHelperName ( #36998 )
2020-02-25 11:29:45 -08:00
csigs
26184f0ec8
LEGO: Merge pull request 37018
...
LEGO: Merge pull request 37018
2020-02-25 08:11:01 -08:00
csigs
5af94fa0ca
LEGO: check in for master to temporary branch.
2020-02-25 16:10:24 +00:00
Ron Buckton
177713ef45
Switch Debug.assertX functions to use asserts conditions ( #36995 )
...
* Switch Debug.assertX functions to use asserts conditions
* Replace assert functions with ts.noop when assertion level too low
2020-02-24 18:20:58 -08:00
Andrew Casey
b5bd38bcdc
Convert UnionOrIntersectionType.couldContainTypeVariables to ObjectFlags ( #36947 )
...
...to save space (and possibly to reduce de-opts, since it appears to be
lazily set).
2020-02-24 18:18:39 -08:00