Merge branch 'master' into DtsExports_all

This commit is contained in:
Vladimir Matveev
2015-03-16 16:22:28 -07:00
61 changed files with 11644 additions and 24472 deletions

View File

@@ -553,6 +553,9 @@ declare module "typescript" {
name?: Identifier;
body: Block | Expression;
}
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
equalsGreaterThanToken: Node;
}
interface LiteralExpression extends PrimaryExpression {
text: string;
isUnterminated?: boolean;
@@ -762,7 +765,8 @@ declare module "typescript" {
type ExportSpecifier = ImportOrExportSpecifier;
interface ExportAssignment extends Declaration, ModuleElement {
isExportEquals?: boolean;
expression: Expression;
expression?: Expression;
type?: TypeNode;
}
interface FileReference extends TextRange {
fileName: string;
@@ -1239,8 +1243,6 @@ declare module "typescript" {
target?: ScriptTarget;
version?: boolean;
watch?: boolean;
stripInternal?: boolean;
preserveNewLines?: boolean;
[option: string]: string | number | boolean;
}
const enum ModuleKind {
@@ -1482,7 +1484,7 @@ declare module "typescript" {
}
declare module "typescript" {
/** The version of the TypeScript compiler release */
var version: string;
let version: string;
function createCompilerHost(options: CompilerOptions): CompilerHost;
function getPreEmitDiagnostics(program: Program): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;

View File

@@ -1668,6 +1668,15 @@ declare module "typescript" {
>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern
>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern
questionToken?: Node;
>questionToken : Node
>Node : Node
initializer: Expression;
>initializer : Expression
>Expression : Expression
}
@@ -2324,9 +2333,13 @@ declare module "typescript" {
>ElementAccessExpression : ElementAccessExpression
>MemberExpression : MemberExpression
>LeftHandSideExpression : LeftHandSideExpression
expression: LeftHandSideExpression;
>expression : LeftHandSideExpression
>LeftHandSideExpression : LeftHandSideExpression
argumentExpression?: Expression;
>argumentExpression : Expression
>Expression : Expression
}
@@ -3958,12 +3971,6 @@ declare module "typescript" {
>enclosingDeclaration : Node
>Node : Node
>flags : TypeFormatFlags
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
>signatureDeclaration : SignatureDeclaration
>SignatureDeclaration : SignatureDeclaration
>enclosingDeclaration : Node
>TypeFormatFlags : TypeFormatFlags
>writer : SymbolWriter
>SymbolWriter : SymbolWriter
@@ -4747,7 +4754,7 @@ declare module "typescript" {
interface UnionType extends Type {
>UnionType : UnionType
>SymbolTable : SymbolTable
>Type : Type
types: Type[];

View File

@@ -584,6 +584,9 @@ declare module "typescript" {
name?: Identifier;
body: Block | Expression;
}
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
equalsGreaterThanToken: Node;
}
interface LiteralExpression extends PrimaryExpression {
text: string;
isUnterminated?: boolean;
@@ -793,7 +796,8 @@ declare module "typescript" {
type ExportSpecifier = ImportOrExportSpecifier;
interface ExportAssignment extends Declaration, ModuleElement {
isExportEquals?: boolean;
expression: Expression;
expression?: Expression;
type?: TypeNode;
}
interface FileReference extends TextRange {
fileName: string;
@@ -1270,8 +1274,6 @@ declare module "typescript" {
target?: ScriptTarget;
version?: boolean;
watch?: boolean;
stripInternal?: boolean;
preserveNewLines?: boolean;
[option: string]: string | number | boolean;
}
const enum ModuleKind {
@@ -1513,7 +1515,7 @@ declare module "typescript" {
}
declare module "typescript" {
/** The version of the TypeScript compiler release */
var version: string;
let version: string;
function createCompilerHost(options: CompilerOptions): CompilerHost;
function getPreEmitDiagnostics(program: Program): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;

View File

@@ -1814,6 +1814,15 @@ declare module "typescript" {
>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern
>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern
questionToken?: Node;
>questionToken : Node
>Node : Node
initializer: Expression;
>initializer : Expression
>Expression : Expression
}
@@ -2470,9 +2479,13 @@ declare module "typescript" {
>ElementAccessExpression : ElementAccessExpression
>MemberExpression : MemberExpression
>LeftHandSideExpression : LeftHandSideExpression
expression: LeftHandSideExpression;
>expression : LeftHandSideExpression
>LeftHandSideExpression : LeftHandSideExpression
argumentExpression?: Expression;
>argumentExpression : Expression
>Expression : Expression
}
@@ -4104,12 +4117,6 @@ declare module "typescript" {
>enclosingDeclaration : Node
>Node : Node
>flags : TypeFormatFlags
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
>signatureDeclaration : SignatureDeclaration
>SignatureDeclaration : SignatureDeclaration
>enclosingDeclaration : Node
>TypeFormatFlags : TypeFormatFlags
>writer : SymbolWriter
>SymbolWriter : SymbolWriter
@@ -4893,7 +4900,7 @@ declare module "typescript" {
interface UnionType extends Type {
>UnionType : UnionType
>SymbolTable : SymbolTable
>Type : Type
types: Type[];

View File

@@ -585,6 +585,9 @@ declare module "typescript" {
name?: Identifier;
body: Block | Expression;
}
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
equalsGreaterThanToken: Node;
}
interface LiteralExpression extends PrimaryExpression {
text: string;
isUnterminated?: boolean;
@@ -794,7 +797,8 @@ declare module "typescript" {
type ExportSpecifier = ImportOrExportSpecifier;
interface ExportAssignment extends Declaration, ModuleElement {
isExportEquals?: boolean;
expression: Expression;
expression?: Expression;
type?: TypeNode;
}
interface FileReference extends TextRange {
fileName: string;
@@ -1271,8 +1275,6 @@ declare module "typescript" {
target?: ScriptTarget;
version?: boolean;
watch?: boolean;
stripInternal?: boolean;
preserveNewLines?: boolean;
[option: string]: string | number | boolean;
}
const enum ModuleKind {
@@ -1514,7 +1516,7 @@ declare module "typescript" {
}
declare module "typescript" {
/** The version of the TypeScript compiler release */
var version: string;
let version: string;
function createCompilerHost(options: CompilerOptions): CompilerHost;
function getPreEmitDiagnostics(program: Program): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;

View File

@@ -1764,6 +1764,15 @@ declare module "typescript" {
>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern
>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern
questionToken?: Node;
>questionToken : Node
>Node : Node
initializer: Expression;
>initializer : Expression
>Expression : Expression
}
@@ -2420,9 +2429,13 @@ declare module "typescript" {
>ElementAccessExpression : ElementAccessExpression
>MemberExpression : MemberExpression
>LeftHandSideExpression : LeftHandSideExpression
expression: LeftHandSideExpression;
>expression : LeftHandSideExpression
>LeftHandSideExpression : LeftHandSideExpression
argumentExpression?: Expression;
>argumentExpression : Expression
>Expression : Expression
}
@@ -4054,12 +4067,6 @@ declare module "typescript" {
>enclosingDeclaration : Node
>Node : Node
>flags : TypeFormatFlags
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
>signatureDeclaration : SignatureDeclaration
>SignatureDeclaration : SignatureDeclaration
>enclosingDeclaration : Node
>TypeFormatFlags : TypeFormatFlags
>writer : SymbolWriter
>SymbolWriter : SymbolWriter
@@ -4843,7 +4850,7 @@ declare module "typescript" {
interface UnionType extends Type {
>UnionType : UnionType
>SymbolTable : SymbolTable
>Type : Type
types: Type[];

View File

@@ -622,6 +622,9 @@ declare module "typescript" {
name?: Identifier;
body: Block | Expression;
}
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
equalsGreaterThanToken: Node;
}
interface LiteralExpression extends PrimaryExpression {
text: string;
isUnterminated?: boolean;
@@ -831,7 +834,8 @@ declare module "typescript" {
type ExportSpecifier = ImportOrExportSpecifier;
interface ExportAssignment extends Declaration, ModuleElement {
isExportEquals?: boolean;
expression: Expression;
expression?: Expression;
type?: TypeNode;
}
interface FileReference extends TextRange {
fileName: string;
@@ -1308,8 +1312,6 @@ declare module "typescript" {
target?: ScriptTarget;
version?: boolean;
watch?: boolean;
stripInternal?: boolean;
preserveNewLines?: boolean;
[option: string]: string | number | boolean;
}
const enum ModuleKind {
@@ -1551,7 +1553,7 @@ declare module "typescript" {
}
declare module "typescript" {
/** The version of the TypeScript compiler release */
var version: string;
let version: string;
function createCompilerHost(options: CompilerOptions): CompilerHost;
function getPreEmitDiagnostics(program: Program): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;

View File

@@ -1937,6 +1937,15 @@ declare module "typescript" {
>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern
>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern
questionToken?: Node;
>questionToken : Node
>Node : Node
initializer: Expression;
>initializer : Expression
>Expression : Expression
}
@@ -2593,9 +2602,13 @@ declare module "typescript" {
>ElementAccessExpression : ElementAccessExpression
>MemberExpression : MemberExpression
>LeftHandSideExpression : LeftHandSideExpression
expression: LeftHandSideExpression;
>expression : LeftHandSideExpression
>LeftHandSideExpression : LeftHandSideExpression
argumentExpression?: Expression;
>argumentExpression : Expression
>Expression : Expression
}
@@ -4227,12 +4240,6 @@ declare module "typescript" {
>enclosingDeclaration : Node
>Node : Node
>flags : TypeFormatFlags
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
>signatureDeclaration : SignatureDeclaration
>SignatureDeclaration : SignatureDeclaration
>enclosingDeclaration : Node
>TypeFormatFlags : TypeFormatFlags
>writer : SymbolWriter
>SymbolWriter : SymbolWriter
@@ -5016,7 +5023,7 @@ declare module "typescript" {
interface UnionType extends Type {
>UnionType : UnionType
>SymbolTable : SymbolTable
>Type : Type
types: Type[];

View File

@@ -0,0 +1,131 @@
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(2,5): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(4,7): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(6,5): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(8,7): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(10,5): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(12,7): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(14,5): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(16,7): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(18,5): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(21,5): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(23,8): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(26,8): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(52,5): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(54,5): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(59,13): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(63,13): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(68,13): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(72,9): error TS1200: Line terminator not permitted before arrow.
==== tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts (18 errors) ====
var f1 = ()
=> { }
~~
!!! error TS1200: Line terminator not permitted before arrow.
var f2 = (x: string, y: string) /*
*/ => { }
~~
!!! error TS1200: Line terminator not permitted before arrow.
var f3 = (x: string, y: number, ...rest)
=> { }
~~
!!! error TS1200: Line terminator not permitted before arrow.
var f4 = (x: string, y: number, ...rest) /*
*/ => { }
~~
!!! error TS1200: Line terminator not permitted before arrow.
var f5 = (...rest)
=> { }
~~
!!! error TS1200: Line terminator not permitted before arrow.
var f6 = (...rest) /*
*/ => { }
~~
!!! error TS1200: Line terminator not permitted before arrow.
var f7 = (x: string, y: number, z = 10)
=> { }
~~
!!! error TS1200: Line terminator not permitted before arrow.
var f8 = (x: string, y: number, z = 10) /*
*/ => { }
~~
!!! error TS1200: Line terminator not permitted before arrow.
var f9 = (a: number): number
=> a;
~~
!!! error TS1200: Line terminator not permitted before arrow.
var f10 = (a: number) :
number
=> a
~~
!!! error TS1200: Line terminator not permitted before arrow.
var f11 = (a: number): number /*
*/ => a;
~~
!!! error TS1200: Line terminator not permitted before arrow.
var f12 = (a: number) :
number /*
*/ => a
~~
!!! error TS1200: Line terminator not permitted before arrow.
// Should be valid.
var f11 = (a: number
) => a;
// Should be valid.
var f12 = (a: number)
: number => a;
// Should be valid.
var f13 = (a: number):
number => a;
// Should be valid.
var f14 = () /* */ => {}
// Should be valid.
var f15 = (a: number): number /* */ => a
// Should be valid.
var f16 = (a: number, b = 10):
number /* */ => a + b;
function foo(func: () => boolean) { }
foo(()
=> true);
~~
!!! error TS1200: Line terminator not permitted before arrow.
foo(()
=> { return false; });
~~
!!! error TS1200: Line terminator not permitted before arrow.
module m {
class City {
constructor(x: number, thing = ()
=> 100) {
~~
!!! error TS1200: Line terminator not permitted before arrow.
}
public m = ()
=> 2 * 2 * 2
~~
!!! error TS1200: Line terminator not permitted before arrow.
}
export enum Enum {
claw = (()
=> 10)()
~~
!!! error TS1200: Line terminator not permitted before arrow.
}
export var v = x
=> new City(Enum.claw);
~~
!!! error TS1200: Line terminator not permitted before arrow.
}

View File

@@ -0,0 +1,178 @@
//// [disallowLineTerminatorBeforeArrow.ts]
var f1 = ()
=> { }
var f2 = (x: string, y: string) /*
*/ => { }
var f3 = (x: string, y: number, ...rest)
=> { }
var f4 = (x: string, y: number, ...rest) /*
*/ => { }
var f5 = (...rest)
=> { }
var f6 = (...rest) /*
*/ => { }
var f7 = (x: string, y: number, z = 10)
=> { }
var f8 = (x: string, y: number, z = 10) /*
*/ => { }
var f9 = (a: number): number
=> a;
var f10 = (a: number) :
number
=> a
var f11 = (a: number): number /*
*/ => a;
var f12 = (a: number) :
number /*
*/ => a
// Should be valid.
var f11 = (a: number
) => a;
// Should be valid.
var f12 = (a: number)
: number => a;
// Should be valid.
var f13 = (a: number):
number => a;
// Should be valid.
var f14 = () /* */ => {}
// Should be valid.
var f15 = (a: number): number /* */ => a
// Should be valid.
var f16 = (a: number, b = 10):
number /* */ => a + b;
function foo(func: () => boolean) { }
foo(()
=> true);
foo(()
=> { return false; });
module m {
class City {
constructor(x: number, thing = ()
=> 100) {
}
public m = ()
=> 2 * 2 * 2
}
export enum Enum {
claw = (()
=> 10)()
}
export var v = x
=> new City(Enum.claw);
}
//// [disallowLineTerminatorBeforeArrow.js]
var f1 = function () {
};
var f2 = function (x, y) {
};
var f3 = function (x, y) {
var rest = [];
for (var _i = 2; _i < arguments.length; _i++) {
rest[_i - 2] = arguments[_i];
}
};
var f4 = function (x, y) {
var rest = [];
for (var _i = 2; _i < arguments.length; _i++) {
rest[_i - 2] = arguments[_i];
}
};
var f5 = function () {
var rest = [];
for (var _i = 0; _i < arguments.length; _i++) {
rest[_i - 0] = arguments[_i];
}
};
var f6 = function () {
var rest = [];
for (var _i = 0; _i < arguments.length; _i++) {
rest[_i - 0] = arguments[_i];
}
};
var f7 = function (x, y, z) {
if (z === void 0) { z = 10; }
};
var f8 = function (x, y, z) {
if (z === void 0) { z = 10; }
};
var f9 = function (a) {
return a;
};
var f10 = function (a) {
return a;
};
var f11 = function (a) {
return a;
};
var f12 = function (a) {
return a;
};
// Should be valid.
var f11 = function (a) {
return a;
};
// Should be valid.
var f12 = function (a) {
return a;
};
// Should be valid.
var f13 = function (a) {
return a;
};
// Should be valid.
var f14 = function () {
};
// Should be valid.
var f15 = function (a) {
return a;
};
// Should be valid.
var f16 = function (a, b) {
if (b === void 0) { b = 10; }
return a + b;
};
function foo(func) {
}
foo(function () {
return true;
});
foo(function () {
return false;
});
var m;
(function (m) {
var City = (function () {
function City(x, thing) {
if (thing === void 0) { thing = function () {
return 100;
}; }
this.m = function () {
return 2 * 2 * 2;
};
}
return City;
})();
(function (Enum) {
Enum[Enum["claw"] = (function () {
return 10;
})()] = "claw";
})(m.Enum || (m.Enum = {}));
var Enum = m.Enum;
m.v = function (x) {
return new City(Enum.claw);
};
})(m || (m = {}));

View File

@@ -0,0 +1,8 @@
tests/cases/compiler/exportDefaultTypeAnnoation.ts(2,18): error TS1201: A type annotation on an export statement is only allowed in an ambient external module declaration.
==== tests/cases/compiler/exportDefaultTypeAnnoation.ts (1 errors) ====
export default : number;
~~~~~~
!!! error TS1201: A type annotation on an export statement is only allowed in an ambient external module declaration.

View File

@@ -0,0 +1,6 @@
//// [exportDefaultTypeAnnoation.ts]
export default : number;
//// [exportDefaultTypeAnnoation.js]
module.exports = ;

View File

@@ -0,0 +1,7 @@
//// [exportDefaultTypeAnnoation2.ts]
declare module "mod" {
export default : number;
}
//// [exportDefaultTypeAnnoation2.js]

View File

@@ -0,0 +1,6 @@
=== tests/cases/compiler/exportDefaultTypeAnnoation2.ts ===
No type information for this code.declare module "mod" {
No type information for this code. export default : number;
No type information for this code.}
No type information for this code.

View File

@@ -0,0 +1,21 @@
tests/cases/compiler/reference1.ts(2,5): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/compiler/reference2.ts(2,5): error TS2322: Type 'number' is not assignable to type 'string'.
==== tests/cases/compiler/mod.d.ts (0 errors) ====
declare module "mod" {
export default : number;
}
==== tests/cases/compiler/reference1.ts (1 errors) ====
import d from "mod";
var s: string = d; // Error
~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
==== tests/cases/compiler/reference2.ts (1 errors) ====
import { default as d } from "mod";
var s: string = d; // Error
~
!!! error TS2322: Type 'number' is not assignable to type 'string'.

View File

@@ -0,0 +1,22 @@
//// [tests/cases/compiler/exportDefaultTypeAnnoation3.ts] ////
//// [mod.d.ts]
declare module "mod" {
export default : number;
}
//// [reference1.ts]
import d from "mod";
var s: string = d; // Error
//// [reference2.ts]
import { default as d } from "mod";
var s: string = d; // Error
//// [reference1.js]
var d = require("mod");
var s = d; // Error
//// [reference2.js]
var _mod = require("mod");
var s = _mod.default; // Error

View File

@@ -0,0 +1,46 @@
//// [initializePropertiesWithRenamedLet.ts]
var x0;
if (true) {
let x0;
var obj1 = { x0: x0 };
var obj2 = { x0 };
}
var x, y, z;
if (true) {
let { x: x } = { x: 0 };
let { y } = { y: 0 };
let z;
({ z: z } = { z: 0 });
({ z } = { z: 0 });
}
//// [initializePropertiesWithRenamedLet.js]
var x0;
if (true) {
var _x0;
var obj1 = {
x0: _x0
};
var obj2 = {
x0: _x0
};
}
var x, y, z;
if (true) {
var _x = ({
x: 0
}).x;
var _y = ({
y: 0
}).y;
var _z;
(_a = {
z: 0
}, _z = _a.z, _a);
(_b = {
z: 0
}, _z = _b.z, _b);
}
var _a, _b;

View File

@@ -0,0 +1,58 @@
=== tests/cases/compiler/initializePropertiesWithRenamedLet.ts ===
var x0;
>x0 : any
if (true) {
let x0;
>x0 : any
var obj1 = { x0: x0 };
>obj1 : { x0: any; }
>{ x0: x0 } : { x0: any; }
>x0 : any
>x0 : any
var obj2 = { x0 };
>obj2 : { x0: any; }
>{ x0 } : { x0: any; }
>x0 : any
}
var x, y, z;
>x : any
>y : any
>z : any
if (true) {
let { x: x } = { x: 0 };
>x : unknown
>x : number
>{ x: 0 } : { x: number; }
>x : number
let { y } = { y: 0 };
>y : number
>{ y: 0 } : { y: number; }
>y : number
let z;
>z : any
({ z: z } = { z: 0 });
>({ z: z } = { z: 0 }) : { z: number; }
>{ z: z } = { z: 0 } : { z: number; }
>{ z: z } : { z: any; }
>z : any
>z : any
>{ z: 0 } : { z: number; }
>z : number
({ z } = { z: 0 });
>({ z } = { z: 0 }) : { z: number; }
>{ z } = { z: 0 } : { z: number; }
>{ z } : { z: any; }
>z : any
>{ z: 0 } : { z: number; }
>z : number
}

View File

@@ -0,0 +1,28 @@
tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts(4,13): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts(5,15): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts(6,18): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts(7,15): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts(8,18): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
==== tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts (5 errors) ====
if (true) {
let x;
if (true) {
var x = 0; // Error
~
!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
var { x = 0 } = { x: 0 }; // Error
~
!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
var { x: x = 0 } = { x: 0 }; // Error
~
!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
var { x } = { x: 0 }; // Error
~
!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
var { x: x } = { x: 0 }; // Error
~
!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
}
}

View File

@@ -0,0 +1,31 @@
//// [shadowingViaLocalValueOrBindingElement.ts]
if (true) {
let x;
if (true) {
var x = 0; // Error
var { x = 0 } = { x: 0 }; // Error
var { x: x = 0 } = { x: 0 }; // Error
var { x } = { x: 0 }; // Error
var { x: x } = { x: 0 }; // Error
}
}
//// [shadowingViaLocalValueOrBindingElement.js]
if (true) {
var _x;
if (true) {
var x = 0; // Error
var _a = ({
x: 0
}).x, x = _a === void 0 ? 0 : _a; // Error
var _b = ({
x: 0
}).x, x = _b === void 0 ? 0 : _b; // Error
var x = ({
x: 0
}).x; // Error
var x = ({
x: 0
}).x; // Error
}
}

View File

@@ -145,23 +145,16 @@ function someGenerics4(strs, n, f) {
// 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
function someGenerics5(strs, n, f) {
}
(_n = ["", " ", ""], _n.raw = ["", " ", ""], someGenerics5(_n, 4, function () {
(_o = ["", " ", ""], _o.raw = ["", " ", ""], someGenerics5(_o, 4, function () {
return null;
}));
(_o = ["", "", ""], _o.raw = ["", "", ""], someGenerics5(_o, '', function () {
(_p = ["", "", ""], _p.raw = ["", "", ""], someGenerics5(_p, '', function () {
return 3;
}));
(_p = ["", "", ""], _p.raw = ["", "", ""], someGenerics5(_p, null, null));
(_q = ["", "", ""], _q.raw = ["", "", ""], someGenerics5(_q, null, null));
// Generic tag with multiple arguments of function types that each have parameters of the same generic type
function someGenerics6(strs, a, b, c) {
}
(_q = ["", "", "", ""], _q.raw = ["", "", "", ""], someGenerics6(_q, function (n) {
return n;
}, function (n) {
return n;
}, function (n) {
return n;
}));
(_r = ["", "", "", ""], _r.raw = ["", "", "", ""], someGenerics6(_r, function (n) {
return n;
}, function (n) {
@@ -176,16 +169,16 @@ function someGenerics6(strs, a, b, c) {
}, function (n) {
return n;
}));
// Generic tag with multiple arguments of function types that each have parameters of different generic type
function someGenerics7(strs, a, b, c) {
}
(_t = ["", "", "", ""], _t.raw = ["", "", "", ""], someGenerics7(_t, function (n) {
(_t = ["", "", "", ""], _t.raw = ["", "", "", ""], someGenerics6(_t, function (n) {
return n;
}, function (n) {
return n;
}, function (n) {
return n;
}));
// Generic tag with multiple arguments of function types that each have parameters of different generic type
function someGenerics7(strs, a, b, c) {
}
(_u = ["", "", "", ""], _u.raw = ["", "", "", ""], someGenerics7(_u, function (n) {
return n;
}, function (n) {
@@ -200,19 +193,26 @@ function someGenerics7(strs, a, b, c) {
}, function (n) {
return n;
}));
(_w = ["", "", "", ""], _w.raw = ["", "", "", ""], someGenerics7(_w, function (n) {
return n;
}, function (n) {
return n;
}, function (n) {
return n;
}));
// Generic tag with argument of generic function type
function someGenerics8(strs, n) {
return n;
}
var x = (_w = ["", ""], _w.raw = ["", ""], someGenerics8(_w, someGenerics7));
(_x = ["", "", "", ""], _x.raw = ["", "", "", ""], x(_x, null, null, null));
var x = (_x = ["", ""], _x.raw = ["", ""], someGenerics8(_x, someGenerics7));
(_y = ["", "", "", ""], _y.raw = ["", "", "", ""], x(_y, null, null, null));
// Generic tag with multiple parameters of generic type passed arguments with no best common type
function someGenerics9(strs, a, b, c) {
return null;
}
var a9a = (_y = ["", "", "", ""], _y.raw = ["", "", "", ""], someGenerics9(_y, '', 0, []));
var a9a = (_z = ["", "", "", ""], _z.raw = ["", "", "", ""], someGenerics9(_z, '', 0, []));
var a9a;
var a9e = (_z = ["", "", "", ""], _z.raw = ["", "", "", ""], someGenerics9(_z, undefined, {
var a9e = (_0 = ["", "", "", ""], _0.raw = ["", "", "", ""], someGenerics9(_0, undefined, {
x: 6,
z: new Date()
}, {
@@ -221,7 +221,7 @@ var a9e = (_z = ["", "", "", ""], _z.raw = ["", "", "", ""], someGenerics9(_z, u
}));
var a9e;
// Generic tag with multiple parameters of generic type passed arguments with a single best common type
var a9d = (_0 = ["", "", "", ""], _0.raw = ["", "", "", ""], someGenerics9(_0, {
var a9d = (_1 = ["", "", "", ""], _1.raw = ["", "", "", ""], someGenerics9(_1, {
x: 3
}, {
x: 6
@@ -231,9 +231,9 @@ var a9d = (_0 = ["", "", "", ""], _0.raw = ["", "", "", ""], someGenerics9(_0, {
var a9d;
// Generic tag with multiple parameters of generic type where one argument is of type 'any'
var anyVar;
var a = (_1 = ["", "", "", ""], _1.raw = ["", "", "", ""], someGenerics9(_1, 7, anyVar, 4));
var a = (_2 = ["", "", "", ""], _2.raw = ["", "", "", ""], someGenerics9(_2, 7, anyVar, 4));
var a;
// Generic tag with multiple parameters of generic type where one argument is [] and the other is not 'any'
var arr = (_2 = ["", "", "", ""], _2.raw = ["", "", "", ""], someGenerics9(_2, [], null, undefined));
var arr = (_3 = ["", "", "", ""], _3.raw = ["", "", "", ""], someGenerics9(_3, [], null, undefined));
var arr;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;

View File

@@ -103,26 +103,26 @@ var s = (_k = ["", ""], _k.raw = ["", ""], fn3(_k, 4));
var s = (_l = ["", "", "", ""], _l.raw = ["", "", "", ""], fn3(_l, '', '', ''));
var n = (_m = ["", "", "", ""], _m.raw = ["", "", "", ""], fn3(_m, '', '', 3));
// Generic overloads with differing arity tagging with argument count that doesn't match any overload
(_n = [""], _n.raw = [""], fn3(_n)); // Error
(_o = [""], _o.raw = [""], fn3(_o)); // Error
function fn4() {
}
// Generic overloads with constraints tagged with types that satisfy the constraints
(_o = ["", "", ""], _o.raw = ["", "", ""], fn4(_o, '', 3));
(_p = ["", "", ""], _p.raw = ["", "", ""], fn4(_p, 3, ''));
(_q = ["", "", ""], _q.raw = ["", "", ""], fn4(_q, 3, undefined));
(_r = ["", "", ""], _r.raw = ["", "", ""], fn4(_r, '', null));
(_p = ["", "", ""], _p.raw = ["", "", ""], fn4(_p, '', 3));
(_q = ["", "", ""], _q.raw = ["", "", ""], fn4(_q, 3, ''));
(_r = ["", "", ""], _r.raw = ["", "", ""], fn4(_r, 3, undefined));
(_s = ["", "", ""], _s.raw = ["", "", ""], fn4(_s, '', null));
// Generic overloads with constraints called with type arguments that do not satisfy the constraints
(_s = ["", "", ""], _s.raw = ["", "", ""], fn4(_s, null, null)); // Error
(_t = ["", "", ""], _t.raw = ["", "", ""], fn4(_t, null, null)); // Error
// Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints
(_t = ["", "", ""], _t.raw = ["", "", ""], fn4(_t, true, null));
(_u = ["", "", ""], _u.raw = ["", "", ""], fn4(_u, null, true));
(_u = ["", "", ""], _u.raw = ["", "", ""], fn4(_u, true, null));
(_v = ["", "", ""], _v.raw = ["", "", ""], fn4(_v, null, true));
function fn5() {
return undefined;
}
(_v = ["", ""], _v.raw = ["", ""], fn5(_v, function (n) {
(_w = ["", ""], _w.raw = ["", ""], fn5(_w, function (n) {
return n.toFixed();
})); // will error; 'n' should have type 'string'.
(_w = ["", ""], _w.raw = ["", ""], fn5(_w, function (n) {
(_x = ["", ""], _x.raw = ["", ""], fn5(_x, function (n) {
return n.substr(0);
}));
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;