Skip to content

Commit e02ac17

Browse files
author
Arthur Ozga
committed
Merge branch 'master' into createTypeNode
2 parents 059f5b7 + ea57fbc commit e02ac17

20 files changed

Lines changed: 460 additions & 139 deletions

issue_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->
33
<!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->
44

5-
**TypeScript Version:** 2.1.1 / nightly (2.2.0-dev.201xxxxx)
5+
**TypeScript Version:** 2.2.1 / nightly (2.2.0-dev.201xxxxx)
66

77
**Code**
88

src/compiler/binder.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2332,6 +2332,7 @@ namespace ts {
23322332

23332333
function bindThisPropertyAssignment(node: BinaryExpression) {
23342334
Debug.assert(isInJavaScriptFile(node));
2335+
const container = getThisContainer(node, /*includeArrowFunctions*/false);
23352336
switch (container.kind) {
23362337
case SyntaxKind.FunctionDeclaration:
23372338
case SyntaxKind.FunctionExpression:
@@ -2342,6 +2343,7 @@ namespace ts {
23422343
break;
23432344

23442345
case SyntaxKind.Constructor:
2346+
case SyntaxKind.PropertyDeclaration:
23452347
case SyntaxKind.MethodDeclaration:
23462348
case SyntaxKind.GetAccessor:
23472349
case SyntaxKind.SetAccessor:

src/lib/es5.d.ts

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -325,53 +325,27 @@ interface String {
325325
* Matches a string with a regular expression, and returns an array containing the results of that search.
326326
* @param regexp A variable name or string literal containing the regular expression pattern and flags.
327327
*/
328-
match(regexp: string): RegExpMatchArray | null;
329-
330-
/**
331-
* Matches a string with a regular expression, and returns an array containing the results of that search.
332-
* @param regexp A regular expression object that contains the regular expression pattern and applicable flags.
333-
*/
334-
match(regexp: RegExp): RegExpMatchArray | null;
328+
match(regexp: string | RegExp): RegExpMatchArray | null;
335329

336330
/**
337331
* Replaces text in a string, using a regular expression or search string.
338332
* @param searchValue A string to search for.
339333
* @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
340334
*/
341-
replace(searchValue: string, replaceValue: string): string;
335+
replace(searchValue: string | RegExp, replaceValue: string): string;
342336

343337
/**
344338
* Replaces text in a string, using a regular expression or search string.
345339
* @param searchValue A string to search for.
346340
* @param replacer A function that returns the replacement text.
347341
*/
348-
replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string;
349-
350-
/**
351-
* Replaces text in a string, using a regular expression or search string.
352-
* @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags.
353-
* @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
354-
*/
355-
replace(searchValue: RegExp, replaceValue: string): string;
356-
357-
/**
358-
* Replaces text in a string, using a regular expression or search string.
359-
* @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags
360-
* @param replacer A function that returns the replacement text.
361-
*/
362-
replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string;
363-
364-
/**
365-
* Finds the first substring match in a regular expression search.
366-
* @param regexp The regular expression pattern and applicable flags.
367-
*/
368-
search(regexp: string): number;
342+
replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
369343

370344
/**
371345
* Finds the first substring match in a regular expression search.
372346
* @param regexp The regular expression pattern and applicable flags.
373347
*/
374-
search(regexp: RegExp): number;
348+
search(regexp: string | RegExp): number;
375349

376350
/**
377351
* Returns a section of a string.
@@ -386,14 +360,7 @@ interface String {
386360
* @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.
387361
* @param limit A value used to limit the number of elements returned in the array.
388362
*/
389-
split(separator: string, limit?: number): string[];
390-
391-
/**
392-
* Split a string into substrings using the specified separator and return them as an array.
393-
* @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.
394-
* @param limit A value used to limit the number of elements returned in the array.
395-
*/
396-
split(separator: RegExp, limit?: number): string[];
363+
split(separator: string | RegExp, limit?: number): string[];
397364

398365
/**
399366
* Returns the substring at the specified location within a String object.
@@ -861,9 +828,9 @@ interface RegExp {
861828
}
862829

863830
interface RegExpConstructor {
864-
new (pattern: RegExp): RegExp;
831+
new (pattern: RegExp | string): RegExp;
865832
new (pattern: string, flags?: string): RegExp;
866-
(pattern: RegExp): RegExp;
833+
(pattern: RegExp | string): RegExp;
867834
(pattern: string, flags?: string): RegExp;
868835
readonly prototype: RegExp;
869836

src/server/cancellationToken/cancellationToken.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function createCancellationToken(args: string[]): ServerCancellationToken {
4848
return {
4949
isCancellationRequested: () => perRequestPipeName !== undefined && pipeExists(perRequestPipeName),
5050
setRequest(requestId: number) {
51-
currentRequestId = currentRequestId;
51+
currentRequestId = requestId;
5252
perRequestPipeName = namePrefix + requestId;
5353
},
5454
resetRequest(requestId: number) {
@@ -67,4 +67,4 @@ function createCancellationToken(args: string[]): ServerCancellationToken {
6767
};
6868
}
6969
}
70-
export = createCancellationToken;
70+
export = createCancellationToken;

tests/baselines/reference/bestChoiceType.symbols

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
(''.match(/ /) || []).map(s => s.toLowerCase());
66
>(''.match(/ /) || []).map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
7-
>''.match : Symbol(String.match, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
8-
>match : Symbol(String.match, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
7+
>''.match : Symbol(String.match, Decl(lib.d.ts, --, --))
8+
>match : Symbol(String.match, Decl(lib.d.ts, --, --))
99
>map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
1010
>s : Symbol(s, Decl(bestChoiceType.ts, 3, 26))
1111
>s.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
@@ -19,8 +19,8 @@ function f1() {
1919

2020
let x = ''.match(/ /);
2121
>x : Symbol(x, Decl(bestChoiceType.ts, 8, 7))
22-
>''.match : Symbol(String.match, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
23-
>match : Symbol(String.match, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
22+
>''.match : Symbol(String.match, Decl(lib.d.ts, --, --))
23+
>match : Symbol(String.match, Decl(lib.d.ts, --, --))
2424

2525
let y = x || [];
2626
>y : Symbol(y, Decl(bestChoiceType.ts, 9, 7))
@@ -42,8 +42,8 @@ function f2() {
4242

4343
let x = ''.match(/ /);
4444
>x : Symbol(x, Decl(bestChoiceType.ts, 14, 7))
45-
>''.match : Symbol(String.match, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
46-
>match : Symbol(String.match, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
45+
>''.match : Symbol(String.match, Decl(lib.d.ts, --, --))
46+
>match : Symbol(String.match, Decl(lib.d.ts, --, --))
4747

4848
let y = x ? x : [];
4949
>y : Symbol(y, Decl(bestChoiceType.ts, 15, 7))

tests/baselines/reference/bestChoiceType.types

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
>(''.match(/ /) || []) : RegExpMatchArray
99
>''.match(/ /) || [] : RegExpMatchArray
1010
>''.match(/ /) : RegExpMatchArray | null
11-
>''.match : { (regexp: string): RegExpMatchArray | null; (regexp: RegExp): RegExpMatchArray | null; }
11+
>''.match : (regexp: string | RegExp) => RegExpMatchArray | null
1212
>'' : ""
13-
>match : { (regexp: string): RegExpMatchArray | null; (regexp: RegExp): RegExpMatchArray | null; }
13+
>match : (regexp: string | RegExp) => RegExpMatchArray | null
1414
>/ / : RegExp
1515
>[] : never[]
1616
>map : { <U>(this: [string, string, string, string, string], callbackfn: (this: undefined, value: string, index: number, array: string[]) => U): [U, U, U, U, U]; <U>(this: [string, string, string, string, string], callbackfn: (this: undefined, value: string, index: number, array: string[]) => U, thisArg: undefined): [U, U, U, U, U]; <Z, U>(this: [string, string, string, string, string], callbackfn: (this: Z, value: string, index: number, array: string[]) => U, thisArg: Z): [U, U, U, U, U]; <U>(this: [string, string, string, string], callbackfn: (this: undefined, value: string, index: number, array: string[]) => U): [U, U, U, U]; <U>(this: [string, string, string, string], callbackfn: (this: undefined, value: string, index: number, array: string[]) => U, thisArg: undefined): [U, U, U, U]; <Z, U>(this: [string, string, string, string], callbackfn: (this: Z, value: string, index: number, array: string[]) => U, thisArg: Z): [U, U, U, U]; <U>(this: [string, string, string], callbackfn: (this: undefined, value: string, index: number, array: string[]) => U): [U, U, U]; <U>(this: [string, string, string], callbackfn: (this: undefined, value: string, index: number, array: string[]) => U, thisArg: undefined): [U, U, U]; <Z, U>(this: [string, string, string], callbackfn: (this: Z, value: string, index: number, array: string[]) => U, thisArg: Z): [U, U, U]; <U>(this: [string, string], callbackfn: (this: undefined, value: string, index: number, array: string[]) => U): [U, U]; <U>(this: [string, string], callbackfn: (this: undefined, value: string, index: number, array: string[]) => U, thisArg: undefined): [U, U]; <Z, U>(this: [string, string], callbackfn: (this: Z, value: string, index: number, array: string[]) => U, thisArg: Z): [U, U]; <U>(callbackfn: (this: undefined, value: string, index: number, array: string[]) => U): U[]; <U>(callbackfn: (this: undefined, value: string, index: number, array: string[]) => U, thisArg: undefined): U[]; <Z, U>(callbackfn: (this: Z, value: string, index: number, array: string[]) => U, thisArg: Z): U[]; }
@@ -29,9 +29,9 @@ function f1() {
2929
let x = ''.match(/ /);
3030
>x : RegExpMatchArray | null
3131
>''.match(/ /) : RegExpMatchArray | null
32-
>''.match : { (regexp: string): RegExpMatchArray | null; (regexp: RegExp): RegExpMatchArray | null; }
32+
>''.match : (regexp: string | RegExp) => RegExpMatchArray | null
3333
>'' : ""
34-
>match : { (regexp: string): RegExpMatchArray | null; (regexp: RegExp): RegExpMatchArray | null; }
34+
>match : (regexp: string | RegExp) => RegExpMatchArray | null
3535
>/ / : RegExp
3636

3737
let y = x || [];
@@ -60,9 +60,9 @@ function f2() {
6060
let x = ''.match(/ /);
6161
>x : RegExpMatchArray | null
6262
>''.match(/ /) : RegExpMatchArray | null
63-
>''.match : { (regexp: string): RegExpMatchArray | null; (regexp: RegExp): RegExpMatchArray | null; }
63+
>''.match : (regexp: string | RegExp) => RegExpMatchArray | null
6464
>'' : ""
65-
>match : { (regexp: string): RegExpMatchArray | null; (regexp: RegExp): RegExpMatchArray | null; }
65+
>match : (regexp: string | RegExp) => RegExpMatchArray | null
6666
>/ / : RegExp
6767

6868
let y = x ? x : [];

tests/baselines/reference/controlFlowPropertyDeclarations.symbols

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,15 @@ export class HTMLtoJSX {
220220
// wrapping newlines and sequences of two or more spaces in variables.
221221
text = text
222222
>text : Symbol(text, Decl(controlFlowPropertyDeclarations.ts, 113, 7))
223-
>text .replace(/\r/g, '') .replace : Symbol(String.replace, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
224-
>text .replace : Symbol(String.replace, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
223+
>text .replace(/\r/g, '') .replace : Symbol(String.replace, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
224+
>text .replace : Symbol(String.replace, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
225225
>text : Symbol(text, Decl(controlFlowPropertyDeclarations.ts, 113, 7))
226226

227227
.replace(/\r/g, '')
228-
>replace : Symbol(String.replace, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
228+
>replace : Symbol(String.replace, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
229229

230230
.replace(/( {2,}|\n|\t|\{|\})/g, function(whitespace) {
231-
>replace : Symbol(String.replace, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
231+
>replace : Symbol(String.replace, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
232232
>whitespace : Symbol(whitespace, Decl(controlFlowPropertyDeclarations.ts, 121, 50))
233233

234234
return '{' + JSON.stringify(whitespace) + '}';

tests/baselines/reference/controlFlowPropertyDeclarations.types

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,18 +295,18 @@ export class HTMLtoJSX {
295295
>text = text .replace(/\r/g, '') .replace(/( {2,}|\n|\t|\{|\})/g, function(whitespace) { return '{' + JSON.stringify(whitespace) + '}'; }) : string
296296
>text : string
297297
>text .replace(/\r/g, '') .replace(/( {2,}|\n|\t|\{|\})/g, function(whitespace) { return '{' + JSON.stringify(whitespace) + '}'; }) : string
298-
>text .replace(/\r/g, '') .replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
298+
>text .replace(/\r/g, '') .replace : { (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
299299
>text .replace(/\r/g, '') : string
300-
>text .replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
300+
>text .replace : { (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
301301
>text : string
302302

303303
.replace(/\r/g, '')
304-
>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
304+
>replace : { (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
305305
>/\r/g : RegExp
306306
>'' : ""
307307

308308
.replace(/( {2,}|\n|\t|\{|\})/g, function(whitespace) {
309-
>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
309+
>replace : { (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
310310
>/( {2,}|\n|\t|\{|\})/g : RegExp
311311
>function(whitespace) { return '{' + JSON.stringify(whitespace) + '}'; } : (whitespace: string) => string
312312
>whitespace : string

0 commit comments

Comments
 (0)