Commit Graph

7151 Commits

Author SHA1 Message Date
Anders Hejlsberg
a712344733 Add tests 2018-02-03 09:44:47 -08:00
Anders Hejlsberg
7034d671db Merge branch 'conditionalTypes' into inferTypes 2018-02-03 08:41:54 -08:00
Anders Hejlsberg
d4dc67aab2 Merge branch 'master' into conditionalTypes
# Conflicts:
#	src/compiler/checker.ts
2018-02-03 07:26:38 -08:00
Wesley Wigham
89de4c9a3a Only apply global augmentations before globals are available (#21563)
* Only apply global augmentations before globals are available

* Add detailed comment explaining the split of global/nonglobal augmentations

* Remove trailing whitespace
2018-02-02 18:44:54 -08:00
Nathan Shively-Sanders
be0fcd5174 Array.concat now takes ConcatArray, not ReadonlyArray (#21462)
* Overloads in Array.concat now handle ReadonlyArray

Previously it was union types, which is slower.

* Make arrayConcat3 test stricter

* Switch to InputArray instead of adding overloads

* Update baselines

* Update baselines correctly

* Rename to ConcatArray and add slice method

Should make it, respectively, easier to understand this specific type
and harder to satisfy it by mistake.
2018-02-02 13:20:40 -08:00
Wesley Wigham
2c3b69336f Collect import helper needs during module info gathering (#21567)
* Collect import helper needs during module info gathering

* Add tests for other forms that trigger import helpers
2018-02-02 13:17:39 -08:00
Wesley Wigham
b3ec8cce00 Leverage existing function for choosing spread validity (#21564) 2018-02-02 10:11:50 -08:00
Wesley Wigham
8b81d19b6d Enable CFA on this keyword unconditionally (#21490) 2018-02-02 00:30:03 -08:00
Wesley Wigham
aa5272dc89 Create import helpers for named imports if they contain default imports (#21550) 2018-02-01 15:38:18 -08:00
Wesley Wigham
421c927150 Add formik to the user suite (#21381)
* Add formik to user suite

* Accept current log
2018-02-01 12:52:51 -08:00
Wesley Wigham
a33dae3771 Rework how default vs local name selection is done to be more correct (#21526) 2018-02-01 12:34:25 -08:00
Wesley Wigham
058b2f7f11 Allow boolean literals to be generated from contextual types again (#21503)
* Allow boolean literals to be generated from contextual types again

* Update fourslash test
2018-02-01 12:34:16 -08:00
Andrew Casey
02972899d7 Merge pull request #21379 from amcasey/HighlightingAssert
Check syntax kind in isDeclarationNameOrImportPropertyName
2018-02-01 10:11:10 -08:00
Andy
df15d5b977 Don't treat class name contextToken as a completion list blocker if it is not the previousToken (#21534) 2018-02-01 09:24:57 -08:00
Andrew Casey
cd0000110d Add FAR test 2018-01-31 11:12:09 -08:00
Anders Hejlsberg
afec056bab Add more error case checks 2018-01-31 07:48:45 -08:00
Wesley Wigham
c161c22d89 Avoid crashing when a source file is attempted to merge with another declaration (#21494) 2018-01-30 15:02:20 -08:00
Anders Hejlsberg
7c241ba2f7 Merge branch 'conditionalTypes' into inferTypes
# Conflicts:
#	src/compiler/checker.ts
#	tests/cases/fourslash/completionInJSDocFunctionNew.ts
#	tests/cases/fourslash/completionInJSDocFunctionThis.ts
2018-01-30 13:40:16 -08:00
Andrew Casey
3020f3d2e6 Handle trivia in code fix forgotten-this
Fixes #21433
2018-01-30 13:25:39 -08:00
Wesley Wigham
b0ea899d13 Use the full local file path as the id for a submodule (#21471)
* Use the full file path as the id for a submodule

* Informal code review feedback
2018-01-30 11:09:48 -08:00
Anders Hejlsberg
34505c1019 Add tests 2018-01-30 08:11:49 -08:00
Anders Hejlsberg
4f2b5f32f9 Merge branch 'master' into conditionalTypes 2018-01-30 06:42:14 -08:00
Matt McCutchen
f0ba16c9a5 Unused type parameters should be checked by --noUnusedParameters, not (#21167)
--noUnusedLocals.

Fixes #20568.
2018-01-25 16:18:35 -08:00
Nathan Shively-Sanders
b80081d0cb Merge pull request #21285 from Microsoft/nested-excess-property-checking-for-discriminated-unions
Nested excess property checking for discriminated unions
2018-01-25 15:59:57 -08:00
Manoj Patel
afc588eb9e --emitDeclarationsOnly flag to enable declarations only output (#20735)
* Add emitOnlyDeclarations flag

* Fix name

* verifyOptions checking logic

* Passing tests

* doJsEmitBaseline

* Tests !!!
2018-01-25 15:35:18 -08:00
Nathan Shively-Sanders
6087aaa297 Merge branch 'master' into nested-excess-property-checking-for-discriminated-unions 2018-01-25 15:32:53 -08:00
Andy
7c4e755eff When applying // @ts-ignore fix as a group, apply to a line only once. (#21413)
* When applying `// @ts-ignore` fix as a group, apply to a line only once.

* Rename line to lineNumber
2018-01-25 13:53:08 -08:00
Anders Hejlsberg
490d6568f9 Remove pointless fourslash tests 2018-01-25 12:25:56 -08:00
Andy
dcd3b5e1f7 At <div x=/**/, completion insertText should be wrapped in braces (#21372) 2018-01-25 09:02:20 -08:00
Andy
0b7f6d5911 Fix bug: Support this. completions even when isGlobalCompletion is false (#21330) 2018-01-25 07:42:01 -08:00
Ron Buckton
5698a6ab52 Fix loop labels for for..await 2018-01-25 02:11:01 -08:00
Andy
d333d889c1 Test for (and fix) order of import fixes (#21398) 2018-01-24 15:06:52 -08:00
Wesley Wigham
ba797f2c50 Add flag to skip qualification check when symbol is already in the process of being qualified (#21337) 2018-01-24 12:37:45 -08:00
Andrew Casey
6c9b2d9de9 Check syntax kind in isDeclarationNameOrImportPropertyName
Otherwise, keywords are accepted. Assert was

```
fail (e:\ts_gh\src\compiler\core.ts:2867)
assert (e:\ts_gh\src\compiler\core.ts:2837)
isExportSpecifierAlias (e:\ts_gh\src\services\findAllReferences.ts:931)
getLocalSymbolForExportSpecifier
(e:\ts_gh\src\services\findAllReferences.ts:926)
skipPastExportOrImportSpecifierOrUnion
(e:\ts_gh\src\services\findAllReferences.ts:411)
getReferencedSymbolsForSymbol
(e:\ts_gh\src\services\findAllReferences.ts:359)
getReferencedSymbolsForNode
(e:\ts_gh\src\services\findAllReferences.ts:271)
getReferenceEntriesForNode
(e:\ts_gh\src\services\findAllReferences.ts:91)
getSemanticDocumentHighlights
(e:\ts_gh\src\services\documentHighlights.ts:25)
getDocumentHighlights (e:\ts_gh\src\services\documentHighlights.ts:13)
getDocumentHighlights (e:\ts_gh\src\services\services.ts:1584)
getOccurrencesAtPositionCore (e:\ts_gh\src\services\services.ts:1588)
getOccurrencesAtPosition (e:\ts_gh\src\services\services.ts:1567)
Session.getOccurrences (e:\ts_gh\src\server\session.ts:718)
Session.handlers.ts.createMapFromTemplate._a.(anonymous function)
(e:\ts_gh\src\server\session.ts:1999)
(anonymous function) (e:\ts_gh\src\server\session.ts:2079)
Session.executeWithRequestId (e:\ts_gh\src\server\session.ts:2069)
Session.executeCommand (e:\ts_gh\src\server\session.ts:2079)
Session.onMessage (e:\ts_gh\src\server\session.ts:2101)
(anonymous function) (e:\ts_gh\src\server\server.ts:593)
```
2018-01-23 15:51:23 -08:00
Andy
d4b3bd16c4 Add KeywordCompletionFilters.TypeKeywords (#21364) 2018-01-23 10:57:35 -08:00
Nathan Shively-Sanders
a3387cc41f Merge pull request #21328 from Lazarus535/master
Fixes #17080
2018-01-22 14:08:21 -08:00
Nathan Shively-Sanders
ae652404cd Fix JSX attribute checking when spreading unions
Previously, the code didn't account for the fact that spreading a union
creates a union. In fact, before Decemeber, spreading a union in JSX
didn't create a union.

Now the check for properties of the spread type uses
`getPropertiesOfType`, which works with unions, instead of accessing the
`properties` property directly.
2018-01-22 13:34:12 -08:00
Nathan Shively-Sanders
97fb0fd55f Add semicolon to unused class member list
Turns out SemicolonClassElement is a specific kind for semicolons inside
a class. Having one of them with --noUnusedLocals on would crash the
compiler after the assert added in #21013.
2018-01-22 12:59:53 -08:00
Stephan Ginthör
b9a2d7f0ef Merge branch 'master' of https://github.com/Microsoft/TypeScript 2018-01-22 21:47:12 +01:00
Stephan Ginthör
d11341820e Fixes #17080
Fixed the two requested changes.
1) Deleting the file "pull_request_template.md"
2) Declaring functions in tests, instead of defining
2018-01-22 21:45:37 +01:00
Andy
588716926d Fix bug: result of createUnionOrIntersectionProperty may be undefined (#21332) 2018-01-22 10:15:57 -08:00
Stephan Ginthör
5a87a94c59 Fixes #17080
https://github.com/Microsoft/TypeScript/issues/17080
Added testcases from the Github bugreport (all working as intended now).
Signed CLA.
2018-01-22 13:40:57 +01:00
Stephan Ginthör
18e1ac0306 Fixes #17080
Changes are in src/compiler.checker.ts only
The second arguments to the function "removeOptionalityFromDeclaredType" has been changed from "getRootDeclaration(declaration)" to "declaration".
2018-01-22 09:52:58 +01:00
Esakki Raj
92bde084c1 Fix formatting between for and await (#21254)
* Fix issue 21084

* Removed unwanted rules.
2018-01-21 09:45:58 -08:00
Anders Hejlsberg
eb314d00fc Add tests 2018-01-20 08:17:59 -08:00
Wenlu Wang
d1ff12e0a6 add completion filter for function like body (#21257) 2018-01-19 17:26:58 -08:00
Wesley Wigham
d4c36120cf Make nonnull assertions and binding patterns apparent declared type locations (#20995)
* Use apparent type of original type to handle indexes

* Redo older fix causing new bug by extending getDeclaredOrApparentType instead of getTypeWithFacts

* Rename symbol
2018-01-19 16:06:42 -08:00
Andy
6224d51f84 For { type: "a" } | { type: "b" }, find references for the union property (#21298) 2018-01-19 16:04:30 -08:00
Nathan Shively-Sanders
eed85737b8 Merge pull request #21271 from Microsoft/infer-keyof-to-any-not-empty
Inference of string literals to keyof creates an object with props of type `any`, not `{}`
2018-01-19 13:35:22 -08:00
Nathan Shively-Sanders
4632ed6dda Merge pull request #21242 from Microsoft/fix-indexed-access-relation
Fix indexed access relation
2018-01-19 13:13:14 -08:00