mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Merge branch 'master' into exportDefaultType
Conflicts: src/compiler/checker.ts
This commit is contained in:
@@ -1238,8 +1238,6 @@ declare module "typescript" {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
stripInternal?: boolean;
|
||||
preserveNewLines?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
const enum ModuleKind {
|
||||
@@ -1481,7 +1479,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;
|
||||
@@ -1489,7 +1487,7 @@ declare module "typescript" {
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the language service API */
|
||||
var servicesVersion: string;
|
||||
let servicesVersion: string;
|
||||
interface Node {
|
||||
getSourceFile(): SourceFile;
|
||||
getChildCount(sourceFile?: SourceFile): number;
|
||||
@@ -1976,7 +1974,7 @@ declare module "typescript" {
|
||||
throwIfCancellationRequested(): void;
|
||||
}
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
var disableIncrementalParsing: boolean;
|
||||
let disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createDocumentRegistry(): DocumentRegistry;
|
||||
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
|
||||
|
||||
@@ -3951,12 +3951,6 @@ declare module "typescript" {
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
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
|
||||
>Node : Node
|
||||
|
||||
>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
|
||||
>signatureDeclaration : SignatureDeclaration
|
||||
@@ -4740,7 +4734,7 @@ declare module "typescript" {
|
||||
types: Type[];
|
||||
|
||||
>types : Type[]
|
||||
}
|
||||
>Type : Type
|
||||
|
||||
resolvedProperties: SymbolTable;
|
||||
|
||||
@@ -4772,7 +4766,7 @@ declare module "typescript" {
|
||||
constructSignatures: Signature[];
|
||||
|
||||
>constructSignatures : Signature[]
|
||||
|
||||
>Signature : Signature
|
||||
|
||||
stringIndexType: Type;
|
||||
|
||||
@@ -6122,7 +6116,7 @@ declare module "typescript" {
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
>T : T
|
||||
function modifierToFlag(token: SyntaxKind): NodeFlags;
|
||||
|
||||
>modifierToFlag : (token: SyntaxKind) => NodeFlags
|
||||
>token : SyntaxKind
|
||||
|
||||
@@ -1269,8 +1269,6 @@ declare module "typescript" {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
stripInternal?: boolean;
|
||||
preserveNewLines?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
const enum ModuleKind {
|
||||
@@ -1512,7 +1510,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;
|
||||
@@ -1520,7 +1518,7 @@ declare module "typescript" {
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the language service API */
|
||||
var servicesVersion: string;
|
||||
let servicesVersion: string;
|
||||
interface Node {
|
||||
getSourceFile(): SourceFile;
|
||||
getChildCount(sourceFile?: SourceFile): number;
|
||||
@@ -2007,7 +2005,7 @@ declare module "typescript" {
|
||||
throwIfCancellationRequested(): void;
|
||||
}
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
var disableIncrementalParsing: boolean;
|
||||
let disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createDocumentRegistry(): DocumentRegistry;
|
||||
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
|
||||
|
||||
@@ -4097,12 +4097,6 @@ declare module "typescript" {
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
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
|
||||
>Node : Node
|
||||
|
||||
>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
|
||||
>signatureDeclaration : SignatureDeclaration
|
||||
@@ -4886,7 +4880,7 @@ declare module "typescript" {
|
||||
types: Type[];
|
||||
|
||||
>types : Type[]
|
||||
}
|
||||
>Type : Type
|
||||
|
||||
resolvedProperties: SymbolTable;
|
||||
|
||||
@@ -4918,7 +4912,7 @@ declare module "typescript" {
|
||||
constructSignatures: Signature[];
|
||||
|
||||
>constructSignatures : Signature[]
|
||||
|
||||
>Signature : Signature
|
||||
|
||||
stringIndexType: Type;
|
||||
|
||||
@@ -6268,7 +6262,7 @@ declare module "typescript" {
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
>T : T
|
||||
function modifierToFlag(token: SyntaxKind): NodeFlags;
|
||||
|
||||
>modifierToFlag : (token: SyntaxKind) => NodeFlags
|
||||
>token : SyntaxKind
|
||||
|
||||
@@ -1270,8 +1270,6 @@ declare module "typescript" {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
stripInternal?: boolean;
|
||||
preserveNewLines?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
const enum ModuleKind {
|
||||
@@ -1513,7 +1511,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;
|
||||
@@ -1521,7 +1519,7 @@ declare module "typescript" {
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the language service API */
|
||||
var servicesVersion: string;
|
||||
let servicesVersion: string;
|
||||
interface Node {
|
||||
getSourceFile(): SourceFile;
|
||||
getChildCount(sourceFile?: SourceFile): number;
|
||||
@@ -2008,7 +2006,7 @@ declare module "typescript" {
|
||||
throwIfCancellationRequested(): void;
|
||||
}
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
var disableIncrementalParsing: boolean;
|
||||
let disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createDocumentRegistry(): DocumentRegistry;
|
||||
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
|
||||
|
||||
@@ -4047,12 +4047,6 @@ declare module "typescript" {
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
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
|
||||
>Node : Node
|
||||
|
||||
>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
|
||||
>signatureDeclaration : SignatureDeclaration
|
||||
@@ -4836,7 +4830,7 @@ declare module "typescript" {
|
||||
types: Type[];
|
||||
|
||||
>types : Type[]
|
||||
}
|
||||
>Type : Type
|
||||
|
||||
resolvedProperties: SymbolTable;
|
||||
|
||||
@@ -4868,7 +4862,7 @@ declare module "typescript" {
|
||||
constructSignatures: Signature[];
|
||||
|
||||
>constructSignatures : Signature[]
|
||||
|
||||
>Signature : Signature
|
||||
|
||||
stringIndexType: Type;
|
||||
|
||||
@@ -6218,7 +6212,7 @@ declare module "typescript" {
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
>T : T
|
||||
function modifierToFlag(token: SyntaxKind): NodeFlags;
|
||||
|
||||
>modifierToFlag : (token: SyntaxKind) => NodeFlags
|
||||
>token : SyntaxKind
|
||||
|
||||
@@ -1307,8 +1307,6 @@ declare module "typescript" {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
stripInternal?: boolean;
|
||||
preserveNewLines?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
const enum ModuleKind {
|
||||
@@ -1550,7 +1548,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;
|
||||
@@ -1558,7 +1556,7 @@ declare module "typescript" {
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the language service API */
|
||||
var servicesVersion: string;
|
||||
let servicesVersion: string;
|
||||
interface Node {
|
||||
getSourceFile(): SourceFile;
|
||||
getChildCount(sourceFile?: SourceFile): number;
|
||||
@@ -2045,7 +2043,7 @@ declare module "typescript" {
|
||||
throwIfCancellationRequested(): void;
|
||||
}
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
var disableIncrementalParsing: boolean;
|
||||
let disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createDocumentRegistry(): DocumentRegistry;
|
||||
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
|
||||
|
||||
@@ -4220,12 +4220,6 @@ declare module "typescript" {
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
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
|
||||
>Node : Node
|
||||
|
||||
>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
|
||||
>signatureDeclaration : SignatureDeclaration
|
||||
@@ -5009,7 +5003,7 @@ declare module "typescript" {
|
||||
types: Type[];
|
||||
|
||||
>types : Type[]
|
||||
}
|
||||
>Type : Type
|
||||
|
||||
resolvedProperties: SymbolTable;
|
||||
|
||||
@@ -5041,7 +5035,7 @@ declare module "typescript" {
|
||||
constructSignatures: Signature[];
|
||||
|
||||
>constructSignatures : Signature[]
|
||||
|
||||
>Signature : Signature
|
||||
|
||||
stringIndexType: Type;
|
||||
|
||||
@@ -6391,7 +6385,7 @@ declare module "typescript" {
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
>T : T
|
||||
function modifierToFlag(token: SyntaxKind): NodeFlags;
|
||||
|
||||
>modifierToFlag : (token: SyntaxKind) => NodeFlags
|
||||
>token : SyntaxKind
|
||||
|
||||
28
tests/baselines/reference/letConstMatchingParameterNames.js
Normal file
28
tests/baselines/reference/letConstMatchingParameterNames.js
Normal file
@@ -0,0 +1,28 @@
|
||||
//// [letConstMatchingParameterNames.ts]
|
||||
let parent = true;
|
||||
const parent2 = true;
|
||||
declare function use(a: any);
|
||||
|
||||
function a() {
|
||||
|
||||
let parent = 1;
|
||||
const parent2 = 2;
|
||||
|
||||
function b(parent: string, parent2: number) {
|
||||
use(parent);
|
||||
use(parent2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [letConstMatchingParameterNames.js]
|
||||
var parent = true;
|
||||
var parent2 = true;
|
||||
function a() {
|
||||
var _parent = 1;
|
||||
var _parent2 = 2;
|
||||
function b(parent, parent2) {
|
||||
use(parent);
|
||||
use(parent2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
=== tests/cases/compiler/letConstMatchingParameterNames.ts ===
|
||||
let parent = true;
|
||||
>parent : boolean
|
||||
|
||||
const parent2 = true;
|
||||
>parent2 : boolean
|
||||
|
||||
declare function use(a: any);
|
||||
>use : (a: any) => any
|
||||
>a : any
|
||||
|
||||
function a() {
|
||||
>a : () => void
|
||||
|
||||
let parent = 1;
|
||||
>parent : number
|
||||
|
||||
const parent2 = 2;
|
||||
>parent2 : number
|
||||
|
||||
function b(parent: string, parent2: number) {
|
||||
>b : (parent: string, parent2: number) => void
|
||||
>parent : string
|
||||
>parent2 : number
|
||||
|
||||
use(parent);
|
||||
>use(parent) : any
|
||||
>use : (a: any) => any
|
||||
>parent : string
|
||||
|
||||
use(parent2);
|
||||
>use(parent2) : any
|
||||
>use : (a: any) => any
|
||||
>parent2 : number
|
||||
}
|
||||
}
|
||||
|
||||
11
tests/baselines/reference/letInNonStrictMode.js
Normal file
11
tests/baselines/reference/letInNonStrictMode.js
Normal file
@@ -0,0 +1,11 @@
|
||||
//// [letInNonStrictMode.ts]
|
||||
let [x] = [1];
|
||||
let {a: y} = {a: 1};
|
||||
|
||||
//// [letInNonStrictMode.js]
|
||||
var x = ([
|
||||
1
|
||||
])[0];
|
||||
var y = ({
|
||||
a: 1
|
||||
}).a;
|
||||
11
tests/baselines/reference/letInNonStrictMode.types
Normal file
11
tests/baselines/reference/letInNonStrictMode.types
Normal file
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/letInNonStrictMode.ts ===
|
||||
let [x] = [1];
|
||||
>x : number
|
||||
>[1] : [number]
|
||||
|
||||
let {a: y} = {a: 1};
|
||||
>a : unknown
|
||||
>y : number
|
||||
>{a: 1} : { a: number; }
|
||||
>a : number
|
||||
|
||||
@@ -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'.
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
15
tests/cases/compiler/letConstMatchingParameterNames.ts
Normal file
15
tests/cases/compiler/letConstMatchingParameterNames.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
// @target: es5
|
||||
let parent = true;
|
||||
const parent2 = true;
|
||||
declare function use(a: any);
|
||||
|
||||
function a() {
|
||||
|
||||
let parent = 1;
|
||||
const parent2 = 2;
|
||||
|
||||
function b(parent: string, parent2: number) {
|
||||
use(parent);
|
||||
use(parent2);
|
||||
}
|
||||
}
|
||||
2
tests/cases/compiler/letInNonStrictMode.ts
Normal file
2
tests/cases/compiler/letInNonStrictMode.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
let [x] = [1];
|
||||
let {a: y} = {a: 1};
|
||||
@@ -0,0 +1,10 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
24
tests/cases/fourslash/navbar_exportDefault.ts
Normal file
24
tests/cases/fourslash/navbar_exportDefault.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: a.ts
|
||||
//// {| "itemName": "default", "kind": "class", "parentName": "" |}export default class { }
|
||||
|
||||
// @Filename: b.ts
|
||||
//// {| "itemName": "C", "kind": "class", "parentName": "" |}export default class C { }
|
||||
|
||||
// @Filename: c.ts
|
||||
//// {| "itemName": "default", "kind": "function", "parentName": "" |}export default function { }
|
||||
|
||||
// @Filename: d.ts
|
||||
//// {| "itemName": "Func", "kind": "function", "parentName": "" |}export default function Func { }
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
goTo.file(marker.fileName);
|
||||
verify.getScriptLexicalStructureListContains(
|
||||
marker.data.itemName,
|
||||
marker.data.kind,
|
||||
marker.fileName,
|
||||
marker.data.parentName,
|
||||
marker.data.isAdditionalRange,
|
||||
marker.position);
|
||||
});
|
||||
Reference in New Issue
Block a user