Commit graph

34 commits

Author SHA1 Message Date
Anders Hejlsberg
9b1718677a
Leading and middle rest elements in tuple types (#41544)
* Support starting and middle rest elements in tuples

* Accept new baselines

* Include all rest arguments in error span

* Accept new baselines

* Fix tests

* Add new tests

* Fix lint errors
2021-01-04 15:12:51 -10:00
Anders Hejlsberg
cea1cfb82e
Consistently error when rest element isn't last in tuple type (#40254)
* Consistently error when rest element isn't last in tuple type

* Add regression test

* Accept new baselines

* Stricter circular recursion check in type inference

* Revert "Stricter circular recursion check in type inference"

This reverts commit 80e6df6230.

* Revert "Accept new baselines"

This reverts commit 355706dadc.

* Accept new baselines
2020-09-08 07:14:16 -10:00
Wesley Wigham
44d2350e5f
Fix tuple name homogeneity check (#40118) 2020-08-19 12:08:17 -07:00
Anders Hejlsberg
c5d21e7987
Lower priority for speculative variadic tuple inferences (#39723)
* Inference to [...T, X?] has lower priority than inference to [...T, X]

* Update tests

* Accept new API baselines
2020-07-24 15:00:53 -07:00
Anders Hejlsberg
db79030410
Support variadic tuple inference from trailing optional to non-optional (#39614)
* Permit variadic tuple inference from trailing optional to non-optional

* Add tests
2020-07-15 17:46:48 -07:00
Anders Hejlsberg
784396ce95
Infer implied arity before inferring from 'this' argument (#39328)
* Infer implied arity before inferring from 'this' argument

* Add regression test
2020-06-29 17:38:41 -07:00
Anders Hejlsberg
b448540644
No speculative inferences for variadic tuples (#39281)
* No speculative inferences to types like [...T, U?]

* Add tests
2020-06-29 15:24:32 -07:00
Anders Hejlsberg
ee4aee0531
Handle 'keyof' for generic tuple types (#39218)
* Handle keyof T where T is generic tuple type

* Add tests

* Accept new baselines

* Address CR feedback

* Accept new baselines
2020-06-25 13:49:20 -07:00
Anders Hejlsberg
8df85b5cae
Disable unsound T[K] rule in subtype relations (#39249)
* Disable unsound T[K] rule in subtype relations

* Add test
2020-06-25 10:22:48 -07:00
Anders Hejlsberg
d4792062bf
Variadic tuple types (#39094)
* Initial implementation of variadic tuple types

* Accept new baselines

* Handle variadic elements in tuple type inference

* Special case inference between tuples with matching structure

* Restore check that rest element is last element

* Handle variadic tuples in relationship checking

* Accept new baselines

* Infer readonly constraints when inferring from readonly tuples

* Fix lint issues

* T assignable to readonly [...T] and [...T] assignable to T

* Consistent tuple normalization

* Create variadic tuple types from array literal expressions

* Accept new baselines

* Array literals have tuple types when contextual type is readonly

* Accept new baselines

* Optional elements before required elements become required elements

* Update logic for rest parameters and spread arguments

* Revert special case of contextual readonly array type

* Accept new baselines

* Fix lint issue

* Switch entirely to createTupleType based on element flags

* Don't infer readonly tuple types when inferring to variadic elements

* Handle mapped types applied to generic tuple types

* Handle constraint of indexed access type with generic tuple type

* Accept new baselines

* Address CR feedback

* Simplify indexed access types involving generic tuple types

* Propagate checkMode into getSpreadArgumentType

* Guard against missing globalArrayType

* Inference to [...T, ...U] based on implied arity of T

* Accept new baselines

* Add tests

* Emit .d.ts from tests

* Address CR feedback
2020-06-22 18:35:43 -07:00
Wesley Wigham
5f597e69b2
Support naming tuple members (#38234)
* Initial draft of named tuple members

* Show tuple labels and documentation in completions

* Swap allowed syntax to parameter-like

* Add quickfix for labeled tuple syntax mistakes

* Add refactoring to convert list of signatures to single overload

* Fix small bug in visitor verification

* Signature help for rest parameters which are unions of tuples are displayed as seperate entries now

* Expand sanity check test cases in conformance suite

* Add tests and code for preserving tuple names through spreads where possible

* More refactoring tests, some comment preservation and some fixed formatting of multiline tuples

* Handle missing parameter named in isValidDeclarationForTupleLabel

* Minor text fixes
2020-05-19 15:54:02 -07:00
Nathan Shively-Sanders
061338e82b
Don't inferFromIndexTypes() twice (#34501)
* Don't inferFromIndexTypes() twice

* Add tests
2020-03-04 13:19:35 -08:00
Andrew Branch
9f6791a5ab
Error when writing to readonly tuple in rest element range 2019-05-22 15:03:17 -07:00
Andrew Branch
eecb6d9049
Add failing test 2019-05-22 13:39:05 -07:00
Klaus Meinhardt
782622f9cd clarify error message for 'readonly' type operator 2019-01-31 19:44:49 +01:00
Anders Hejlsberg
e290559057 Add tests for decorators and declaration emit from error free source 2019-01-26 14:57:02 -08:00
Anders Hejlsberg
0eac506fc0 Add .d.ts generation test 2019-01-16 12:45:33 -08:00
Anders Hejlsberg
2ccc106984 Add more tests 2019-01-16 09:46:28 -08:00
Anders Hejlsberg
cff7874288 Add tests 2019-01-15 14:44:57 -08:00
Anders Hejlsberg
d4f480cbbb Add tests 2018-10-06 17:03:19 -07:00
王文璐
6432bd9def check index access for fixed length tuple 2018-08-10 10:49:37 +08:00
Anders Hejlsberg
d869e56d33 Add tests 2018-06-25 10:45:38 -10:00
Anders Hejlsberg
0cc0fad381 Add tests 2018-06-14 13:06:37 -07:00
Nathan Shively-Sanders
c1c7926735 Revert "Add TupleBase with unusable mutating Array methods"
This reverts commits
4385444c44,
2399d58,
es55de3,
888da3c
2017-11-08 15:18:35 -08:00
Nathan Shively-Sanders
888da3c3da Update baselines 2017-11-06 15:55:16 -08:00
Nathan Shively-Sanders
a980d61f86 Add a few tuple tests and update baselines 2017-11-03 09:56:39 -07:00
Nathan Shively-Sanders
defd32f015 Move strict tuple test and add a couple of cases 2017-11-01 11:53:41 -07:00
Yui
5f91b3cf40 [Transforms] merging "master" on 06/15/2016 (#9218)
* Add upper limit for the program size, fix readDirectory for the symlink files

* Add comments

* CR feedback / Change upper limit / Add disableSizeLimit compiler option

* online and offline CR feedback

* Don't count current opened client file if it's TS file

* Speed up file searching

* Make language service optional for a project

* Fix failed tests

* Fix project updateing issue after editing config file

* Fix merging issues and multiple project scenario

* Refactoring

* add test and spit commandLineParser changes to another PR

* Fix #8523

* check the declaration and use order if both are not in module file

* Fix #9098: report missing function impelementation errors for merged classes and namespaces

* Added tests.

* Accepted baselines.

* Check tuple types when getting the type node's type.

* Accepted baselines.

* Fix #9173: clear out lib and types before creating a program in transpileModule

* Added tests.

* Accepted baselines.

* Always check type assertion types.

* Accepted baselines.

* Use helper functions to simplify range tests

* Remove String, Number, and Boolean from TypeFlags.Falsy

* Add regression test

* Accept new baselines

* Allow property declarations in .js files

* Remove old test

* Refactor code to make if statements cheaper

* Fix test failure from mergining with master
2016-06-17 16:40:26 -07:00
Jason Freeman
a74d64baa6 Add tests 2015-07-16 19:03:54 -07:00
Jason Freeman
6954cd2fd7 Add new tests 2015-07-14 11:50:31 -07:00
Caitlin Potter
bd2c239161 Add tests for tuple type compatibility
Tests suggested by @DanielRosenwasser
2015-03-10 13:33:59 -04:00
Sheetal Nandi
7634f741d9 Conformance tests for array element type of tuple is union type of tuple element types 2014-11-04 13:18:11 -08:00
Yui T
6dfb60d77c Remove duplicate file 2014-10-06 10:36:54 -07:00
Yui T
52f8ae3eec Tuple conformance 2014-10-03 17:37:29 -07:00