-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b60fa14
commit 779661c
Showing
46 changed files
with
443 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//@target: ES6 | ||
class C { | ||
[Symbol.iterator]: { x; y }; | ||
} | ||
interface I { | ||
[Symbol.iterator]?: { x }; | ||
} | ||
|
||
var i: I; | ||
i = new C; | ||
var c: C = i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@target: ES6 | ||
class C { } | ||
interface I { | ||
[Symbol.iterator]?: { x }; | ||
} | ||
|
||
var i: I; | ||
i = new C; | ||
var c: C = i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//@target: ES6 | ||
class C { | ||
private [Symbol.iterator]: { x }; | ||
} | ||
interface I { | ||
[Symbol.iterator]: { x }; | ||
} | ||
|
||
var i: I; | ||
i = new C; | ||
var c: C = i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@target: ES6 | ||
class C { | ||
[Symbol.iterator]: { x; y }; | ||
} | ||
interface I { | ||
[Symbol.iterator]: { x }; | ||
} | ||
|
||
declare function foo(i: I): I; | ||
declare function foo(a: any): any; | ||
|
||
declare function bar(i: C): C; | ||
declare function bar(a: any): any; | ||
|
||
foo(new C); | ||
var i: I; | ||
bar(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@target: ES6 | ||
class C { | ||
[Symbol.iterator]: { x; y }; | ||
} | ||
interface I { | ||
[Symbol.iterator]?: { x }; | ||
} | ||
|
||
declare function foo(i: I): I; | ||
declare function foo(a: any): any; | ||
|
||
declare function bar(i: C): C; | ||
declare function bar(a: any): any; | ||
|
||
foo(new C); | ||
var i: I; | ||
bar(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//@target: ES6 | ||
class C { } | ||
interface I { | ||
[Symbol.iterator]?: { x }; | ||
} | ||
|
||
declare function foo(i: I): I; | ||
declare function foo(a: any): any; | ||
|
||
declare function bar(i: C): C; | ||
declare function bar(a: any): any; | ||
|
||
foo(new C); | ||
var i: I; | ||
bar(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@target: ES6 | ||
class C { | ||
private [Symbol.iterator]: { x }; | ||
} | ||
interface I { | ||
[Symbol.iterator]: { x }; | ||
} | ||
|
||
declare function foo(i: I): I; | ||
declare function foo(a: any): any; | ||
|
||
declare function bar(i: C): C; | ||
declare function bar(a: any): any; | ||
|
||
foo(new C); | ||
var i: I; | ||
bar(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@target: ES6 | ||
interface I { | ||
[Symbol.iterator]: number; | ||
[s: Symbol]: string; | ||
"__@iterator": string; | ||
} | ||
|
||
var i: I; | ||
var it = i[Symbol.iterator]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//@target: ES6 | ||
var i = { | ||
[Symbol.iterator]: 0, | ||
[Symbol.toStringTag]() { return "" }, | ||
set [Symbol.toPrimitive](p: boolean) { } | ||
} | ||
|
||
var it = i[Symbol.iterator]; | ||
var str = i[Symbol.toStringTag](); | ||
i[Symbol.toPrimitive] = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@target: ES6 | ||
var i = { | ||
[Symbol.iterator]: { p: null }, | ||
[Symbol.toStringTag]() { return { p: undefined }; } | ||
} | ||
|
||
var it = i[Symbol.iterator]; | ||
var str = i[Symbol.toStringTag](); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//@target: ES6 | ||
interface I { | ||
[Symbol.iterator]: (s: string) => string; | ||
[Symbol.toStringTag](s: number): number; | ||
} | ||
|
||
var i: I = { | ||
[Symbol.iterator]: s => s, | ||
[Symbol.toStringTag](n) { return n; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//@target: ES6 | ||
interface I<T, U> { | ||
[Symbol.unscopables]: T; | ||
[Symbol.isConcatSpreadable]: U; | ||
} | ||
|
||
declare function foo<T, U>(p: I<T, U>): { t: T; u: U }; | ||
|
||
foo({ | ||
[Symbol.isConcatSpreadable]: "", | ||
[Symbol.isRegExp]: 0, | ||
[Symbol.unscopables]: true | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@target: ES6 | ||
interface I<T, U> { | ||
[Symbol.unscopables](x: T): U; | ||
} | ||
|
||
declare function foo<T, U>(p1: T, p2: I<T, U>): U; | ||
|
||
foo("", { [Symbol.unscopables]: s => s.length }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//@target: ES6 | ||
interface I { | ||
[Symbol.toPrimitive]: () => boolean; | ||
} | ||
|
||
class C implements I { | ||
[Symbol.toPrimitive]() { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//@target: ES6 | ||
interface I { | ||
[Symbol.toPrimitive]: () => boolean; | ||
} | ||
|
||
class C implements I { | ||
[Symbol.toPrimitive]() { | ||
return ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//@target: ES6 | ||
interface I { | ||
[Symbol.toPrimitive]: () => boolean; | ||
} | ||
|
||
class C implements I { | ||
[Symbol.toStringTag]() { | ||
return ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@target: ES6 | ||
class C1 { | ||
[Symbol.toStringTag]() { | ||
return ""; | ||
} | ||
} | ||
|
||
class C2 extends C1 { | ||
[Symbol.toStringTag]() { | ||
return ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@target: ES6 | ||
class C1 { | ||
[Symbol.toStringTag]() { | ||
return {}; | ||
} | ||
} | ||
|
||
class C2 extends C1 { | ||
[Symbol.toStringTag]() { | ||
return ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//@target: ES6 | ||
class C1 { | ||
[Symbol.toStringTag]() { | ||
return { x: "" }; | ||
} | ||
} | ||
|
||
class C2 extends C1 { } | ||
|
||
var c: C2; | ||
var obj = c[Symbol.toStringTag]().x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//@target: ES6 | ||
class C1 { | ||
[Symbol.toStringTag]() { | ||
return { x: "" }; | ||
} | ||
[s: Symbol]: () => { x: string }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//@target: ES6 | ||
class C1 { | ||
[Symbol.toStringTag]() { | ||
return { x: "" }; | ||
} | ||
[s: Symbol]: () => { x: number }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@target: ES6 | ||
class C1 { | ||
[Symbol.toStringTag]() { | ||
return { x: "" }; | ||
} | ||
} | ||
class C2 extends C1 { | ||
[s: Symbol]: () => { x: string }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@target: ES6 | ||
class C1 { | ||
[Symbol.toStringTag]() { | ||
return { x: "" }; | ||
} | ||
} | ||
class C2 extends C1 { | ||
[s: Symbol]: () => { x: number }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@target: ES6 | ||
class C1 extends C2 { | ||
[Symbol.toStringTag]() { | ||
return { x: "" }; | ||
} | ||
} | ||
class C2 { | ||
[s: Symbol]: () => { x: string }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@target: ES6 | ||
class C1 extends C2 { | ||
[Symbol.toStringTag]() { | ||
return { x: "" }; | ||
} | ||
} | ||
class C2 { | ||
[s: Symbol]: () => { x: number }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@target: ES6 | ||
interface I1 { | ||
[Symbol.toStringTag](): { x: string } | ||
} | ||
interface I2 { | ||
[Symbol.toStringTag](): { x: number } | ||
} | ||
|
||
interface I3 extends I1, I2 { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@target: ES6 | ||
var x = { | ||
[Symbol.isConcatSpreadable]: 0, | ||
[Symbol.isConcatSpreadable]: 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@target: ES6 | ||
interface I { | ||
[Symbol.isConcatSpreadable]: string; | ||
[Symbol.isConcatSpreadable]: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//@target: ES6 | ||
interface I { | ||
[Symbol.isConcatSpreadable]: string; | ||
} | ||
interface I { | ||
[Symbol.isConcatSpreadable]: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//@target: ES6 | ||
class C { | ||
[Symbol.iterator](x: string): string; | ||
[Symbol.iterator](x: number): number; | ||
[Symbol.iterator](x: any) { | ||
return undefined; | ||
} | ||
[Symbol.iterator](x: any) { | ||
return undefined; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@target: ES6 | ||
class C { | ||
[Symbol.iterator](x: string): string; | ||
[Symbol.iterator](x: number): number; | ||
[Symbol.iterator](x: any) { | ||
return undefined; | ||
} | ||
} | ||
|
||
var c = new C; | ||
c[Symbol.iterator](""); | ||
c[Symbol.iterator](0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@target: ES6 | ||
class C { | ||
[Symbol.iterator](x: string): { x: string }; | ||
[Symbol.iterator](x: "hello"): { x: string; hello: string }; | ||
[Symbol.iterator](x: any) { | ||
return undefined; | ||
} | ||
} | ||
|
||
var c = new C; | ||
c[Symbol.iterator](""); | ||
c[Symbol.iterator]("hello"); |
Oops, something went wrong.