Commit Graph
2787 Commits
Author SHA1 Message Date
Sheetal Nandi fecafebf76 Add getParsedCommandLine optional method on compiler host to be able to provide parsedCommandLine instead of redoing work 2019-04-24 11:57:49 -07:00
David Sherret 8fc6640f55 Rename _objectLiteralBrandBrand to _objectLiteralBrand. (#30797) 2019-04-23 14:33:54 -07:00
Andrew Branch b6a0988052 Merge pull request #30776 from andrewbranch/feature/10178
Add flag to allow access to UMD globals from modules
2019-04-18 18:05:44 -07:00
Nathan Shively-Sanders c3a9429420 Handle JSDoc backticks in the parser, not scanner (#30939)
* Scan backticks in jsdoc as a single token less often

Previously, matching backticks in jsdoc would always be scanned as one
token to aid parsing incorrect jsdoc that uses backticks for parameter
names:

``js
/** @param {string} `nope`
 * @param {number} `not needed`
 */
```

However, this is wrong for code fences, which use triple backticks. This
fix parses a single backtick as a single token if it's immediately
followed by another backtick or by a newline. It retains the
questionable tokenisation of backticks-as-pairs in other cases, however.
A better fix might be to have the parser ignore backticks in jsdoc
instead.

* Add test case

* Handle jsdoc backticks in the parser, not scanner

Previously, the jsdoc scanner had ad-hoc handling of backticks that was
similar in structure to the normal scanner's handling, but much simpler.
This was a smaller code change, but is handled backwards: the special
case of backtick-quoted parameter names was handled in the scanner
instead of in the jsdoc identifier parsing code. That made it overapply
and block correct handling of asterisks across newlines, which was most
obvious in code fences inside jsdoc, as in #23517.

Fixes #23517

* More cleanup
2019-04-18 09:35:40 -07:00
Sheetal Nandi b9145f98e1 Merge pull request #30980 from Microsoft/configChangeForEmit
Make sure to emit again if change in compiler option affects emit
2019-04-17 15:14:12 -07:00
Nathan Shively-Sanders 4420d1083b Add diagnostics for relation cache size (#30999)
* Add diagnostics for relation cache size

* Move to extendedDiagnostics

* Single method that returns a 3-property object

* Fix double-space lint
2019-04-17 14:32:18 -07:00
Wesley Wigham 169e485d90 Perform excess property checking on intersection and union members (#30853)
* Perform excess property checking on intersection and union members

* Allow partial union props to contain the undefined type

* Add test case from #30771

* Un-terse getPossiblePropertiesOfUnionType side-effecting code

* Fix bug exposed in RWC

* Cache results of getPossiblePropertiesOfUnionType

* Fix whitespace
2019-04-16 21:58:48 -07:00
Sheetal Nandi 15ae8a7273 Make sure to emit again if change in compiler option affects emit
Fixes #30736
2019-04-16 16:18:37 -07:00
Anders Hejlsberg 6cd229b4b9 Merge pull request #30769 from Microsoft/saferIndexedAccessTypes
Improve soundness of indexed access types
2019-04-12 07:33:50 -10:00
Anders Hejlsberg 411e7144a9 Add new nonInferrableType with ObjectFlags.NonInferrableType 2019-04-10 16:53:38 -10:00
Andrew Branch 2ee93bf0f2 Add allowUmdGlobalAccess flag 2019-04-08 09:46:46 -07:00
Anders Hejlsberg 294580287d Merge branch 'master' into saferIndexedAccessTypes 2019-04-05 16:23:48 -10:00
Wesley Wigham ca98a50574 Use const contexts and tuple mapped types to simplify some explicitly elucidated types (#30654)
* Use const contexts and tuple mapped types to simplify some explicitly elucidated types

* Fix lint

* Further cleanup - refactor mapped type into its own alias for readability

* Slightly more cleanup - PragmaPsuedoMap neednt be partial, thus removing tons of nonull assertions

* Remove GH#18217 comments
2019-04-02 13:04:51 -07:00
Anders Hejlsberg fc95dc42f9 Improve soundness of indexed access type relations 2019-03-29 13:00:00 -07:00
Wesley Wigham b7881a26a0 Unify substitution type any handling into costruction and instantiation (#30592)
* Unify substitution type `any` handling into costruction and instantiation

* Strengthen supertype reduction check to reduce breakage

* Rename conditional type fields per convention

* Explicitly handle anyish signatures in compareSignaturesRelated so strict variance doesnt kill subtyping

* Allow tuple expansions to an `any` rest to be considered an `any` signature as well
2019-03-27 12:55:17 -07:00
Sheetal Nandi 8da384d32a Report output file not built error for any module resolution that ends up to source file
Fixes #29918
2019-03-21 08:55:12 -07:00
Gabriela Britto 10b9051624 Fix convert to named parameters rest parameter tuple (#30286)
* check if rest parameter is of tuple type in isOptionalParameter

* expose isArrayType and isTupleType in checker

* don't offer refactor if rest parameter type is neither array nor tuple type

* add tests for rest parameters

* fix tests for renamed refactor

* remove unnecessary conditional operator
2019-03-18 10:31:38 -07:00
Anders Hejlsberg d0646a629a Merge pull request #30084 from dragomirtitian/GH-26563
Improved argument description for parameters originating from tuples
2019-03-18 06:14:52 -10:00
Sheetal Nandi bd229b5ed1 Exclude Json files from Project reference redirects from files to be emitted list
Fixes #30382
2019-03-14 11:22:26 -07:00
Anders Hejlsberg ba95fcac87 Merge pull request #30334 from Microsoft/inferenceContextCleanup
Revise InferenceContext implementation
2019-03-12 10:13:55 -07:00
Anders Hejlsberg de3f5f90cd Remove redundant typeParameters property from InferenceContext 2019-03-12 06:17:33 -07:00
Wenlu Wang b97b1a8de6 add jsx factory and hold text in jsxtext node (#29439)
* add jsx factory and hold text in jsxtext node

* update jsxtext prop name and factory
2019-03-11 16:00:18 -07:00
Anders Hejlsberg af8cf90e49 InferenceContext has-a (not is-a) mapper and has-a new nonFixingMapper 2019-03-11 15:56:03 -07:00
Anders Hejlsberg 42b6ef0c96 Rename contextualMapper to inferenceContext (which it always is) 2019-03-11 06:45:26 -07:00
Titian Cernicova-Dragomir d433042386 Fixed isVariadic handling when signature parameters are expanded for itemInfoForParameters 2019-03-11 02:55:10 +02:00
Titian Cernicova-Dragomir 88babf2a90 Merge remote-tracking branch 'remotes/origin/master' into GH-26563 2019-03-11 02:31:07 +02:00
Anders Hejlsberg 79813b8ece Show expanded parameter lists in signature help 2019-03-09 12:23:57 -08:00
Sheetal Nandi 97fbc87e98 Merge pull request #29813 from Microsoft/incrementalBuildInfo
Build .tsbuildinfo file when building using tsc --b
2019-03-08 15:49:44 -08:00
Ron Buckton 6607e00b8f Merge pull request #30259 from Microsoft/transformFlagCleanup
Transform flag cleanup
2019-03-08 15:08:26 -08:00
Sheetal Nandi 409d6c911e Add compiler version to buildInfo 2019-03-08 13:32:43 -08:00
Sheetal Nandi 990b199ebd Merge branch 'master' into incrementalBuildInfo 2019-03-08 11:42:19 -08:00
Ron Buckton 1c0f9a8ce3 Renumber transform flags 2019-03-07 10:52:17 -08:00
Ron Buckton 8e5178d6e6 Merge branch 'master' into transformFlagCleanup 2019-03-07 10:46:38 -08:00
Ron Buckton 1f212ec265 Remove DestructuringAssignment and Generator flags 2019-03-06 15:04:13 -08:00
Ron Buckton cc9e2f4e57 Remove Super/ContainsSuper transform flags 2019-03-06 14:33:42 -08:00
Ron Buckton 2fb0b85cf0 Restore ContainsLexicalThsi flag for performance 2019-03-06 11:34:28 -08:00
Anders Hejlsberg ad823daabb Consistently defer generic functions to second type inference pass 2019-03-05 06:09:54 -08:00
Anders Hejlsberg c344ef3123 Infer higher order function types when possible 2019-03-03 14:34:38 -08:00
Sheetal Nandi cd195c91c6 Add options tsBuildInfoFile to provide name for the buildinfo file 2019-03-01 10:28:57 -08:00
Sheetal Nandi d53efdf380 Changes to generation of .tsbuildinfo:
- If composite or incremental then only the .tsbuildinfo will be generated
- if --out or --outFile the file is outputFile.tsbuildinfo
- if rootDir and outDir then outdir/relativePathOfConfigFromRootDir/configname.tsbuildinfo
- if just outDir then outDir/configname.tsbuild
- otherwise config.tsbuildinfo next to configFile
2019-02-28 13:46:26 -08:00
Sheetal Nandi ed35741b5f Merge branch 'master' into incrementalBuildInfo 2019-02-27 15:45:59 -08:00
Nathan Shively-Sanders be2db9db12 Add globalThis (#29332)
* Restore original code from bind-toplevel-this

With one or two additional comments

* Working in JS, but the symbol is not right.

Still need to

1. Make it work in Typescript.
2. Add test (and make them work) for the other uses of GlobalThis:
window, globalThis, etc.

* Check in TS also; update some tests

Lots of tests still fail, but all but 1 change so far has been correct.

* Update baselines

A couple of tests still fail and need to be fixed.

* Handle type references to globalThis

The type reference must be `typeof globalThis`. Just `globalThis` will
be treated as a value reference in type position -- an error.

* Restore former behaviour of implicitThis errors

I left the noImplicitThis rule for captured use of global this in an
arrow function, even though technically it isn't `any` any more --
it's typeof globalThis.  However, you should still use some other method
to access globals inside an arrow, because captured-global-this is super
confusing there.

* Test values with type globalThis

I ran into a problem with intersecting `Window & typeof globalThis`:

1. This adds a new index signature to Window, which is probably not
desired. In fact, with noImplicitAny, it's not desired on globalThis
either I think.
2. Adding this type requires editing TSJS-lib-generator, not this repo.

So I added the test cases and will probably update them later, when
those two problems are fixed.

* Add esnext declaration for globalThis

* Switch to symbol-based approach

I decided I didn't like the import-type-based approach.

Update baselines to reflect the difference.

* Do not suggest globals for completions at toplevel

* Add tests of element and property access

* Look up globalThis using normal resolution

globalThis is no longer constructed lazily. Its synthetic Identifier
node is also now more realistic.

* Update fourslash tests

* Add missed fourslash test update

* Remove esnext.globalthis.d.ts too

* Add chained globalThis self-lookup test

* Attempt at making globalThis readonly

In progress, had to interrupt for other work.

* Add/update tests

* Addres PR comments:

1. Add parameter to tryGetThisTypeAt to exclude globalThis.
2. Use combined Module flag instead combining them in-place.
3. SymbolDisplay doesn't print 'module globalThis' for this expressions
anymore.
2019-02-27 14:14:34 -08:00
Ron Buckton ad4cef01a3 Removes 'TypeScript' transform flag 2019-02-25 13:26:44 -08:00
Titian Cernicova-Dragomir 8d66d55de1 Improved argument description for parameters originating from tuples that were extracted from functions. (ie mapped functions) 2019-02-25 18:18:00 +02:00
Sheetal Nandi 9fa28158bb Enable building typescript.d.ts with current source 2019-02-22 18:11:27 -08:00
Sheetal Nandi 9730cfa845 Dont emit sourceMapUrl from prepend text into the --out file 2019-02-22 14:39:47 -08:00
Sheetal Nandi e1b18ab5fb Merge branch 'master' into incrementalBuildInfo 2019-02-22 14:19:53 -08:00
Sheetal Nandi 1e24cd19a8 Allow empty own source files 2019-02-21 17:36:20 -08:00
Wenlu Wang 592396d40a expose token flags and numeric flags (#29897)
* expose token flags and numeric flags

* hide hide useless token flags
2019-02-21 15:09:37 -08:00
Sheetal Nandi 1c8970d30b Handle synthetic references better 2019-02-20 11:37:45 -08:00