Merge branch 'master' into release-1.7

This commit is contained in:
Yui T
2015-10-13 15:31:01 -07:00
71 changed files with 626 additions and 144 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
language: node_js
node_js:
- '4'
- '0.10'
sudo: false
sudo: false
+64 -43
View File
@@ -383,20 +383,72 @@ namespace ts {
// return undefined if we can't find a symbol.
}
/** Returns true if node1 is defined before node 2**/
function isDefinedBefore(node1: Node, node2: Node): boolean {
let file1 = getSourceFileOfNode(node1);
let file2 = getSourceFileOfNode(node2);
if (file1 === file2) {
return node1.pos <= node2.pos;
function isBlockScopedNameDeclaredBeforeUse(declaration: Declaration, usage: Node): boolean {
const declarationFile = getSourceFileOfNode(declaration);
const useFile = getSourceFileOfNode(usage);
if (declarationFile !== useFile) {
if (modulekind || (!compilerOptions.outFile && !compilerOptions.out)) {
// nodes are in different files and order cannot be determines
return true;
}
const sourceFiles = host.getSourceFiles();
return indexOf(sourceFiles, declarationFile) <= indexOf(sourceFiles, useFile);
}
if (!compilerOptions.outFile && !compilerOptions.out) {
return true;
if (declaration.pos <= usage.pos) {
// declaration is before usage
// still might be illegal if usage is in the initializer of the variable declaration
return declaration.kind !== SyntaxKind.VariableDeclaration ||
!isImmediatelyUsedInInitializerOfBlockScopedVariable(<VariableDeclaration>declaration, usage);
}
let sourceFiles = host.getSourceFiles();
return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2);
// declaration is after usage
// can be legal if usage is deferred (i.e. inside function or in initializer of instance property)
return isUsedInFunctionOrNonStaticProperty(declaration, usage);
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration: VariableDeclaration, usage: Node): boolean {
const container = getEnclosingBlockScopeContainer(declaration);
if (declaration.parent.parent.kind === SyntaxKind.VariableStatement ||
declaration.parent.parent.kind === SyntaxKind.ForStatement) {
// variable statement/for statement case,
// use site should not be inside variable declaration (initializer of declaration or binding element)
return isSameScopeDescendentOf(usage, declaration, container);
}
else if (declaration.parent.parent.kind === SyntaxKind.ForOfStatement ||
declaration.parent.parent.kind === SyntaxKind.ForInStatement) {
// ForIn/ForOf case - use site should not be used in expression part
let expression = (<ForInStatement | ForOfStatement>declaration.parent.parent).expression;
return isSameScopeDescendentOf(usage, expression, container);
}
}
function isUsedInFunctionOrNonStaticProperty(declaration: Declaration, usage: Node): boolean {
const container = getEnclosingBlockScopeContainer(declaration);
let current = usage;
while (current) {
if (current === container) {
return false;
}
if (isFunctionLike(current)) {
return true;
}
const initializerOfNonStaticProperty = current.parent &&
current.parent.kind === SyntaxKind.PropertyDeclaration &&
(current.parent.flags & NodeFlags.Static) === 0 &&
(<PropertyDeclaration>current.parent).initializer === current;
if (initializerOfNonStaticProperty) {
return true;
}
current = current.parent;
}
return false;
}
}
// Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and
@@ -627,34 +679,7 @@ namespace ts {
Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined");
// first check if usage is lexically located after the declaration
let isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation);
if (!isUsedBeforeDeclaration) {
// lexical check succeeded however code still can be illegal.
// - block scoped variables cannot be used in its initializers
// let x = x; // illegal but usage is lexically after definition
// - in ForIn/ForOf statements variable cannot be contained in expression part
// for (let x in x)
// for (let x of x)
// climb up to the variable declaration skipping binding patterns
let variableDeclaration = <VariableDeclaration>getAncestor(declaration, SyntaxKind.VariableDeclaration);
let container = getEnclosingBlockScopeContainer(variableDeclaration);
if (variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement ||
variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement) {
// variable statement/for statement case,
// use site should not be inside variable declaration (initializer of declaration or binding element)
isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container);
}
else if (variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement ||
variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) {
// ForIn/ForOf case - use site should not be used in expression part
let expression = (<ForInStatement | ForOfStatement>variableDeclaration.parent.parent).expression;
isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container);
}
}
if (isUsedBeforeDeclaration) {
if (!isBlockScopedNameDeclaredBeforeUse(<Declaration>getAncestor(declaration, SyntaxKind.VariableDeclaration), errorLocation)) {
error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name));
}
}
@@ -11766,10 +11791,6 @@ namespace ts {
checkSignatureDeclaration(node);
let isAsync = isAsyncFunctionLike(node);
if (isAsync) {
if (!compilerOptions.experimentalAsyncFunctions) {
error(node, Diagnostics.Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning);
}
emitAwaiter = true;
}
@@ -13358,7 +13379,7 @@ namespace ts {
}
// illegal case: forward reference
if (!isDefinedBefore(propertyDecl, member)) {
if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) {
reportError = false;
error(e, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
return undefined;
-5
View File
@@ -222,11 +222,6 @@ namespace ts {
type: "boolean",
description: Diagnostics.Watch_input_files,
},
{
name: "experimentalAsyncFunctions",
type: "boolean",
description: Diagnostics.Enables_experimental_support_for_ES7_async_functions
},
{
name: "experimentalDecorators",
type: "boolean",
-8
View File
@@ -783,10 +783,6 @@
"category": "Error",
"code": 1245
},
"Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning.": {
"category": "Error",
"code": 1246
},
"'with' statements are not allowed in an async function block.": {
"category": "Error",
@@ -2282,10 +2278,6 @@
"category": "Message",
"code": 6066
},
"Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower.": {
"category": "Message",
"code": 6067
},
"Enables experimental support for ES7 async functions.": {
"category": "Message",
"code": 6068
-5
View File
@@ -1071,11 +1071,6 @@ namespace ts {
!options.experimentalDecorators) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
}
if (options.experimentalAsyncFunctions &&
options.target !== ScriptTarget.ES6) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
}
}
}
}
-1
View File
@@ -2086,7 +2086,6 @@ namespace ts {
watch?: boolean;
isolatedModules?: boolean;
experimentalDecorators?: boolean;
experimentalAsyncFunctions?: boolean;
emitDecoratorMetadata?: boolean;
moduleResolution?: ModuleResolutionKind;
/* @internal */ stripInternal?: boolean;
+10 -3
View File
@@ -591,14 +591,21 @@ namespace FourSlash {
}
}
public verifyCompletionListItemsCountIsGreaterThan(count: number) {
public verifyCompletionListItemsCountIsGreaterThan(count: number, negative: boolean) {
this.taoInvalidReason = "verifyCompletionListItemsCountIsGreaterThan NYI";
let completions = this.getCompletionListAtCaret();
let itemsCount = completions.entries.length;
if (itemsCount <= count) {
this.raiseError(`Expected completion list items count to be greater than ${count}, but is actually ${itemsCount}`);
if (negative) {
if (itemsCount > count) {
this.raiseError(`Expected completion list items count to not be greater than ${count}, but is actually ${itemsCount}`);
}
}
else {
if (itemsCount <= count) {
this.raiseError(`Expected completion list items count to be greater than ${count}, but is actually ${itemsCount}`);
}
}
}
+35 -4
View File
@@ -3112,6 +3112,7 @@ namespace ts {
let node = currentToken;
let isRightOfDot = false;
let isRightOfOpenTag = false;
let isStartingCloseTag = false;
let location = getTouchingPropertyName(sourceFile, position);
if (contextToken) {
@@ -3137,9 +3138,14 @@ namespace ts {
return undefined;
}
}
else if (kind === SyntaxKind.LessThanToken && sourceFile.languageVariant === LanguageVariant.JSX) {
isRightOfOpenTag = true;
location = contextToken;
else if (sourceFile.languageVariant === LanguageVariant.JSX) {
if (kind === SyntaxKind.LessThanToken) {
isRightOfOpenTag = true;
location = contextToken;
}
else if (kind === SyntaxKind.SlashToken && contextToken.parent.kind === SyntaxKind.JsxClosingElement) {
isStartingCloseTag = true;
}
}
}
@@ -3162,6 +3168,13 @@ namespace ts {
isMemberCompletion = true;
isNewIdentifierLocation = false;
}
else if (isStartingCloseTag) {
let tagName = (<JsxElement>contextToken.parent.parent).openingElement.tagName;
symbols = [typeChecker.getSymbolAtLocation(tagName)];
isMemberCompletion = true;
isNewIdentifierLocation = false;
}
else {
// For JavaScript or TypeScript, if we're not after a dot, then just try to get the
// global symbols in scope. These results should be valid for either language as
@@ -3318,11 +3331,29 @@ namespace ts {
let start = new Date().getTime();
let result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
isSolelyIdentifierDefinitionLocation(contextToken) ||
isDotOfNumericLiteral(contextToken);
isDotOfNumericLiteral(contextToken) ||
isInJsxText(contextToken);
log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start));
return result;
}
function isInJsxText(contextToken: Node): boolean {
if (contextToken.kind === SyntaxKind.JsxText) {
return true;
}
if (contextToken.kind === SyntaxKind.GreaterThanToken && contextToken.parent) {
if (contextToken.parent.kind === SyntaxKind.JsxOpeningElement) {
return true;
}
if (contextToken.parent.kind === SyntaxKind.JsxClosingElement || contextToken.parent.kind === SyntaxKind.JsxSelfClosingElement) {
return contextToken.parent.parent && contextToken.parent.parent.kind === SyntaxKind.JsxElement;
}
}
return false;
}
function isNewIdentifierDefinitionLocation(previousToken: Node): boolean {
if (previousToken) {
let containingNodeKind = previousToken.parent.kind;
@@ -0,0 +1,118 @@
tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(2,13): error TS2448: Block-scoped variable 'x' used before its declaration.
tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(58,20): error TS2448: Block-scoped variable 'x' used before its declaration.
tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(65,20): error TS2448: Block-scoped variable 'x' used before its declaration.
tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(100,12): error TS2448: Block-scoped variable 'x' used before its declaration.
==== tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts (4 errors) ====
function foo0() {
let a = x;
~
!!! error TS2448: Block-scoped variable 'x' used before its declaration.
let x;
}
function foo1() {
let a = () => x;
let x;
}
function foo2() {
let a = function () { return x; }
let x;
}
function foo3() {
class X {
m() { return x;}
}
let x;
}
function foo4() {
let y = class {
m() { return x; }
};
let x;
}
function foo5() {
let x = () => y;
let y = () => x;
}
function foo6() {
function f() {
return x;
}
let x;
}
function foo7() {
class A {
a = x;
}
let x;
}
function foo8() {
let y = class {
a = x;
}
let x;
}
function foo9() {
let y = class {
static a = x;
~
!!! error TS2448: Block-scoped variable 'x' used before its declaration.
}
let x;
}
function foo10() {
class A {
static a = x;
~
!!! error TS2448: Block-scoped variable 'x' used before its declaration.
}
let x;
}
function foo11() {
function f () {
let y = class {
static a = x;
}
}
let x;
}
function foo12() {
function f () {
let y = class {
a;
constructor() {
this.a = x;
}
}
}
let x;
}
function foo13() {
let a = {
get a() { return x }
}
let x
}
function foo14() {
let a = {
a: x
~
!!! error TS2448: Block-scoped variable 'x' used before its declaration.
}
let x
}
@@ -0,0 +1,216 @@
//// [blockScopedVariablesUseBeforeDef.ts]
function foo0() {
let a = x;
let x;
}
function foo1() {
let a = () => x;
let x;
}
function foo2() {
let a = function () { return x; }
let x;
}
function foo3() {
class X {
m() { return x;}
}
let x;
}
function foo4() {
let y = class {
m() { return x; }
};
let x;
}
function foo5() {
let x = () => y;
let y = () => x;
}
function foo6() {
function f() {
return x;
}
let x;
}
function foo7() {
class A {
a = x;
}
let x;
}
function foo8() {
let y = class {
a = x;
}
let x;
}
function foo9() {
let y = class {
static a = x;
}
let x;
}
function foo10() {
class A {
static a = x;
}
let x;
}
function foo11() {
function f () {
let y = class {
static a = x;
}
}
let x;
}
function foo12() {
function f () {
let y = class {
a;
constructor() {
this.a = x;
}
}
}
let x;
}
function foo13() {
let a = {
get a() { return x }
}
let x
}
function foo14() {
let a = {
a: x
}
let x
}
//// [blockScopedVariablesUseBeforeDef.js]
function foo0() {
var a = x;
var x;
}
function foo1() {
var a = function () { return x; };
var x;
}
function foo2() {
var a = function () { return x; };
var x;
}
function foo3() {
var X = (function () {
function X() {
}
X.prototype.m = function () { return x; };
return X;
})();
var x;
}
function foo4() {
var y = (function () {
function class_1() {
}
class_1.prototype.m = function () { return x; };
return class_1;
})();
var x;
}
function foo5() {
var x = function () { return y; };
var y = function () { return x; };
}
function foo6() {
function f() {
return x;
}
var x;
}
function foo7() {
var A = (function () {
function A() {
this.a = x;
}
return A;
})();
var x;
}
function foo8() {
var y = (function () {
function class_2() {
this.a = x;
}
return class_2;
})();
var x;
}
function foo9() {
var y = (function () {
function class_3() {
}
class_3.a = x;
return class_3;
})();
var x;
}
function foo10() {
var A = (function () {
function A() {
}
A.a = x;
return A;
})();
var x;
}
function foo11() {
function f() {
var y = (function () {
function class_4() {
}
class_4.a = x;
return class_4;
})();
}
var x;
}
function foo12() {
function f() {
var y = (function () {
function class_5() {
this.a = x;
}
return class_5;
})();
}
var x;
}
function foo13() {
var a = {
get a() { return x; }
};
var x;
}
function foo14() {
var a = {
a: x
};
var x;
}
@@ -1,11 +0,0 @@
tests/cases/compiler/file1.ts(2,1): error TS2448: Block-scoped variable 'c' used before its declaration.
==== tests/cases/compiler/file1.ts (1 errors) ====
c;
~
!!! error TS2448: Block-scoped variable 'c' used before its declaration.
==== tests/cases/compiler/file2.ts (0 errors) ====
const c = 0;
@@ -0,0 +1,9 @@
=== tests/cases/compiler/file1.ts ===
c;
>c : Symbol(c, Decl(file2.ts, 0, 5))
=== tests/cases/compiler/file2.ts ===
const c = 0;
>c : Symbol(c, Decl(file2.ts, 0, 5))
@@ -0,0 +1,10 @@
=== tests/cases/compiler/file1.ts ===
c;
>c : number
=== tests/cases/compiler/file2.ts ===
const c = 0;
>c : number
>0 : number
@@ -1,11 +0,0 @@
tests/cases/compiler/file1.ts(2,1): error TS2448: Block-scoped variable 'l' used before its declaration.
==== tests/cases/compiler/file1.ts (1 errors) ====
l;
~
!!! error TS2448: Block-scoped variable 'l' used before its declaration.
==== tests/cases/compiler/file2.ts (0 errors) ====
const l = 0;
@@ -0,0 +1,9 @@
=== tests/cases/compiler/file1.ts ===
l;
>l : Symbol(l, Decl(file2.ts, 0, 5))
=== tests/cases/compiler/file2.ts ===
const l = 0;
>l : Symbol(l, Decl(file2.ts, 0, 5))
@@ -0,0 +1,10 @@
=== tests/cases/compiler/file1.ts ===
l;
>l : number
=== tests/cases/compiler/file2.ts ===
const l = 0;
>l : number
>0 : number
@@ -0,0 +1,104 @@
// @target: ES5
function foo0() {
let a = x;
let x;
}
function foo1() {
let a = () => x;
let x;
}
function foo2() {
let a = function () { return x; }
let x;
}
function foo3() {
class X {
m() { return x;}
}
let x;
}
function foo4() {
let y = class {
m() { return x; }
};
let x;
}
function foo5() {
let x = () => y;
let y = () => x;
}
function foo6() {
function f() {
return x;
}
let x;
}
function foo7() {
class A {
a = x;
}
let x;
}
function foo8() {
let y = class {
a = x;
}
let x;
}
function foo9() {
let y = class {
static a = x;
}
let x;
}
function foo10() {
class A {
static a = x;
}
let x;
}
function foo11() {
function f () {
let y = class {
static a = x;
}
}
let x;
}
function foo12() {
function f () {
let y = class {
a;
constructor() {
this.a = x;
}
}
}
let x;
}
function foo13() {
let a = {
get a() { return x }
}
let x
}
function foo14() {
let a = {
a: x
}
let x
}
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
var foo = async foo(): Promise<void> => {
// Legal to use 'await' in a type context.
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
var foo = async (): Promise<void> => {
};
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
var f = (await) => {
}
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
function f(await = await) {
}
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
var await = () => {
}
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
var foo = async (await): Promise<void> => {
}
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
var foo = async (a = await): Promise<void> => {
}
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
var bar = async (): Promise<void> => {
// 'await' here is an identifier, and not an await expression.
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
var foo = async (): Promise<void> => {
var v = { [await]: foo }
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
var foo = async (a = await => await): Promise<void> => {
}
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
class C {
method() {
function other() {}
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
class C {
method() {
var fn = async () => await this;
@@ -1,6 +1,5 @@
// @target: ES6
// @isolatedModules: true
// @experimentalAsyncFunctions: true
import { MyPromise } from "missing";
declare var p: Promise<number>;
@@ -1,5 +1,4 @@
// @target: ES6
// @experimentalAsyncFunctions: true
type MyPromise<T> = Promise<T>;
declare var MyPromise: typeof Promise;
declare var p: Promise<number>;
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async class C {
}
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
class C {
async constructor() {
}
@@ -1,4 +1,3 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare async function foo(): Promise<void>;
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async enum E {
Value
}
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
class C {
async get foo() {
}
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async interface I {
}
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async module M {
}
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
class C {
async set foo(value) {
}
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: boolean;
declare var p: Promise<boolean>;
async function func(): Promise<void> {
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: boolean;
declare var p: Promise<boolean>;
async function func(): Promise<void> {
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: number;
declare var p: Promise<number>;
async function func(): Promise<void> {
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: boolean;
declare var p: Promise<boolean>;
async function func(): Promise<void> {
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: boolean;
declare var p: Promise<boolean>;
async function func(): Promise<void> {
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: boolean;
declare var p: Promise<boolean>;
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: boolean;
declare var p: Promise<boolean>;
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: boolean;
declare var p: Promise<boolean>;
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: boolean;
declare var p: Promise<boolean>;
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: boolean;
declare var p: Promise<boolean>;
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: boolean;
declare var p: Promise<boolean>;
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: boolean;
declare var p: Promise<boolean>;
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare var a: boolean;
declare var p: Promise<boolean>;
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare let a: number | string;
declare let b: PromiseLike<number> | PromiseLike<string>;
declare let c: PromiseLike<number | string>;
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async function foo(a = await => await): Promise<void> {
}
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async function await(): Promise<void> {
}
@@ -1,4 +1,3 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
var v = async function await(): Promise<void> { }
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async function foo(): Promise<void> {
// Legal to use 'await' in a type context.
var v: await;
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async function foo(): Promise<void> {
return;
}
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
declare class Thenable { then(): void; }
declare let a: any;
declare let obj: { then: string; };
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async function foo(): Promise<void> {
}
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
function f(await) {
}
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
function f(await = await) {
}
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
function await() {
}
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async function foo(await): Promise<void> {
}
@@ -1,5 +1,4 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async function foo(a = await): Promise<void> {
}
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async function bar(): Promise<void> {
// 'await' here is an identifier, and not a yield expression.
async function foo(a = await): Promise<void> {
@@ -1,4 +1,3 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
var v = { [await]: foo }
@@ -1,6 +1,5 @@
// @target: ES6
// @noEmitHelpers: true
// @experimentalAsyncFunctions: true
async function foo(): Promise<void> {
var v = { [await]: foo }
}
+1 -1
View File
@@ -212,7 +212,7 @@ module FourSlashInterface {
// Verifies the completion list items count to be greater than the specified amount. The
// completion list is brought up if necessary
public completionListItemsCountIsGreaterThan(count: number) {
FourSlash.currentTestState.verifyCompletionListItemsCountIsGreaterThan(count);
FourSlash.currentTestState.verifyCompletionListItemsCountIsGreaterThan(count, this.negative);
}
public completionListIsEmpty() {
+14
View File
@@ -0,0 +1,14 @@
/// <reference path='fourslash.ts' />
//@Filename: file.tsx
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// div: { ONE: string; TWO: number; }
//// }
//// }
//// var x1 = <div><//**/
goTo.marker();
verify.memberListCount(1);
verify.completionListContains('div');
+24
View File
@@ -0,0 +1,24 @@
/// <reference path='fourslash.ts' />
//@Filename: file.tsx
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// div: { ONE: string; TWO: number; }
//// }
//// }
//// var x1 = <div> /*1*/ hello /*2*/ world /*3*/</div>;
//// var x2 = <div> /*4*/ <div></div> /*5*/ world /*6*/</div>;
//// var x3 = <div>/*7*/<div/>/*8*/world/*9*/</div>;
//// var x4 = <div>/*10*/</div>;
//// <div/>
//// /*end*/
////
for (var i = 1; i <= 10; i++) {
goTo.marker(i + '');
verify.completionListIsEmpty();
}
goTo.marker('end');
verify.not.completionListIsEmpty();