Commit Graph
2362 Commits
Author SHA1 Message Date
AndyandGitHub 8518343dc8 Add isStringLiteralLike helper (#21953) 2018-02-14 13:25:04 -08:00
AndyandGitHub 8c2756fdf6 Support getting string literal completions based on a type argument constraint (#21168)
* Support getting string literal completions based on a type argument constraint

* Fix bug: look for require call before argument info

* Code review

* @sandersn code review

* Remove test cast

* Reduce completions.ts diff

* @weswigham review

* Remove getTypeArgumentConstraint's dependence on checkTypeArgumentConstraints

* Remove TODO
2018-02-13 15:18:26 -08:00
Anders Hejlsberg a629acd8fd Allow +/- to prefix 'readonly' and '?' modifiers in mapped types 2018-02-12 16:20:49 -08:00
AndyandGitHub fca3db440c Give MethodDeclaration and MethodSignature parent types (#21892)
* Give MethodDeclaration and MethodSignature parent types
* And fix code that used MethodDeclaration for parameter that might be a MethodSignature

* Move type check back inside checkGrammarArrowFunction
2018-02-12 11:56:44 -08:00
Benjamin LichtmanandGitHub f989ef7261 Merge pull request #21004 from uniqueiniquity/updateATA
Enable typings cache entries to expire and be updated
2018-02-09 14:17:26 -08:00
Nathan Shively-SandersandGitHub 37f15ccb41 Print deferred mapped symbols 1 level deep (#21311)
* Print deferred mapped symbols 1 level deep

Previously, deferred mapped symbols would not print their type at all;
it would always print as `any`. This differed from the older behaviour
that printed it forever if necessary. As a compromise, we now print
deferred mapped symbosl 1 level deep before giving up and printing
`any`. This should cover the most common uses of mapped types.

* Use context flags instead of a global
2018-02-08 13:35:00 -08:00
Wesley WighamandGitHub 871e71d4ef Move insertSorted from server to core, use for diagnostic collections (#21401)
* Move insertSorted from server to core, use for diagnostic collections

* All keep the overall list sorted, too

* Increase timeout for js verification

* Use knowledge of how diagnostics are sorted to make all diagnostic list creation lazy and more efficient

* Staunchly avoid array allocation in favor of resizing an existing array
2018-02-07 17:00:59 -08:00
Ron BucktonandGitHub 3b73ce49d7 Merge pull request #21585 from Microsoft/fix21584
Fix initializer assignability for unique symbol
2018-02-06 11:30:12 -08:00
Wesley WighamandGitHub 17554ff285 Fix JSX contextual types to not eagerly become apparent, use 2-pass inference for JSX (#21383)
* Fix JSX contextual types to not eagerly become apparent

* Apply changes from code review, unify common code

* Fix jsx children contextual typing

* Light code review feedback

* Use fillMissingTypeArguments

* Accept nonliteral jsx child type

* Add test for the fillMissingTypeArguments case
2018-02-05 16:33:39 -08:00
Mohamed HegazyandGitHub 8f8fec433e Rename switch --emitDeclarationsOnly to --emitDeclarationOnly (#21651)
* Rename `--emitDeclarationsOnly` to `--renameDeclarationOnly`

* Rename test files
2018-02-05 14:48:50 -08:00
AndyandGitHub c7b86e824f EntityNameExpression doesn't need to include ParenthesizedExpression (#21588) 2018-02-05 14:22:03 -08:00
AndyandGitHub d584f4d97b Fix assertion: class reference location may be 'default' keyword instead of class name (#21630)
* Fix assertion: class reference location may be 'default' keyword instead of class name

* Update API baselines
2018-02-05 13:24:08 -08:00
Klaus MeinhardtandMohamed Hegazy c1a2adcea4 Fix return types of NodeBuilder methods (#21619) 2018-02-05 11:34:28 -08:00
Anders HejlsbergandGitHub e31b3e942b Merge pull request #21627 from Microsoft/fixExtendsNever
Fix 'T extends never' in conditional types
2018-02-05 11:21:06 -08:00
Anders Hejlsberg b8f3c6169b Use more permissive wildcard type in definitely false check 2018-02-05 06:48:29 -08:00
Anders Hejlsberg 503fc0642e Fix unintended sharing of typeParameters property in SymbolLinks 2018-02-03 14:45:01 -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
Ron Buckton 6f792f5aec Fix initializer assignability for unique symbol 2018-02-02 13:13:21 -08:00
Wesley WighamandGitHub a33dae3771 Rework how default vs local name selection is done to be more correct (#21526) 2018-02-01 12:34:25 -08:00
Sheetal Nandi cf540198e6 Always get diagnostics when emitting irrespective of whether its declaration only emit
The diagnostics reporting and expression resolution caching is quite intermingled at present.
Hence when we tried to get the declaration output without getting diagnostics, the resolution for functions return expression is cached but errors arent reported
Symbols arent marked as referenced. So at later time when trying to get the diagnostics since the expression resolution is cached, it doesnt even go through all checks
For now get diagnostics irrespective of declaration only output to avoid this issue.
Fixes #21518
2018-01-31 16:22:27 -08:00
Anders Hejlsberg 5702f61562 Always use strict rules for contravariant inferences 2018-01-31 07:48:15 -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
Anders Hejlsberg 4f2b5f32f9 Merge branch 'master' into conditionalTypes 2018-01-30 06:42:14 -08:00
Anders Hejlsberg edffb12054 Cache 'any' instantiations for faster conditional type resolution 2018-01-27 10:07:24 -08:00
Manoj PatelandMohamed Hegazy 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
Anders Hejlsberg d608941480 Implement type inference in conditional types 2018-01-25 12:25:00 -08:00
Anders Hejlsberg fc7d1c3948 Revise comments 2018-01-20 15:32:26 -08:00
Anders Hejlsberg 5204fd5c5f Add T is related to { [P in xxx]: T[P] } type relationship 2018-01-19 17:06:09 -08:00
Sheetal Nandi 2be231d339 Add createProgram on WatchCompilerHost 2018-01-19 15:52:21 -08:00
Anders Hejlsberg fd0dd6ed4c Separate code path for conditional type instantiation 2018-01-18 15:00:07 -08:00
Sheetal Nandi ed23ca582a Merge branch 'master' into builderApi 2018-01-17 16:11:44 -08:00
Anders Hejlsberg 4ec6fdd96f Merge branch 'master' into conditionalTypes
# Conflicts:
#	src/compiler/checker.ts
#	src/compiler/types.ts
#	tests/baselines/reference/api/tsserverlibrary.d.ts
#	tests/baselines/reference/api/typescript.d.ts
2018-01-17 13:12:36 -08:00
AndyandGitHub 8ed885db3e Add completions from the 'this' type (#21231)
* Add completions from the 'this' type

* Code review
2018-01-17 12:05:31 -08:00
Ron Buckton 4aca0c8121 Fix destructuring assignment when assignment target is RHS 2018-01-16 16:58:56 -08:00
Ron BucktonandGitHub cd525fb6de Merge pull request #21206 from Microsoft/fix20744
Fix temp variable emit for names used in nested classes
2018-01-16 16:00:24 -08:00
Anders Hejlsberg e96ec8c2c7 Erase substitution types in type references and type alias instantiations 2018-01-16 12:51:24 -08:00
Anders HejlsbergandGitHub 64b3086f5e Merge pull request #21157 from Microsoft/fixEmptyArrayInference
Fix empty array inference
2018-01-16 12:42:26 -08:00
Wesley WighamandGitHub 154c6141f1 Allow functions to be printed structurally in declaration emit even when they have symbols (#21203)
* Allow functions to be printed structurally in declaration emit even when they have symbols

* Implement CR feedback and fix lint
2018-01-16 12:37:15 -08:00
Ron Buckton 1785d87fda Fix temp variable emit for names used in nested classes 2018-01-16 12:33:55 -08:00
Sheetal Nandi 5bd3f97b18 Merge branch 'master' into builderApi 2018-01-16 11:14:39 -08:00
Wesley WighamandGitHub 76d9524866 Fully deprecate the symbol display builder, reimplement in terms of node builder (#18860)
* Remove SymbolWriter, give methods to EmitTextWriter

* Unification of writers is done-ish

* Make node builder support more flags

* Write out mixins like we used to

* Accept prototype-free baselines

* Use instantiated constraint when building mapped type nodes

* Accept better mapped type baselines

* Report inaccessible this in node builder

* Turns out there was a bug in our codefix, too

* Symbol display builder usage falling

* Replace signatureToString with a nodeBuilder solution

* Replace the last internal usages of the symbol writer

* Accept semicolon additions

* Accept updated symbol baseline output

* Start using node builder for some LS operations

* Remove those pesky trailing semicolons on signatures

* Get signature printing much closer to old output

* Parameter lists should not be indented by default, especially when single-line

* Signatures up to snuff

* Type quickinfo emit is up to snuff

* Start of symbol writer replacement, needs a bit more for full compat

* Slightly mor accurate to old behavior

* Replicate qualified name type argument output correctly

* Bring back the old symbol baselines

* Mostly identical to old symbol emit now

* Perfectly matches old behavior thus far

* Replace another usage of the symbol builder

* Another usage removed

* Another usage removed

* Remove final uses of symbol display builder

* Remove implementation and types for unused symbol display builder

* Cleanup in the checker

* monomorphize new emitter code

* Replace emitWithSuffix

* Push space character to interface with writer

* List emit

* Fix lack of usage of emitExpression

* writeList, not printList

* Remove listy writes and replace with new printer calls

* Move ListFormat into types.ts

* Remove most new XToString functions in favor of node builder functions

* Accept API breaks

* Add getSymbolDisplayBuilder polyfill

* Accept updated API baseline

* Move definition to make diff easier to read

* Reinternalize some things

* Remove trailign whitespace

* Reorder for zero diff

* Remove newline

* Make shim mor eperfectly imitate old behavior

* Style feedback

* Rename reset to clear to maintain backcompat with SymbolWriter

* Fix quickfix

* Keep EmitTextWriter internal

* Remove EmitTextWriter from public API

* Mimic default name declaration emit fix

* Fix tests broken by merge

* use isFunctionLike

* Cleanup, sync TypeFormat and NodeBuilder flags

* Reorder Node initialization so pos and end are first, so a TextRange hidden class is made first to reduce future polymorphism

* Use variable instead of ternary

* Write helper for emitNodeWithWriter

* Emitter cleanup

* Cleanup whitespace, comment

* Reuse printer

* Raise error if display parts writer uses rawWrite

* Hide writer parameter through different function instead of overload, rename function in emitter

* Make less printer

* fix lint
2018-01-16 09:53:42 -08:00
Anders Hejlsberg e8d1740da8 Introduce substitution types to use for constrained type parameters 2018-01-15 11:06:18 -08:00
Anders Hejlsberg 5094f7677c Remove 'T extends U' type constructor 2018-01-15 08:11:05 -08:00
Anders Hejlsberg 53b1572ed6 Revert to extends check being part of conditional type 2018-01-15 07:59:46 -08:00
Wesley WighamandGitHub 64305edbce Skip outer expressions when checking for super keyword in binder (#20164)
* Skip outter expressions when checking for super keyword in binder

* use TransformFlags to optimize and correct super call transforms

* Lint
2018-01-12 18:24:02 -08:00
Anders Hejlsberg 1ae0b461f8 Use contra-variant inferences when co-variant inferences yield 'never' 2018-01-11 16:14:19 -08:00
uniqueiniquity 9d298a13a1 [WIP] enable updating ATA files 2018-01-11 12:58:21 -08:00
Sheetal Nandi 69bb5ea8f0 Do not trigger the failed lookup location invalidation for creation of program emit files
Handles #20934
2018-01-11 12:34:58 -08:00
AndyandGitHub 8bce69e6bd Add refactoring to convert CommonJS module to ES6 module (#19916)
* Add refactoring to convert CommonJS module to ES6 module

* Code review

* includeGlobals -> excludeGlobals

* Improve handling of `module.exports = require("...")`

* Allow NoSubstitutionTemplateLiteral as argument to createLiteral
2018-01-09 13:15:47 -08:00