7371 Commits

Author SHA1 Message Date
Nathan Shively-Sanders
2d7efb35b1 Add test of stack overflow 2018-05-15 12:18:51 -07:00
Andy
149803bb12
Fix bug: don't insert a semicolon when inserting a FunctionDeclaration (#23240) (#23289) 2018-04-09 16:24:50 -07:00
Wesley Wigham
a94e318604
Only include unique symbols when getting index types for access checks (#23145) (#23175)
* Only include unique symbols when getting index types for access checks

* Filter all nonstrings

* Inline ternary
2018-04-05 12:12:44 -07:00
Nathan Shively-Sanders
16687e6ebf Fix crash in type resolution in JS IIFEs (#23171)
* Fix crash in type resolution in JS IIFEs

We recognise IIFEs as JS special assignment initialisers, but not as
containers otherwise. That means that IIFEs will not have a symbol
unless they have an *outside* assignment.

The permanent fix will be to make IIFEs a container, based on the
containership of the value that they return. This fix does not do that;
it just makes type resolution return undefined instead of crashing.

* Comment the IIFE-fix line
2018-04-05 09:57:56 -07:00
Andy
8717a7bcf1
Fix bug: <div a="1" b/**/ > is not a jsx initializer (#23138) (#23167)
* Fix bug: `<div a="1" b/**/ >` is not a jsx initializer (#23138)

* Don't use test feature only available in master branch
2018-04-05 09:17:34 -07:00
Anders Hejlsberg
d7c70fc6b7 Add regression test 2018-04-04 17:27:53 -07:00
Anders Hejlsberg
05e10eee30 Add regression test 2018-04-04 17:27:23 -07:00
Anders Hejlsberg
e0399855f4 Add tests 2018-04-04 17:26:58 -07:00
Anders Hejlsberg
c4e21c912e Add regression test 2018-04-04 17:26:31 -07:00
Anders Hejlsberg
8f25748334 Add another test 2018-04-04 17:25:51 -07:00
Anders Hejlsberg
228aff0cfb Add regression test 2018-04-04 17:25:44 -07:00
Wesley Wigham
4189b9cfad
Allow multiple class base types; intersect them, as with interfaces (#23123) (#23130) 2018-04-03 18:35:50 -07:00
Nathan Shively-Sanders
ad742c9f0f No error referring to UMD symbol in CommonJS modules (#23129) 2018-04-03 16:10:42 -07:00
Wesley Wigham
1c86d01b64
Actuallt preserve nonblock for of statements in forofs with object rest (#23122) (#23124) 2018-04-03 16:08:45 -07:00
Wesley Wigham
51b895c891
Consider jscontainer aliases as referencible even if they have other local meanings (#23119) (#23121) 2018-04-03 13:31:55 -07:00
Andy
d07102e567
Fix bug: don't return string literal completions if there's no contextual type (#23079) 2018-04-02 16:20:51 -07:00
Wesley Wigham
a9c5025664
Move JSX props support check and make syntactic (#22970) (#22996)
* Move JSX props support check and make syntactic

* Make parameter required
2018-03-29 13:50:05 -07:00
Wesley Wigham
0b2d6f6993
Dont let an import that doesnt need helpers override one that does (#22966) (#22990) 2018-03-29 11:58:20 -07:00
Sheetal Nandi
4fcf5bc225 Correct the incremental parsing when there is jsDoc node
Fixes #22924
2018-03-28 15:44:01 -07:00
Anders Hejlsberg
072401e29f Change test to use type variables 2018-03-28 12:06:04 -07:00
Anders Hejlsberg
7df518d61a Add tests 2018-03-28 12:05:51 -07:00
Anders Hejlsberg
3d04388907 Add tests 2018-03-28 12:05:47 -07:00
Anders Hejlsberg
61f3a829eb Add regression test 2018-03-28 12:05:11 -07:00
Matt Bierner
8dcbf6961e Fix completions and brace in empty file (#22620)
Fixes #22618
2018-03-28 12:04:03 -07:00
Matt Bierner
dc4001f41d Fix await code action crashes when await is not in a function (#22623)
Fixes #22614
2018-03-28 12:03:27 -07:00
Andy
77e8a69ab2
importFixes: Distinguish when we need to import JSX constructor or JSX namespace (#22828) (#22901) 2018-03-27 17:05:55 -07:00
Andy
c63b206d4f
Don't add external module completions in a pure commonjs file (#22583) (#22880) 2018-03-26 16:30:29 -07:00
Andy
cc67601b60
convertFunctionToEs6Class: Copy comments from constructor to class (#22738) (#22802) 2018-03-22 15:15:21 -07:00
Daniel Rosenwasser
e5f0385816
Merge pull request #22780 from Microsoft/fixInferDeclarationFiles-release-2.8
[release-2.8] Fix infer declaration files
2018-03-21 17:16:44 -07:00
Anders Hejlsberg
cf6f39f79d Add regression test 2018-03-21 15:53:30 -07:00
Anders Hejlsberg
02a3a74e3b Add regression test 2018-03-21 15:53:29 -07:00
Anders Hejlsberg
03c4809d5a Add test to verify errors on nested 'infer T' declarations 2018-03-21 15:53:28 -07:00
Anders Hejlsberg
1358091a30 Add test 2018-03-21 15:48:04 -07:00
Anders Hejlsberg
10a611371a Add tests 2018-03-21 15:48:02 -07:00
Nathan Shively-Sanders
c2e22dc469 Undo 'any' inference propagation (#22736)
* Undo 'any' inference propagation

Removing this only changes one test slightly, and fixes JQuery types,
which rely on the old method of inference.

* Add jquery regression test and update baselines

* Restore any inference propagation to wildcard only
2018-03-21 11:14:19 -07:00
Wesley Wigham
044cdbc85f Combine keyof T inferences (#22525)
* Combine keyof T inferences

* Extract covariant inference derivation into function

* Test:keyof inference lower priority than return inference

for #22376

* Update 'expected' comment in keyofInferenceLowerPriorityThanReturn

* Update comment in test too, not just baselines

* Fix typo

* Move tests
2018-03-19 17:59:06 -07:00
Nathan Shively-Sanders
ee8adaeac2 No error on unmatchable @param tags (#22510)
* No errr on unmatchable `@param` tags

Such as when the initializer is not a function, or when the function
mentions `arguments` in its body.

* Do not require dummy param for JS uses of arguments

1. JS functions that use `arguments` do not require a dummy parameter in
order to get a type for the synthetic `args` parameter if there is an
`@param` with a `...` type.
2.JS functions that use `arguments` and have an `@param` must have a
type that is a `...` type.

* Check for array type instead of syntactic `...`

* Address PR comments

* Update baselines
2018-03-14 11:06:25 -07:00
Nathan Shively-Sanders
bd94170b7f Brackets and postfix= in @param add undefined (#22514)
* Brackets and postfix= in `@param` add undefined

Previously they only added optionality.
Note that, unlike Typescript, when a parameter initializer is specified
in jsdoc, it does not remove undefined in the *body* of the function.
That's because TS will generate initialisation code, but JS won't, so
the author will have to manually write code to remove undefined from the
type.

```js
/** @param {number} [a=101] */
function f(a) {
  // a: number | undefined here
  if (!a) {
    a = 101
  }
  // a: number here
}
```

Note that we don't check that
1. the initializer value is actually assigned to the parameter.
2. the initializer's type matches the declared type of the parameter.

Pretty much we just parse it and leave it alone.

* Address PR comments
2018-03-13 15:57:55 -07:00
Sheetal Nandi
fa2b7ff6b3
Merge pull request #22421 from Microsoft/typesInTypeArguments
Allow types as well as values in possibly type argument location
2018-03-09 14:36:45 -08:00
Sheetal Nandi
ef64cde621
Merge pull request #22409 from Microsoft/symbolKind
Symbol kind needs to use location before falling back to flags
2018-03-09 13:59:38 -08:00
Mohamed Hegazy
c335c3803c
Fix #22133: Expose getOutliningSpans on the server protocol (#22400)
* Fix #22133: Expose getOutliningSpans on the server protocol

* Remove debugger statement from test
2018-03-09 08:50:47 -08:00
Andy
0f47c8a205
annotateWithTypeFromJSDoc: Do less special-casing for arrow functions (#22407)
* annotateWithTypeFromJSDoc: Do less special-casing for arrow functions

* Code review
2018-03-08 16:32:32 -08:00
Sheetal Nandi
e1a89e7011 Allow types as well as values in possibly type argument location
Fixes #22369
2018-03-08 16:06:26 -08:00
Andy
e48bcd60ba
Treat 'yield;' as 'yield undefined;' (#22297)
* Treat 'yield;' as 'yield undefined;'

* Use undefinedWideningType
2018-03-08 15:41:04 -08:00
Wesley Wigham
87d88e2ba3
Handle resolving and unknown symbols in getLiteralTypeFromPropertyName (#22406) 2018-03-08 13:35:55 -08:00
Sheetal Nandi
ea37c37e88 Symbol kind needs to use location before falling back to flags
Fixes #22366
2018-03-08 11:50:52 -08:00
Andy
a49e83ffa7
annotateWithTypeFromJSDoc: Use changes.insertTypeAnnotation instead of replaceNode (#22404) 2018-03-08 11:47:30 -08:00
Nathan Shively-Sanders
e4610e3418
Import types in JS with var x = require('./mod') (#22161) 2018-03-08 11:11:51 -08:00
Nathan Shively-Sanders
f8134d0b45 Merge branch 'master' into js-object-literal-assignments-as-declarations 2018-03-08 10:40:55 -08:00
Nathan Shively-Sanders
04ceb3d9bd Disallow JS/non-JS merge without crashing
Note that the error location is misleading because it's reported inside
the merge step for the js initializer.
2018-03-08 09:49:23 -08:00