Commit graph

66 commits

Author SHA1 Message Date
Sheetal Nandi 9d31631fd7 Test cases of function infering return type of functions
if f is a contextually typed function expression (section 4.9.3), the inferred return type is the union type (section 3.3.4) of the types of the return statement expressions in the function body, ignoring return statements with no expressions.
Otherwise, the inferred return type is the first of the types of the return statement expressions in the function body that is a supertype (section 3.8.3) of each of the others, ignoring return statements with no expressions. A compile-time error occurs if no return statement expression has a type that is a supertype of each of the others.
2014-11-04 16:40:56 -08:00
Sheetal Nandi 40af15c8ff Array literal produces union type if the it is not contextually typed 2014-11-04 15:58:44 -08:00
Sheetal Nandi 1ca9273f49 Identity of union type 2014-11-04 13:18:50 -08:00
Sheetal Nandi 16fc7a22e2 Tests for union type literals
A union type literal is written as a sequence of types separated by vertical bars.
UnionType:
PrimaryOrUnionType   |   PrimaryType
A union typle literal references a union type.
When function or constructor types are included in union types they must be enclosed in parentheses
2014-11-04 13:18:47 -08:00
Sheetal Nandi 24ebc750c0 Tests for Conditional operator can generate union type 2014-11-04 13:18:43 -08:00
Sheetal Nandi b66cd9b0fc Results of || operation produces union type 2014-11-04 13:18:40 -08:00
Sheetal Nandi 49b5b5ab99 Tests for union of index signatures:
•	If each type in U has a string index signature, U has a string index signature of a union type of the types of the string index signatures from each type in U.
•	If each type in U has a numeric index signature, U has a numeric index signature of a union type of the types of the numeric index signatures from each type in U.
2014-11-04 13:18:37 -08:00
Sheetal Nandi c2b2c306af Tests for union of construct signatures
If each type in U has construct signatures and the sets of construct signatures are identical ignoring return types, U has the same set of construct signatures, but with return types that are unions of the return types of the respective construct signatures from each type in U.
2014-11-04 13:18:34 -08:00
Sheetal Nandi 2b8342bd79 Tests for union of call signatures
If each type in U has call signatures and the sets of call signatures are identical ignoring return types, U has the same set of call signatures, but with return types that are unions of the return types of the respective call signatures from each type in U.
2014-11-04 13:18:30 -08:00
Sheetal Nandi 357bd87612 Tests for union members:
If each type in U has a property P, U has a property P of a union type of the types of P from each type in U.
2014-11-04 13:18:27 -08:00
Sheetal Nandi 1f3653b32e Tests for assignment compatibility of union types
•	A union type U is assignable to a type T if each type in U is assignable to T.
•	A type T is assignable to a union type U if T is assignable to any type in U.
2014-11-04 13:18:24 -08:00
Sheetal Nandi 703cd5d4cf Tests for checking if type S is subtype of union type
T is a union type and S is a subtype of at least one constituent type of T
2014-11-04 13:18:20 -08:00
Sheetal Nandi a1535533e7 Tests for source (S) of subtype is union type (U)
A union type U is a subtype of a type T if each type in U is a subtype of T
2014-11-04 13:18:17 -08:00
Sheetal Nandi 568049474e Tests to check equivalency of union types
A union type encompasses an unordered set of unrelated types (that is, types that aren’t subtypes of each other). The following rules govern union types:
•	A | B is equivalent to A if B is a subtype of A.
•	A | B is equivalent to B | A.
•	AB | C is equivalent to A | BC, where AB is A | B and BC is B | C.
2014-11-04 13:18:14 -08: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
Vladimir Matveev cba9b7ff5e fixed typo 2014-11-02 16:20:00 -08:00
Vladimir Matveev 6b1a96ca29 added basic set of tests for type aliases 2014-11-02 13:34:04 -08:00
Vladimir Matveev fe7d056724 initial version of spec conformance tests for type aliases 2014-11-01 23:54:55 -07:00
Daniel Rosenwasser d522c88295 Merge branch 'master' into templates
Conflicts:
	src/compiler/checker.ts
	src/services/services.ts
2014-10-28 18:49:35 -07:00
Daniel Rosenwasser b8535d339c Omit empty template tail literals. 2014-10-28 18:47:43 -07:00
Jason Freeman bfb63df568 Merge branch 'master' into overloadResolution
Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
2014-10-24 16:36:42 -07:00
Daniel Rosenwasser 799609c8e8 Tests for tagged templates. 2014-10-23 17:31:12 -07:00
Daniel Rosenwasser a5b77c65f6 Added tests for tagged templates. Some should fail when we do typechecking. 2014-10-23 16:57:17 -07:00
Daniel Rosenwasser 0d1a46d68c Better test coverage for templates in object literals.
These tests still need to be fixed.
2014-10-23 16:55:35 -07:00
Daniel Rosenwasser b704f19502 Merge branch 'letAndConst' into templates
Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
2014-10-23 16:03:53 -07:00
Daniel Rosenwasser c0893e153f Added tests and baselines for templates. 2014-10-23 15:06:05 -07:00
Mohamed Hegazy 9353c11382 Merge branch 'master' into letAndConst
Conflicts:
	src/compiler/types.ts
2014-10-23 15:01:07 -07:00
Anders Hejlsberg 10a7e6ba70 Fixing in, for...in, and instanceof with union type operands 2014-10-22 16:57:43 -07:00
Jason Freeman 47bded060e Specify error message for type argument inference failing 2014-10-22 15:08:18 -07:00
Mohamed Hegazy 0e7d8b62ef Merge branch 'master' into letAndConst 2014-10-20 13:34:06 -07:00
Anders Hejlsberg 152a9402d0 Merge pull request #914 from Microsoft/parensInTypes
Parentheses in type literals
2014-10-20 09:43:07 -07:00
Anders Hejlsberg f3bd294d0e Adding tests 2014-10-19 07:57:10 -07:00
Anders Hejlsberg e5872b4824 Addressing CR feedback 2014-10-18 08:37:33 -07:00
Anders Hejlsberg c00ee42b11 Adding tests 2014-10-16 20:52:36 -07:00
Mohamed Hegazy e15f4e6d34 Merge branch 'master' into letAndConst
Conflicts:
	src/compiler/types.ts
2014-10-16 09:30:58 -07:00
Mohamed Hegazy cffc62aa1b Report duplicate identifier errors on all locations for merged declarations to align with local declarations 2014-10-14 15:18:44 -07:00
Anders Hejlsberg fc842b177e Merge branch 'master' into unionTypes
Conflicts:
	src/compiler/checker.ts
	src/compiler/types.ts
	src/services/services.ts
	tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt
	tests/baselines/reference/bestCommonTypeOfTuple.types
	tests/baselines/reference/bestCommonTypeOfTuple2.types
	tests/baselines/reference/castingTuple.errors.txt
	tests/baselines/reference/contextualTypeWithTuple.errors.txt
	tests/baselines/reference/genericCallWithTupleType.errors.txt
	tests/baselines/reference/indexerWithTuple.types
	tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt
2014-10-13 12:37:34 -07:00
Mohamed Hegazy bdac6ca895 Merge pull request #841 from chrisbubernak/disallowNumericEnumMembers
Fix for issue #134 (Disallow numeric enum members)
2014-10-10 16:24:12 -07:00
Dan Quirk 8ce1760d9e Fixing merge conflicts 2014-10-10 14:49:35 -07:00
Dan Quirk bacb9d0b22 Test updates from union changes 2014-10-10 14:41:14 -07:00
ChrisBubernak 15c5c77704 Fixing tests and baselines 2014-10-08 11:11:36 -07:00
Chris Bubernak c77135d3d9 Removed Numeric members from a bunch of tests
-in these tests it wasn't really in the spirit of the tests for them to be there
-also removed a test that no longer made sense
2014-10-06 16:14:45 -07: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
Yui T c2d86711e8 Update baselines 2014-09-30 18:09:55 -07:00
Mohamed Hegazy 12572576c8 fix comment text 2014-09-23 13:44:39 -07:00
Mohamed Hegazy a6fdad1e97 Added protected conformance tests 2014-09-23 11:22:38 -07:00
Cyrus Najmabadi e426c83017 Merge branch 'master' into fidelityParser 2014-09-19 17:53:07 -07:00
Anders Hejlsberg b5b0777ad5 More tests for protected members 2014-09-19 14:01:07 -07:00
Cyrus Najmabadi 0e9134788a Port fidelity changes to github. 2014-09-18 15:37:16 -07:00