30030 Commits

Author SHA1 Message Date
Anders Hejlsberg
b1a2f14a3a Add tests 2020-04-17 10:52:17 -07:00
Anders Hejlsberg
eda0b3e6f4 Accept new baselines 2020-04-17 10:48:02 -07:00
Anders Hejlsberg
5bb6487bef Check for this.xxx access to previously declared uninitialized property 2020-04-17 10:33:28 -07:00
Anders Hejlsberg
728d9cb911 Only widen fresh literal types in CFA of assignment to auto-typed 2020-04-15 18:25:14 -07:00
Anders Hejlsberg
0c9c76a14a Fix lint error 2020-04-14 10:34:28 -07:00
Anders Hejlsberg
df98d9c743 Accept new baselines 2020-04-14 10:13:58 -07:00
Anders Hejlsberg
6e0274a98a Also use CFA in constructor functions 2020-04-14 10:13:51 -07:00
Anders Hejlsberg
957d9e6418 Accept new baselines 2020-04-12 15:28:25 -07:00
Anders Hejlsberg
2fbab38323 Use CFA to determine types of properties declared by this.xxx assignments 2020-04-12 15:27:59 -07:00
Nathan Shively-Sanders
eb105efdcd
Avoid circular reference in this-property assignments (#37827)
* Avoid circular reference in this-property assignments

To do this, don't check this-property assigments that have the
this-property of the lhs appearing somewhere on the rhs:

```js
class C {
  m() {
    this.x = 12
    this.x = this.x + this.y
  }
}
```

I tried suppressing the circularity error, but because we cache the
first type discovered for a property, this still results in an implicit
any for `x` in the previous example. It just doesn't have an error.

Fixes #35099

* Add test case + rename function

* Use isMatchingReference
2020-04-10 16:41:31 -07:00
Alexander T
795a5c83fe
fix(37150): ignore private fields in string index type checking (#37183) 2020-04-10 12:53:53 -04:00
Alexander T
aa6be6ee6f
fix(37364): show completions for string literal index on mapped type (#37367) 2020-04-10 12:36:26 -04:00
Anders Hejlsberg
52dc9f2282
No recursive intersection property checks (#37854)
* No recursive intersection property checks

* Add comment
2020-04-09 19:23:36 -07:00
Anders Hejlsberg
6b1c102bd1
No excessive stack depth global errors (#37873)
* Report excessive stack depth on current node when no error node available

* Accept new baselines
2020-04-09 19:05:35 -07:00
Wesley Wigham
bc8a98ff00
Add node 13 to CI 2020-04-09 16:16:06 -07:00
Orta
23b6f6e469
Remove node 8 from the github actions (#37870) 2020-04-09 16:15:25 -07:00
Andrew Branch
95cc1c279e
Fix crash from missing valueDeclaration on intersection property (#37696)
* Add crashing test

* Fix missing valueDeclaration on intersection symbol property

* Remove assertion from serializeAsClass
2020-04-09 14:00:21 -07:00
Ron Buckton
4a646c9640
Fix parenthesization rules for yield (#37849) 2020-04-09 13:17:46 -07:00
Ravi van Rooijen
2a25901c54
Fix code block in jsdoc (#37864) 2020-04-09 13:31:41 -04:00
Andrew Branch
813efb49af
Lock playwright version (#37869) 2020-04-09 13:20:02 -04:00
Andrew Branch
24a17acf2c
Error on invalid uses of namespace export (#37715) 2020-04-09 09:42:16 -07:00
Andrew Branch
57f9076612
Remove extraneous string escape from convert to template string refactor (#37743)
* Add failing test

* Remove extraneous string escape

* Revert unnecessary change
2020-04-09 09:40:28 -07:00
Wesley Wigham
3d3854c93d
Set contextual type on elaborated error node rather than passing it, so its discriminated (#37828) 2020-04-09 02:55:39 -07:00
Nathan Shively-Sanders
f31b5a278f fix build break by updating missed baseline 2020-04-08 15:38:40 -07:00
Ron Buckton
5db4e7add3
Fix async function block return expr error in js (#37845) 2020-04-08 15:26:56 -07:00
csigs
fd6f92255b
LEGO: Merge pull request 37848
LEGO: Merge pull request 37848
2020-04-08 15:11:25 -07:00
csigs
f5de3138de LEGO: check in for master to temporary branch. 2020-04-08 22:10:41 +00:00
Wesley Wigham
b4838c8b62
Use comments from host variable declaration when exporting a signature in js declarations (#37594) 2020-04-08 13:32:17 -07:00
Ron Buckton
5a7916962d
Fix metadata serialization for invalid jsdoc types (#37836) 2020-04-08 12:06:40 -07:00
zhangciwu
126c6ab80d
Fix easy misunderstanding "! ===" (#37838)
* Remove unnecessary Non-null assertion operator

* Wrap Non-null assertion operator inside parentheses
2020-04-08 08:17:22 -07:00
Alexander T
e897eb1b2a
fix(37817): omit comments in name accessor (#37822) 2020-04-07 16:59:54 -07:00
Eli Barzilay
e4babd40e0 Skip isBlockScopedNameDeclaredBeforeUse error in interface or type declarations
Fixes #35947.
2020-04-07 16:12:18 -04:00
Eli Barzilay
dcc6c9461e Minor improvement
Get the `declaration` container just once instead of in three places.
(Minor change: one place used to start looking from
`declaration.parent`, but that shouldn't make any difference.)  Also,
don't pass it to the helper functions since they're local anyway.
2020-04-07 16:12:18 -04:00
Orta
3398c9bfe1
Make skipLibCheck: true the default in --init (#37808) 2020-04-07 15:00:44 -04:00
Andrew Branch
3e86f15f51
Disambiguate types with same name from different namespaces in mapToTypeNodes (#37543)
* Disambiguate types with same name from different namespaces in mapToTypeNodes

* Update baseline with additional example

* Fix typo
2020-04-07 10:55:56 -07:00
Bannerets
c47aca0da3
Accurate Array.prototype.flat definition (#32131)
* Better Array.prototype.flat definition

* Use more meaningful names

* Rename 'Flat' to 'FlatArray'
2020-04-07 09:16:20 -07:00
Nathan Shively-Sanders
7ca6334dbd
Look for outer type parameters on VariableStatements (#37819)
This only applies in JS, where `@template` tags can apply to
initialisers of variable declarations:

```js
/**
 * @template T
 * @returns {(b: T) => T}
 */
const seq = a => b => b
```

Fixes #36201
2020-04-07 08:04:33 -07:00
Anders Hejlsberg
a2609b1f1b
Extra check in assignment of intersections with generic constituents (#37537)
* Consolidated extra property check with intersections

* Fix comment

* Add tests

* Properly propagate intersectionState

* Route property check through recursive type tracking logic

* Accept new baselines

* Skip check when apparent type of source is never

* Accept new baselines

* Only check when apparent type of source is a structured type
2020-04-06 13:36:20 -07:00
Anders Hejlsberg
5a4024dd9d
Generic functions are never context sensitive (#37811)
* Functions with type parameters are never contextsensitive

* Add tests
2020-04-06 11:55:39 -07:00
Nathan Shively-Sanders
eac073894b
Fix serialisation of static class members in JS (#37780)
* Fix serialisation of static class members in JS

Previously static class members would be treated the same way as expando
namespace assignments to a class:

```ts
class C {
  static get x() { return 1 }
}
C.y = 12
```

This PR adds a syntactic check to the static/namespace filter that
treats symbols whose valueDeclaration.parent is a class as statics.

Fixes #37289

* fix messed-up indent

* Extract function
2020-04-03 20:06:05 -07:00
Orta
20ecbb0f46
Allow Source Mapping inside destructuring assignment (#37298)
* Add support for source maps inside of destructured code

* Adds tests for the source maps inside destructured code
2020-04-03 17:23:02 -04:00
Wesley Wigham
7317292782
Consider arrays and tuples within one another as possibly requiring deferral (#37776) 2020-04-03 14:14:13 -07:00
Nathan Shively-Sanders
7cf4b12d88
Fix crash for private identifier in expando assignments (#37764)
* Fix crash for private identifier in expando assignments

It does this by disallowing private identifiers from expando assignments
entirely. I haven't thought of a scenario where they make sense, but I
haven't thought about it exhaustively either.

Fixes #37356

* Update baselines

I think the new error is probably better. It's certainly different!
2020-04-03 10:29:22 -07:00
csigs
d68295e74e
LEGO: Merge pull request 37766
LEGO: Merge pull request 37766
2020-04-03 03:11:13 -07:00
csigs
c787252e00 LEGO: check in for master to temporary branch. 2020-04-03 10:10:33 +00:00
Wesley Wigham
6d25c01d09
Cache the regularized form of union types (#37749)
* Cache the regularized form of union types

* Inline function because why not

* Introduce two fastpasths into isRelatedTo
2020-04-02 23:54:24 -07:00
Anders Hejlsberg
349ae45a2c
Reduce intersections with conflicting privates, elaborate on reasons (#37762)
* Elaborate on reasons for 'never' intersections

* Accept new API baselines

* Accept new baselines

* Add tests

* Accept new baselines

* Address CR feedback
2020-04-02 18:00:59 -07:00
Andrew Branch
2187ba1f84
Fix variable name collisions (#37761) 2020-04-02 15:12:19 -07:00
Nathan Shively-Sanders
527f467926
Remove error when spreading optional any (#37757)
Previously, spreading an optional any gave a bogus error when the name
conflicted with earlier properties in the object literal. Now the code
checks any types for optionality before issuing the error.

Fixes #37740
2020-04-02 15:04:45 -07:00
Alexander T
696413749b
fix(37456): add tests for JsxOpeningElement nodes (#37752) 2020-04-02 10:38:31 -07:00