Merge branch 'master' into es6typings

Conflicts:
	tests/baselines/reference/constDeclarationShadowedByVarDeclaration3.types
This commit is contained in:
Mohamed Hegazy
2014-12-01 16:51:10 -08:00
70 changed files with 860 additions and 69 deletions

View File

@@ -0,0 +1,199 @@
//// [isDeclarationVisibleNodeKinds.ts]
// Function types
module schema {
export function createValidator1(schema: any): <T>(data: T) => T {
return undefined;
}
}
// Constructor types
module schema {
export function createValidator2(schema: any): new <T>(data: T) => T {
return undefined;
}
}
// union types
module schema {
export function createValidator3(schema: any): number | { new <T>(data: T): T; } {
return undefined;
}
}
// Array types
module schema {
export function createValidator4(schema: any): { new <T>(data: T): T; }[] {
return undefined;
}
}
// TypeLiterals
module schema {
export function createValidator5(schema: any): { new <T>(data: T): T } {
return undefined;
}
}
// Tuple types
module schema {
export function createValidator6(schema: any): [ new <T>(data: T) => T, number] {
return undefined;
}
}
// Paren Types
module schema {
export function createValidator7(schema: any): (new <T>(data: T)=>T )[] {
return undefined;
}
}
// Type reference
module schema {
export function createValidator8(schema: any): Array<{ <T>(data: T) : T}> {
return undefined;
}
}
module schema {
export class T {
get createValidator9(): <T>(data: T) => T {
return undefined;
}
set createValidator10(v: <T>(data: T) => T) {
}
}
}
//// [isDeclarationVisibleNodeKinds.js]
// Function types
var schema;
(function (_schema) {
function createValidator1(schema) {
return undefined;
}
_schema.createValidator1 = createValidator1;
})(schema || (schema = {}));
// Constructor types
var schema;
(function (_schema) {
function createValidator2(schema) {
return undefined;
}
_schema.createValidator2 = createValidator2;
})(schema || (schema = {}));
// union types
var schema;
(function (_schema) {
function createValidator3(schema) {
return undefined;
}
_schema.createValidator3 = createValidator3;
})(schema || (schema = {}));
// Array types
var schema;
(function (_schema) {
function createValidator4(schema) {
return undefined;
}
_schema.createValidator4 = createValidator4;
})(schema || (schema = {}));
// TypeLiterals
var schema;
(function (_schema) {
function createValidator5(schema) {
return undefined;
}
_schema.createValidator5 = createValidator5;
})(schema || (schema = {}));
// Tuple types
var schema;
(function (_schema) {
function createValidator6(schema) {
return undefined;
}
_schema.createValidator6 = createValidator6;
})(schema || (schema = {}));
// Paren Types
var schema;
(function (_schema) {
function createValidator7(schema) {
return undefined;
}
_schema.createValidator7 = createValidator7;
})(schema || (schema = {}));
// Type reference
var schema;
(function (_schema) {
function createValidator8(schema) {
return undefined;
}
_schema.createValidator8 = createValidator8;
})(schema || (schema = {}));
var schema;
(function (schema) {
var T = (function () {
function T() {
}
Object.defineProperty(T.prototype, "createValidator9", {
get: function () {
return undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(T.prototype, "createValidator10", {
set: function (v) {
},
enumerable: true,
configurable: true
});
return T;
})();
schema.T = T;
})(schema || (schema = {}));
//// [isDeclarationVisibleNodeKinds.d.ts]
declare module schema {
function createValidator1(schema: any): <T>(data: T) => T;
}
declare module schema {
function createValidator2(schema: any): new <T>(data: T) => T;
}
declare module schema {
function createValidator3(schema: any): number | {
new <T>(data: T): T;
};
}
declare module schema {
function createValidator4(schema: any): {
new <T>(data: T): T;
}[];
}
declare module schema {
function createValidator5(schema: any): {
new <T>(data: T): T;
};
}
declare module schema {
function createValidator6(schema: any): [new <T>(data: T) => T, number];
}
declare module schema {
function createValidator7(schema: any): (new <T>(data: T) => T)[];
}
declare module schema {
function createValidator8(schema: any): Array<{
<T>(data: T): T;
}>;
}
declare module schema {
class T {
createValidator9: <T>(data: T) => T;
createValidator10: <T>(data: T) => T;
}
}

View File

@@ -0,0 +1,168 @@
=== tests/cases/compiler/isDeclarationVisibleNodeKinds.ts ===
// Function types
module schema {
>schema : typeof schema
export function createValidator1(schema: any): <T>(data: T) => T {
>createValidator1 : (schema: any) => <T>(data: T) => T
>schema : any
>T : T
>data : T
>T : T
>T : T
return undefined;
>undefined : undefined
}
}
// Constructor types
module schema {
>schema : typeof schema
export function createValidator2(schema: any): new <T>(data: T) => T {
>createValidator2 : (schema: any) => new <T>(data: T) => T
>schema : any
>T : T
>data : T
>T : T
>T : T
return undefined;
>undefined : undefined
}
}
// union types
module schema {
>schema : typeof schema
export function createValidator3(schema: any): number | { new <T>(data: T): T; } {
>createValidator3 : (schema: any) => number | (new <T>(data: T) => T)
>schema : any
>T : T
>data : T
>T : T
>T : T
return undefined;
>undefined : undefined
}
}
// Array types
module schema {
>schema : typeof schema
export function createValidator4(schema: any): { new <T>(data: T): T; }[] {
>createValidator4 : (schema: any) => (new <T>(data: T) => T)[]
>schema : any
>T : T
>data : T
>T : T
>T : T
return undefined;
>undefined : undefined
}
}
// TypeLiterals
module schema {
>schema : typeof schema
export function createValidator5(schema: any): { new <T>(data: T): T } {
>createValidator5 : (schema: any) => new <T>(data: T) => T
>schema : any
>T : T
>data : T
>T : T
>T : T
return undefined;
>undefined : undefined
}
}
// Tuple types
module schema {
>schema : typeof schema
export function createValidator6(schema: any): [ new <T>(data: T) => T, number] {
>createValidator6 : (schema: any) => [new <T>(data: T) => T, number]
>schema : any
>T : T
>data : T
>T : T
>T : T
return undefined;
>undefined : undefined
}
}
// Paren Types
module schema {
>schema : typeof schema
export function createValidator7(schema: any): (new <T>(data: T)=>T )[] {
>createValidator7 : (schema: any) => (new <T>(data: T) => T)[]
>schema : any
>T : T
>data : T
>T : T
>T : T
return undefined;
>undefined : undefined
}
}
// Type reference
module schema {
>schema : typeof schema
export function createValidator8(schema: any): Array<{ <T>(data: T) : T}> {
>createValidator8 : (schema: any) => (<T>(data: T) => T)[]
>schema : any
>Array : T[]
>T : T
>data : T
>T : T
>T : T
return undefined;
>undefined : undefined
}
}
module schema {
>schema : typeof schema
export class T {
>T : T
get createValidator9(): <T>(data: T) => T {
>createValidator9 : <T>(data: T) => T
>T : T
>data : T
>T : T
>T : T
return undefined;
>undefined : undefined
}
set createValidator10(v: <T>(data: T) => T) {
>createValidator10 : <T>(data: T) => T
>v : <T>(data: T) => T
>T : T
>data : T
>T : T
>T : T
}
}
}

View File

@@ -0,0 +1,6 @@
//// [templateStringTermination1.ts]
``
//// [templateStringTermination1.js]
"";

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination1.ts ===
No type information for this code.``
No type information for this code.

View File

@@ -0,0 +1,5 @@
//// [templateStringTermination1_ES6.ts]
``
//// [templateStringTermination1_ES6.js]
``;

View File

@@ -0,0 +1,3 @@
=== tests/cases/conformance/es6/templates/templateStringTermination1_ES6.ts ===
``
No type information for this code.

View File

@@ -0,0 +1,6 @@
//// [templateStringTermination2.ts]
`\\`
//// [templateStringTermination2.js]
"\";

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination2.ts ===
No type information for this code.`\\`
No type information for this code.

View File

@@ -0,0 +1,5 @@
//// [templateStringTermination2_ES6.ts]
`\\`
//// [templateStringTermination2_ES6.js]
`\\`;

View File

@@ -0,0 +1,3 @@
=== tests/cases/conformance/es6/templates/templateStringTermination2_ES6.ts ===
`\\`
No type information for this code.

View File

@@ -0,0 +1,6 @@
//// [templateStringTermination3.ts]
`\``
//// [templateStringTermination3.js]
"`";

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination3.ts ===
No type information for this code.`\``
No type information for this code.

View File

@@ -0,0 +1,5 @@
//// [templateStringTermination3_ES6.ts]
`\``
//// [templateStringTermination3_ES6.js]
`\``;

View File

@@ -0,0 +1,3 @@
=== tests/cases/conformance/es6/templates/templateStringTermination3_ES6.ts ===
`\``
No type information for this code.

View File

@@ -0,0 +1,6 @@
//// [templateStringTermination4.ts]
`\\\\`
//// [templateStringTermination4.js]
"\\";

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination4.ts ===
No type information for this code.`\\\\`
No type information for this code.

View File

@@ -0,0 +1,5 @@
//// [templateStringTermination4_ES6.ts]
`\\\\`
//// [templateStringTermination4_ES6.js]
`\\\\`;

View File

@@ -0,0 +1,3 @@
=== tests/cases/conformance/es6/templates/templateStringTermination4_ES6.ts ===
`\\\\`
No type information for this code.

View File

@@ -0,0 +1,6 @@
//// [templateStringTermination5.ts]
`\\\\\\`
//// [templateStringTermination5.js]
"\\\";

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination5.ts ===
No type information for this code.`\\\\\\`
No type information for this code.

View File

@@ -0,0 +1,5 @@
//// [templateStringTermination5_ES6.ts]
`\\\\\\`
//// [templateStringTermination5_ES6.js]
`\\\\\\`;

View File

@@ -0,0 +1,3 @@
=== tests/cases/conformance/es6/templates/templateStringTermination5_ES6.ts ===
`\\\\\\`
No type information for this code.

View File

@@ -0,0 +1,8 @@
tests/cases/conformance/es6/templates/templateStringUnterminated1.ts(2,2): error TS1160: Unterminated template literal.
==== tests/cases/conformance/es6/templates/templateStringUnterminated1.ts (1 errors) ====
`
!!! error TS1160: Unterminated template literal.

View File

@@ -0,0 +1,7 @@
tests/cases/conformance/es6/templates/templateStringUnterminated1_ES6.ts(1,2): error TS1160: Unterminated template literal.
==== tests/cases/conformance/es6/templates/templateStringUnterminated1_ES6.ts (1 errors) ====
`
!!! error TS1160: Unterminated template literal.

View File

@@ -0,0 +1,8 @@
tests/cases/conformance/es6/templates/templateStringUnterminated2.ts(2,4): error TS1160: Unterminated template literal.
==== tests/cases/conformance/es6/templates/templateStringUnterminated2.ts (1 errors) ====
`\`
!!! error TS1160: Unterminated template literal.

View File

@@ -0,0 +1,7 @@
tests/cases/conformance/es6/templates/templateStringUnterminated2_ES6.ts(1,4): error TS1160: Unterminated template literal.
==== tests/cases/conformance/es6/templates/templateStringUnterminated2_ES6.ts (1 errors) ====
`\`
!!! error TS1160: Unterminated template literal.

View File

@@ -0,0 +1,8 @@
tests/cases/conformance/es6/templates/templateStringUnterminated3.ts(2,4): error TS1160: Unterminated template literal.
==== tests/cases/conformance/es6/templates/templateStringUnterminated3.ts (1 errors) ====
`\\
!!! error TS1160: Unterminated template literal.

View File

@@ -0,0 +1,7 @@
tests/cases/conformance/es6/templates/templateStringUnterminated3_ES6.ts(1,4): error TS1160: Unterminated template literal.
==== tests/cases/conformance/es6/templates/templateStringUnterminated3_ES6.ts (1 errors) ====
`\\
!!! error TS1160: Unterminated template literal.

View File

@@ -0,0 +1,8 @@
tests/cases/conformance/es6/templates/templateStringUnterminated4.ts(2,6): error TS1160: Unterminated template literal.
==== tests/cases/conformance/es6/templates/templateStringUnterminated4.ts (1 errors) ====
`\\\`
!!! error TS1160: Unterminated template literal.

View File

@@ -0,0 +1,7 @@
tests/cases/conformance/es6/templates/templateStringUnterminated4_ES6.ts(1,6): error TS1160: Unterminated template literal.
==== tests/cases/conformance/es6/templates/templateStringUnterminated4_ES6.ts (1 errors) ====
`\\\`
!!! error TS1160: Unterminated template literal.

View File

@@ -0,0 +1,8 @@
tests/cases/conformance/es6/templates/templateStringUnterminated5.ts(2,8): error TS1160: Unterminated template literal.
==== tests/cases/conformance/es6/templates/templateStringUnterminated5.ts (1 errors) ====
`\\\\\`
!!! error TS1160: Unterminated template literal.

View File

@@ -0,0 +1,7 @@
tests/cases/conformance/es6/templates/templateStringUnterminated5_ES6.ts(1,8): error TS1160: Unterminated template literal.
==== tests/cases/conformance/es6/templates/templateStringUnterminated5_ES6.ts (1 errors) ====
`\\\\\`
!!! error TS1160: Unterminated template literal.

View File

@@ -0,0 +1,71 @@
// @declaration: true
// @target: es5
// Function types
module schema {
export function createValidator1(schema: any): <T>(data: T) => T {
return undefined;
}
}
// Constructor types
module schema {
export function createValidator2(schema: any): new <T>(data: T) => T {
return undefined;
}
}
// union types
module schema {
export function createValidator3(schema: any): number | { new <T>(data: T): T; } {
return undefined;
}
}
// Array types
module schema {
export function createValidator4(schema: any): { new <T>(data: T): T; }[] {
return undefined;
}
}
// TypeLiterals
module schema {
export function createValidator5(schema: any): { new <T>(data: T): T } {
return undefined;
}
}
// Tuple types
module schema {
export function createValidator6(schema: any): [ new <T>(data: T) => T, number] {
return undefined;
}
}
// Paren Types
module schema {
export function createValidator7(schema: any): (new <T>(data: T)=>T )[] {
return undefined;
}
}
// Type reference
module schema {
export function createValidator8(schema: any): Array<{ <T>(data: T) : T}> {
return undefined;
}
}
module schema {
export class T {
get createValidator9(): <T>(data: T) => T {
return undefined;
}
set createValidator10(v: <T>(data: T) => T) {
}
}
}

View File

@@ -0,0 +1,2 @@
``

View File

@@ -0,0 +1,2 @@
// @target: ES6
``

View File

@@ -0,0 +1,2 @@
`\\`

View File

@@ -0,0 +1,2 @@
// @target: ES6
`\\`

View File

@@ -0,0 +1,2 @@
`\``

View File

@@ -0,0 +1,2 @@
// @target: ES6
`\``

View File

@@ -0,0 +1,2 @@
`\\\\`

View File

@@ -0,0 +1,2 @@
// @target: ES6
`\\\\`

View File

@@ -0,0 +1,2 @@
`\\\\\\`

View File

@@ -0,0 +1,2 @@
// @target: ES6
`\\\\\\`

View File

@@ -0,0 +1,2 @@
// @target: ES6
`

View File

@@ -0,0 +1,2 @@
`\`

View File

@@ -0,0 +1,2 @@
// @target: ES6
`\`

View File

@@ -0,0 +1,2 @@
`\\

View File

@@ -0,0 +1,2 @@
// @target: ES6
`\\

View File

@@ -0,0 +1,2 @@
`\\\`

View File

@@ -0,0 +1,2 @@
// @target: ES6
`\\\`

View File

@@ -0,0 +1,2 @@
`\\\\\`

View File

@@ -0,0 +1,2 @@
// @target: ES6
`\\\\\`

View File

@@ -0,0 +1,10 @@
/// <reference path="fourslash.ts" />
////"/*1*/ /*2*/\/*3*/
//// /*4*/ \\/*5*/
test.markers().forEach(marker => {
goTo.position(marker.position);
verify.completionListIsEmpty()
});

View File

@@ -0,0 +1,11 @@
/// <reference path="fourslash.ts" />
////"/*1*/ /*2*/\/*3*/
//// /*4*/ \\\/*5*/
//// /*6*/
test.markers().forEach(marker => {
goTo.position(marker.position);
verify.completionListIsEmpty()
});

View File

@@ -0,0 +1,7 @@
/// <reference path='fourslash.ts'/>
////declare var module/*1*/
goTo.marker("1");
edit.insert(";");
verify.currentLineContentIs("declare var module;");

View File

@@ -0,0 +1,21 @@
/// <reference path='fourslash.ts' />
//// function f(templateStrings, x, y, z) { return 10; }
//// function g(templateStrings, x, y, z) { return ""; }
////
//// f ` ${ 123 } /*1*/${ } /*2*/\/*3*/
//// /*4*/\\/*5*/
//// /*6*/\\\/*7*/
//// /*8*/
test.markers().forEach(m => {
goTo.position(m.position);
verify.signatureHelpCountIs(1);
verify.signatureHelpArgumentCountIs(3);
verify.currentSignatureParameterCountIs(4);
verify.currentSignatureHelpIs('f(templateStrings: any, x: any, y: any, z: any): number');
verify.currentParameterHelpArgumentNameIs("templateStrings");
verify.currentParameterSpanIs("templateStrings: any");
});

View File

@@ -0,0 +1,18 @@
/// <reference path='fourslash.ts' />
//// function f(templateStrings, x, y, z) { return 10; }
//// function g(templateStrings, x, y, z) { return ""; }
////
//// f `/*1*/\/*2*/`/*3*/ /*4*/
test.markers().forEach(m => {
goTo.position(m.position);
verify.signatureHelpCountIs(1);
verify.signatureHelpArgumentCountIs(1);
verify.currentSignatureParameterCountIs(4);
verify.currentSignatureHelpIs('f(templateStrings: any, x: any, y: any, z: any): number');
verify.currentParameterHelpArgumentNameIs("templateStrings");
verify.currentParameterSpanIs("templateStrings: any");
});

View File

@@ -0,0 +1,18 @@
/// <reference path='fourslash.ts' />
//// function f(templateStrings, x, y, z) { return 10; }
//// function g(templateStrings, x, y, z) { return ""; }
////
//// f `/*1*/ \\\/*2*/`/*3*/ /*4*/
test.markers().forEach(m => {
goTo.position(m.position);
verify.signatureHelpCountIs(1);
verify.signatureHelpArgumentCountIs(1);
verify.currentSignatureParameterCountIs(4);
verify.currentSignatureHelpIs('f(templateStrings: any, x: any, y: any, z: any): number');
verify.currentParameterHelpArgumentNameIs("templateStrings");
verify.currentParameterSpanIs("templateStrings: any");
});

View File

@@ -130,20 +130,76 @@ describe('Colorization', function () {
operator(","));
});
it("correctly classifies an unterminated multi-line string", function () {
it("correctly classifies a multi-line string with one backslash", function () {
test("'line1\\",
ts.EndOfLineState.Start,
stringLiteral("'line1\\"),
finalEndOfLineState(ts.EndOfLineState.InSingleQuoteStringLiteral));
});
it("correctly classifies the second line of an unterminated multi-line string", function () {
it("correctly classifies a multi-line string with three backslashes", function () {
test("'line1\\\\\\",
ts.EndOfLineState.Start,
stringLiteral("'line1\\\\\\"),
finalEndOfLineState(ts.EndOfLineState.InSingleQuoteStringLiteral));
});
it("correctly classifies an unterminated single-line string with no backslashes", function () {
test("'line1",
ts.EndOfLineState.Start,
stringLiteral("'line1"),
finalEndOfLineState(ts.EndOfLineState.Start));
});
it("correctly classifies an unterminated single-line string with two backslashes", function () {
test("'line1\\\\",
ts.EndOfLineState.Start,
stringLiteral("'line1\\\\"),
finalEndOfLineState(ts.EndOfLineState.Start));
});
it("correctly classifies an unterminated single-line string with four backslashes", function () {
test("'line1\\\\\\\\",
ts.EndOfLineState.Start,
stringLiteral("'line1\\\\\\\\"),
finalEndOfLineState(ts.EndOfLineState.Start));
});
it("correctly classifies the continuing line of a multi-line string ending in one backslash", function () {
test("\\",
ts.EndOfLineState.InDoubleQuoteStringLiteral,
stringLiteral("\\"),
finalEndOfLineState(ts.EndOfLineState.InDoubleQuoteStringLiteral));
});
it("correctly classifies the continuing line of a multi-line string ending in three backslashes", function () {
test("\\",
ts.EndOfLineState.InDoubleQuoteStringLiteral,
stringLiteral("\\"),
finalEndOfLineState(ts.EndOfLineState.InDoubleQuoteStringLiteral));
});
it("correctly classifies the last line of an unterminated multi-line string ending in no backslashes", function () {
test(" ",
ts.EndOfLineState.InDoubleQuoteStringLiteral,
stringLiteral(" "),
finalEndOfLineState(ts.EndOfLineState.Start));
});
it("correctly classifies the last line of an unterminated multi-line string ending in two backslashes", function () {
test("\\\\",
ts.EndOfLineState.InDoubleQuoteStringLiteral,
stringLiteral("\\\\"),
finalEndOfLineState(ts.EndOfLineState.Start));
});
it("correctly classifies the last line of an unterminated multi-line string ending in four backslashes", function () {
test("\\\\\\\\",
ts.EndOfLineState.InDoubleQuoteStringLiteral,
stringLiteral("\\\\\\\\"),
finalEndOfLineState(ts.EndOfLineState.Start));
});
it("correctly classifies the last line of a multi-line string", function () {
test("'",
ts.EndOfLineState.InSingleQuoteStringLiteral,