mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Merge branch 'master' into alternateFixSuperInAsyncMethod
This commit is contained in:
@@ -24,7 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
var task_1 = require("./task");
|
||||
const task_1 = require("./task");
|
||||
class Test {
|
||||
example() {
|
||||
return __awaiter(this, void 0, task_1.Task, function* () { return; });
|
||||
|
||||
@@ -31,16 +31,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = {};
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport_1.js]
|
||||
"use strict";
|
||||
var es6ImportDefaultBindingFollowedWithNamedImport_0_1 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
const es6ImportDefaultBindingFollowedWithNamedImport_0_1 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_1.a;
|
||||
var es6ImportDefaultBindingFollowedWithNamedImport_0_2 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
const es6ImportDefaultBindingFollowedWithNamedImport_0_2 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_2.a;
|
||||
var es6ImportDefaultBindingFollowedWithNamedImport_0_3 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
const es6ImportDefaultBindingFollowedWithNamedImport_0_3 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_3.x;
|
||||
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_3.a;
|
||||
var es6ImportDefaultBindingFollowedWithNamedImport_0_4 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
const es6ImportDefaultBindingFollowedWithNamedImport_0_4 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_4.x;
|
||||
var es6ImportDefaultBindingFollowedWithNamedImport_0_5 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
const es6ImportDefaultBindingFollowedWithNamedImport_0_5 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_5.m;
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this
|
||||
exports.a = 10;
|
||||
//// [es6ImportNameSpaceImport_1.js]
|
||||
"use strict";
|
||||
var nameSpaceBinding = require("./es6ImportNameSpaceImport_0");
|
||||
const nameSpaceBinding = require("./es6ImportNameSpaceImport_0");
|
||||
var x = nameSpaceBinding.a;
|
||||
|
||||
|
||||
|
||||
@@ -53,26 +53,26 @@ exports.z2 = 10;
|
||||
exports.aaaa = 10;
|
||||
//// [es6ImportNamedImport_1.js]
|
||||
"use strict";
|
||||
var es6ImportNamedImport_0_1 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_1 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_1.a;
|
||||
var es6ImportNamedImport_0_2 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_2 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_2.a;
|
||||
var es6ImportNamedImport_0_3 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_3 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_3.x;
|
||||
var xxxx = es6ImportNamedImport_0_3.a;
|
||||
var es6ImportNamedImport_0_4 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_4 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_4.x;
|
||||
var es6ImportNamedImport_0_5 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_5 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_5.m;
|
||||
var es6ImportNamedImport_0_6 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_6 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_6.a1;
|
||||
var xxxx = es6ImportNamedImport_0_6.x1;
|
||||
var es6ImportNamedImport_0_7 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_7 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_7.a1;
|
||||
var xxxx = es6ImportNamedImport_0_7.x1;
|
||||
var es6ImportNamedImport_0_8 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_8 = require("./es6ImportNamedImport_0");
|
||||
var z111 = es6ImportNamedImport_0_8.z1;
|
||||
var es6ImportNamedImport_0_9 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_9 = require("./es6ImportNamedImport_0");
|
||||
var z2 = es6ImportNamedImport_0_9.z2; // z2 shouldn't give redeclare error
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export = a;
|
||||
exports.a = 10;
|
||||
//// [es6ImportNamedImportInExportAssignment_1.js]
|
||||
"use strict";
|
||||
var es6ImportNamedImportInExportAssignment_0_1 = require("./es6ImportNamedImportInExportAssignment_0");
|
||||
const es6ImportNamedImportInExportAssignment_0_1 = require("./es6ImportNamedImportInExportAssignment_0");
|
||||
module.exports = es6ImportNamedImportInExportAssignment_0_1.a;
|
||||
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ exports.M = t1_1.M;
|
||||
exports.a = t1_1.a;
|
||||
//// [t3.js]
|
||||
"use strict";
|
||||
var t1_1 = require("./t1");
|
||||
const t1_1 = require("./t1");
|
||||
exports.v = t1_1.v;
|
||||
exports.f = t1_1.f;
|
||||
exports.C = t1_1.C;
|
||||
|
||||
@@ -24,6 +24,6 @@ exports.y = t1_1.x;
|
||||
exports.x = t1_1.y;
|
||||
//// [t3.js]
|
||||
"use strict";
|
||||
var t1_1 = require("./t1");
|
||||
const t1_1 = require("./t1");
|
||||
exports.y = t1_1.x;
|
||||
exports.x = t1_1.y;
|
||||
|
||||
@@ -69,7 +69,7 @@ exports.M = t1_1.M1;
|
||||
exports.a = t1_1.a1;
|
||||
//// [t3.js]
|
||||
"use strict";
|
||||
var t1_1 = require("./t1");
|
||||
const t1_1 = require("./t1");
|
||||
exports.v = t1_1.v1;
|
||||
exports.f = t1_1.f1;
|
||||
exports.C = t1_1.C1;
|
||||
|
||||
@@ -45,24 +45,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = "hello";
|
||||
//// [t3.js]
|
||||
"use strict";
|
||||
var a = require("./t1");
|
||||
const a = require("./t1");
|
||||
exports.a = a;
|
||||
a.default;
|
||||
var t1_1 = require("./t1");
|
||||
const t1_1 = require("./t1");
|
||||
exports.b = t1_1.default;
|
||||
t1_1.default;
|
||||
var c = require("./t1");
|
||||
const c = require("./t1");
|
||||
exports.c = c;
|
||||
c.default;
|
||||
var t1_2 = require("./t1");
|
||||
const t1_2 = require("./t1");
|
||||
exports.d = t1_2.default;
|
||||
t1_2.default;
|
||||
var t1_3 = require("./t1"), e2 = t1_3;
|
||||
const t1_3 = require("./t1"), e2 = t1_3;
|
||||
exports.e1 = t1_3.default;
|
||||
exports.e2 = e2;
|
||||
t1_3.default;
|
||||
e2.default;
|
||||
var t1_4 = require("./t1");
|
||||
const t1_4 = require("./t1");
|
||||
exports.f1 = t1_4.default;
|
||||
exports.f2 = t1_4.default;
|
||||
t1_4.default;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(3,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(95,16): error TS2378: A 'get' accessor must return a value.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(118,5): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(101,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(106,16): error TS2378: A 'get' accessor must return a value.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(129,5): error TS1003: Identifier expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (3 errors) ====
|
||||
==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (4 errors) ====
|
||||
|
||||
|
||||
function f1(): string {
|
||||
@@ -98,6 +99,19 @@ tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(118,5): e
|
||||
return "Okay, not type annotated.";
|
||||
}
|
||||
|
||||
function f19(): void | number {
|
||||
// Okay; function return type is union containing void
|
||||
}
|
||||
|
||||
function f20(): any | number {
|
||||
// Okay; function return type is union containing any
|
||||
}
|
||||
|
||||
function f21(): number | string {
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
|
||||
// Not okay; union does not contain void or any
|
||||
}
|
||||
|
||||
class C {
|
||||
public get m1() {
|
||||
|
||||
@@ -91,6 +91,17 @@ function f18() {
|
||||
return "Okay, not type annotated.";
|
||||
}
|
||||
|
||||
function f19(): void | number {
|
||||
// Okay; function return type is union containing void
|
||||
}
|
||||
|
||||
function f20(): any | number {
|
||||
// Okay; function return type is union containing any
|
||||
}
|
||||
|
||||
function f21(): number | string {
|
||||
// Not okay; union does not contain void or any
|
||||
}
|
||||
|
||||
class C {
|
||||
public get m1() {
|
||||
@@ -191,6 +202,15 @@ function f17() {
|
||||
function f18() {
|
||||
return "Okay, not type annotated.";
|
||||
}
|
||||
function f19() {
|
||||
// Okay; function return type is union containing void
|
||||
}
|
||||
function f20() {
|
||||
// Okay; function return type is union containing any
|
||||
}
|
||||
function f21() {
|
||||
// Not okay; union does not contain void or any
|
||||
}
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
|
||||
tests/cases/compiler/a.js(3,6): error TS1223: 'type' tag already specified.
|
||||
|
||||
|
||||
!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
==== tests/cases/compiler/a.js (0 errors) ====
|
||||
/**
|
||||
* @type {number}
|
||||
* @type {string}
|
||||
~~~~
|
||||
!!! error TS1223: 'type' tag already specified.
|
||||
*/
|
||||
var v;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
|
||||
tests/cases/compiler/a.js(1,10): error TS8016: 'type assertion expressions' can only be used in a .ts file.
|
||||
tests/cases/compiler/a.js(1,10): error TS17008: JSX element 'string' has no corresponding closing tag.
|
||||
tests/cases/compiler/a.js(1,27): error TS1005: '</' expected.
|
||||
|
||||
|
||||
!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
==== tests/cases/compiler/a.js (2 errors) ====
|
||||
var v = <string>undefined;
|
||||
~~~~~~
|
||||
!!! error TS8016: 'type assertion expressions' can only be used in a .ts file.
|
||||
!!! error TS17008: JSX element 'string' has no corresponding closing tag.
|
||||
|
||||
!!! error TS1005: '</' expected.
|
||||
@@ -20,8 +20,8 @@ use(foo);
|
||||
exports.x = 1;
|
||||
//// [test.js]
|
||||
"use strict";
|
||||
var existingModule_1 = require('./existingModule');
|
||||
var missingModule_1 = require('./missingModule');
|
||||
const existingModule_1 = require('./existingModule');
|
||||
const missingModule_1 = require('./missingModule');
|
||||
const test = { x: existingModule_1.x, foo: missingModule_1.foo };
|
||||
use(existingModule_1.x);
|
||||
use(missingModule_1.foo);
|
||||
|
||||
@@ -92,6 +92,17 @@ function f18() {
|
||||
return "Okay, not type annotated.";
|
||||
}
|
||||
|
||||
function f19(): void | number {
|
||||
// Okay; function return type is union containing void
|
||||
}
|
||||
|
||||
function f20(): any | number {
|
||||
// Okay; function return type is union containing any
|
||||
}
|
||||
|
||||
function f21(): number | string {
|
||||
// Not okay; union does not contain void or any
|
||||
}
|
||||
|
||||
class C {
|
||||
public get m1() {
|
||||
|
||||
@@ -23,11 +23,8 @@
|
||||
////// @pa/*7*/
|
||||
////var v7;
|
||||
////
|
||||
/////** @param { n/*8*/ } */
|
||||
/////** @return { n/*8*/ } */
|
||||
////var v8;
|
||||
////
|
||||
/////** @return { n/*9*/ } */
|
||||
////var v9;
|
||||
|
||||
goTo.marker('1');
|
||||
verify.completionListContains("constructor");
|
||||
@@ -57,6 +54,3 @@ verify.completionListIsEmpty();
|
||||
goTo.marker('8');
|
||||
verify.completionListContains('number');
|
||||
|
||||
goTo.marker('9');
|
||||
verify.completionListContains('number');
|
||||
|
||||
|
||||
10
tests/cases/fourslash/getJavaScriptCompletions1.ts
Normal file
10
tests/cases/fourslash/getJavaScriptCompletions1.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @type {number} */
|
||||
////var v;
|
||||
////v./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
11
tests/cases/fourslash/getJavaScriptCompletions10.ts
Normal file
11
tests/cases/fourslash/getJavaScriptCompletions10.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////**
|
||||
//// * @type {function(this:number)}
|
||||
//// */
|
||||
////function f() { this./**/ }
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
11
tests/cases/fourslash/getJavaScriptCompletions11.ts
Normal file
11
tests/cases/fourslash/getJavaScriptCompletions11.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @type {number|string} */
|
||||
////var v;
|
||||
////v./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
verify.completionListContains("charCodeAt", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
36
tests/cases/fourslash/getJavaScriptCompletions12.ts
Normal file
36
tests/cases/fourslash/getJavaScriptCompletions12.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////**
|
||||
//// * @param {number} input
|
||||
//// * @param {string} currency
|
||||
//// * @returns {number}
|
||||
//// */
|
||||
////var convert = function(input, currency) {
|
||||
//// switch(currency./*1*/) {
|
||||
//// case "USD":
|
||||
//// input./*2*/;
|
||||
//// case "EUR":
|
||||
//// return "" + rateToUsd.EUR;
|
||||
//// case "CNY":
|
||||
//// return {} + rateToUsd.CNY;
|
||||
//// }
|
||||
////}
|
||||
////convert(1, "")./*3*/
|
||||
/////**
|
||||
//// * @param {number} x
|
||||
//// */
|
||||
////var test1 = function(x) { return x./*4*/ }, test2 = function(a) { return a./*5*/ };
|
||||
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("charCodeAt", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
goTo.marker("3");
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
goTo.marker("4");
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
goTo.marker("5");
|
||||
verify.completionListContains("test1", /*displayText:*/ undefined, /*documentation*/ undefined, "warning");
|
||||
26
tests/cases/fourslash/getJavaScriptCompletions13.ts
Normal file
26
tests/cases/fourslash/getJavaScriptCompletions13.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
// @allowNonTsExtensions: true
|
||||
|
||||
// @Filename: file1.js
|
||||
|
||||
////var file1Identifier = 1;
|
||||
////interface Foo { FooProp: number };
|
||||
|
||||
// @Filename: file2.js
|
||||
|
||||
////var file2Identifier1 = 2;
|
||||
////var file2Identifier2 = 2;
|
||||
/////*1*/
|
||||
////file2Identifier2./*2*/
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("file2Identifier1");
|
||||
verify.completionListContains("file2Identifier2");
|
||||
verify.completionListContains("file1Identifier");
|
||||
verify.not.completionListContains("FooProp");
|
||||
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("file2Identifier1");
|
||||
verify.completionListContains("file2Identifier2");
|
||||
verify.not.completionListContains("file1Identifier")
|
||||
verify.not.completionListContains("FooProp");
|
||||
13
tests/cases/fourslash/getJavaScriptCompletions14.ts
Normal file
13
tests/cases/fourslash/getJavaScriptCompletions14.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: file1.js
|
||||
/////// <reference no-default-lib="true"/>
|
||||
////interface Number {
|
||||
//// toExponential(fractionDigits?: number): string;
|
||||
////}
|
||||
////var x = 1;
|
||||
////x./*1*/
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
29
tests/cases/fourslash/getJavaScriptCompletions15.ts
Normal file
29
tests/cases/fourslash/getJavaScriptCompletions15.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: refFile1.ts
|
||||
//// export var V = 1;
|
||||
|
||||
// @Filename: refFile2.ts
|
||||
//// export var V = "123"
|
||||
|
||||
// @Filename: refFile3.ts
|
||||
//// export var V = "123"
|
||||
|
||||
// @Filename: main.js
|
||||
//// import ref1 = require("refFile1");
|
||||
//// var ref2 = require("refFile2");
|
||||
//// ref1.V./*1*/;
|
||||
//// ref2.V./*2*/;
|
||||
//// var v = { x: require("refFile3") };
|
||||
//// v.x./*3*/;
|
||||
//// v.x.V./*4*/;
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("toExponential");
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("toLowerCase");
|
||||
goTo.marker("3");
|
||||
verify.completionListContains("V");
|
||||
goTo.marker("4");
|
||||
verify.completionListContains("toLowerCase");
|
||||
10
tests/cases/fourslash/getJavaScriptCompletions2.ts
Normal file
10
tests/cases/fourslash/getJavaScriptCompletions2.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @type {(number|string)} */
|
||||
////var v;
|
||||
////v./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("valueOf", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
10
tests/cases/fourslash/getJavaScriptCompletions3.ts
Normal file
10
tests/cases/fourslash/getJavaScriptCompletions3.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @type {Array.<number>} */
|
||||
////var v;
|
||||
////v./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("concat", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
10
tests/cases/fourslash/getJavaScriptCompletions4.ts
Normal file
10
tests/cases/fourslash/getJavaScriptCompletions4.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @return {number} */
|
||||
////function foo(a,b) { }
|
||||
////foo(1,2)./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
15
tests/cases/fourslash/getJavaScriptCompletions5.ts
Normal file
15
tests/cases/fourslash/getJavaScriptCompletions5.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
//// /**
|
||||
//// * @template T
|
||||
//// * @param {T} a
|
||||
//// * @return {T} */
|
||||
//// function foo(a) { }
|
||||
//// let x = /*1*/foo;
|
||||
//// foo(1)./**/
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
13
tests/cases/fourslash/getJavaScriptCompletions6.ts
Normal file
13
tests/cases/fourslash/getJavaScriptCompletions6.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////**
|
||||
//// * @param {...number} a
|
||||
//// */
|
||||
////function foo(a) {
|
||||
//// a./**/
|
||||
////}
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("concat", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
13
tests/cases/fourslash/getJavaScriptCompletions7.ts
Normal file
13
tests/cases/fourslash/getJavaScriptCompletions7.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////**
|
||||
//// * @param {...number} a
|
||||
//// */
|
||||
////function foo(a) {
|
||||
//// a[0]./**/
|
||||
////}
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
12
tests/cases/fourslash/getJavaScriptCompletions8.ts
Normal file
12
tests/cases/fourslash/getJavaScriptCompletions8.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////**
|
||||
//// * @type {function(): number}
|
||||
//// */
|
||||
////var v;
|
||||
////v()./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
12
tests/cases/fourslash/getJavaScriptCompletions9.ts
Normal file
12
tests/cases/fourslash/getJavaScriptCompletions9.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////**
|
||||
//// * @type {function(new:number)}
|
||||
//// */
|
||||
////var v;
|
||||
////new v()./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
9
tests/cases/fourslash/getJavaScriptQuickInfo1.ts
Normal file
9
tests/cases/fourslash/getJavaScriptQuickInfo1.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @type {function(new:string,number)} */
|
||||
////var /**/v;
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('var v: new (p1: number) => string');
|
||||
9
tests/cases/fourslash/getJavaScriptQuickInfo2.ts
Normal file
9
tests/cases/fourslash/getJavaScriptQuickInfo2.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @param {number} [a] */
|
||||
////function /**/f(a) { }
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('function f(a?: number): void');
|
||||
9
tests/cases/fourslash/getJavaScriptQuickInfo3.ts
Normal file
9
tests/cases/fourslash/getJavaScriptQuickInfo3.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @param {number[]} [a] */
|
||||
////function /**/f(a) { }
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('function f(a?: number[]): void');
|
||||
9
tests/cases/fourslash/getJavaScriptQuickInfo4.ts
Normal file
9
tests/cases/fourslash/getJavaScriptQuickInfo4.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @param {[number,string]} [a] */
|
||||
////function /**/f(a) { }
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('function f(a?: [number, string]): void');
|
||||
9
tests/cases/fourslash/getJavaScriptQuickInfo5.ts
Normal file
9
tests/cases/fourslash/getJavaScriptQuickInfo5.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @param {{b:number}} [a] */
|
||||
////function /**/f(a) { }
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('function f(a?: {\n b: number;\n}): void');
|
||||
9
tests/cases/fourslash/getJavaScriptQuickInfo6.ts
Normal file
9
tests/cases/fourslash/getJavaScriptQuickInfo6.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @type {function(this:number)} */
|
||||
////function f() { /**/this }
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('number');
|
||||
@@ -1,16 +0,0 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
//// var v = <string>undefined;
|
||||
|
||||
verify.getSyntacticDiagnostics(`[]`);
|
||||
verify.getSemanticDiagnostics(`[
|
||||
{
|
||||
"message": "'type assertion expressions' can only be used in a .ts file.",
|
||||
"start": 9,
|
||||
"length": 6,
|
||||
"category": "error",
|
||||
"code": 8016
|
||||
}
|
||||
]`);
|
||||
12
tests/cases/fourslash/javaScriptModulesError1.ts
Normal file
12
tests/cases/fourslash/javaScriptModulesError1.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// Error: Having more function parameters than entries in the dependency array
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
//// define('mod1', ['a'], /**/function(a, b) {
|
||||
////
|
||||
//// });
|
||||
|
||||
// TODO: what should happen?
|
||||
goTo.marker();
|
||||
@@ -1,4 +1,5 @@
|
||||
/// <reference path="..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path="..\..\..\src\harness\external\chai.d.ts" />
|
||||
/// <reference path="..\..\..\src\compiler\parser.ts" />
|
||||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||
|
||||
@@ -985,15 +986,29 @@ module ts {
|
||||
describe("DocComments", () => {
|
||||
function parsesCorrectly(content: string, expected: string) {
|
||||
let comment = parseIsolatedJSDocComment(content);
|
||||
Debug.assert(comment && comment.diagnostics.length === 0);
|
||||
if (!comment) {
|
||||
Debug.fail('Comment failed to parse entirely');
|
||||
}
|
||||
if (comment.diagnostics.length > 0) {
|
||||
Debug.fail('Comment has at least one diagnostic: ' + comment.diagnostics[0].messageText);
|
||||
}
|
||||
|
||||
let result = JSON.stringify(comment.jsDocComment, (k, v) => {
|
||||
return v && v.pos !== undefined
|
||||
? JSON.parse(Utils.sourceFileToJSON(v))
|
||||
: v;
|
||||
}, " ");
|
||||
}, 4);
|
||||
|
||||
assert.equal(result, expected);
|
||||
if (result !== expected) {
|
||||
// Turn on a human-readable diff
|
||||
if (typeof require !== 'undefined') {
|
||||
require('chai').config.showDiff = true;
|
||||
chai.expect(JSON.parse(result)).equal(JSON.parse(expected));
|
||||
}
|
||||
else {
|
||||
assert.equal(result, expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parsesIncorrectly(content: string) {
|
||||
@@ -1577,7 +1592,7 @@ module ts {
|
||||
"0": {
|
||||
"kind": "JSDocParameterTag",
|
||||
"pos": 8,
|
||||
"end": 30,
|
||||
"end": 31,
|
||||
"atToken": {
|
||||
"kind": "AtToken",
|
||||
"pos": 8,
|
||||
@@ -1609,7 +1624,7 @@ module ts {
|
||||
},
|
||||
"length": 1,
|
||||
"pos": 8,
|
||||
"end": 30
|
||||
"end": 31
|
||||
}
|
||||
}`);
|
||||
});
|
||||
@@ -1627,7 +1642,7 @@ module ts {
|
||||
"0": {
|
||||
"kind": "JSDocParameterTag",
|
||||
"pos": 8,
|
||||
"end": 31,
|
||||
"end": 36,
|
||||
"atToken": {
|
||||
"kind": "AtToken",
|
||||
"pos": 8,
|
||||
@@ -1659,7 +1674,7 @@ module ts {
|
||||
},
|
||||
"length": 1,
|
||||
"pos": 8,
|
||||
"end": 31
|
||||
"end": 36
|
||||
}
|
||||
}`);
|
||||
});
|
||||
@@ -2113,7 +2128,7 @@ module ts {
|
||||
"0": {
|
||||
"kind": "JSDocTemplateTag",
|
||||
"pos": 8,
|
||||
"end": 24,
|
||||
"end": 23,
|
||||
"atToken": {
|
||||
"kind": "AtToken",
|
||||
"pos": 8,
|
||||
@@ -2150,12 +2165,12 @@ module ts {
|
||||
},
|
||||
"length": 2,
|
||||
"pos": 17,
|
||||
"end": 24
|
||||
"end": 23
|
||||
}
|
||||
},
|
||||
"length": 1,
|
||||
"pos": 8,
|
||||
"end": 24
|
||||
"end": 23
|
||||
}
|
||||
}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user