diff --git a/tests/baselines/reference/superSymbolIndexedAccess1.js b/tests/baselines/reference/superSymbolIndexedAccess1.js new file mode 100644 index 00000000000..411158bcc7d --- /dev/null +++ b/tests/baselines/reference/superSymbolIndexedAccess1.js @@ -0,0 +1,27 @@ +//// [superSymbolIndexedAccess1.ts] +var symbol = Symbol.for('myThing'); + +class Foo { + [symbol]() { + return 0; + } +} + +class Bar extends Foo { + [symbol]() { + return super[symbol](); + } +} + +//// [superSymbolIndexedAccess1.js] +var symbol = Symbol.for('myThing'); +class Foo { + [symbol]() { + return 0; + } +} +class Bar extends Foo { + [symbol]() { + return super[symbol](); + } +} diff --git a/tests/baselines/reference/superSymbolIndexedAccess1.symbols b/tests/baselines/reference/superSymbolIndexedAccess1.symbols new file mode 100644 index 00000000000..818d0ac52af --- /dev/null +++ b/tests/baselines/reference/superSymbolIndexedAccess1.symbols @@ -0,0 +1,29 @@ +=== tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess1.ts === +var symbol = Symbol.for('myThing'); +>symbol : Symbol(symbol, Decl(superSymbolIndexedAccess1.ts, 0, 3)) +>Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, 1221, 42)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, 1221, 42)) + +class Foo { +>Foo : Symbol(Foo, Decl(superSymbolIndexedAccess1.ts, 0, 35)) + + [symbol]() { +>symbol : Symbol(symbol, Decl(superSymbolIndexedAccess1.ts, 0, 3)) + + return 0; + } +} + +class Bar extends Foo { +>Bar : Symbol(Bar, Decl(superSymbolIndexedAccess1.ts, 6, 1)) +>Foo : Symbol(Foo, Decl(superSymbolIndexedAccess1.ts, 0, 35)) + + [symbol]() { +>symbol : Symbol(symbol, Decl(superSymbolIndexedAccess1.ts, 0, 3)) + + return super[symbol](); +>super : Symbol(Foo, Decl(superSymbolIndexedAccess1.ts, 0, 35)) +>symbol : Symbol(symbol, Decl(superSymbolIndexedAccess1.ts, 0, 3)) + } +} diff --git a/tests/baselines/reference/superSymbolIndexedAccess1.types b/tests/baselines/reference/superSymbolIndexedAccess1.types new file mode 100644 index 00000000000..af2c6cab156 --- /dev/null +++ b/tests/baselines/reference/superSymbolIndexedAccess1.types @@ -0,0 +1,34 @@ +=== tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess1.ts === +var symbol = Symbol.for('myThing'); +>symbol : symbol +>Symbol.for('myThing') : symbol +>Symbol.for : (key: string) => symbol +>Symbol : SymbolConstructor +>for : (key: string) => symbol +>'myThing' : string + +class Foo { +>Foo : Foo + + [symbol]() { +>symbol : symbol + + return 0; +>0 : number + } +} + +class Bar extends Foo { +>Bar : Bar +>Foo : Foo + + [symbol]() { +>symbol : symbol + + return super[symbol](); +>super[symbol]() : any +>super[symbol] : any +>super : Foo +>symbol : symbol + } +} diff --git a/tests/baselines/reference/superSymbolIndexedAccess2.js b/tests/baselines/reference/superSymbolIndexedAccess2.js new file mode 100644 index 00000000000..bc42addc41f --- /dev/null +++ b/tests/baselines/reference/superSymbolIndexedAccess2.js @@ -0,0 +1,25 @@ +//// [superSymbolIndexedAccess2.ts] + +class Foo { + [Symbol.isConcatSpreadable]() { + return 0; + } +} + +class Bar extends Foo { + [Symbol.isConcatSpreadable]() { + return super[Symbol.isConcatSpreadable](); + } +} + +//// [superSymbolIndexedAccess2.js] +class Foo { + [Symbol.isConcatSpreadable]() { + return 0; + } +} +class Bar extends Foo { + [Symbol.isConcatSpreadable]() { + return super[Symbol.isConcatSpreadable](); + } +} diff --git a/tests/baselines/reference/superSymbolIndexedAccess2.symbols b/tests/baselines/reference/superSymbolIndexedAccess2.symbols new file mode 100644 index 00000000000..3865b920647 --- /dev/null +++ b/tests/baselines/reference/superSymbolIndexedAccess2.symbols @@ -0,0 +1,30 @@ +=== tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess2.ts === + +class Foo { +>Foo : Symbol(Foo, Decl(superSymbolIndexedAccess2.ts, 0, 0)) + + [Symbol.isConcatSpreadable]() { +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) + + return 0; + } +} + +class Bar extends Foo { +>Bar : Symbol(Bar, Decl(superSymbolIndexedAccess2.ts, 5, 1)) +>Foo : Symbol(Foo, Decl(superSymbolIndexedAccess2.ts, 0, 0)) + + [Symbol.isConcatSpreadable]() { +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) + + return super[Symbol.isConcatSpreadable](); +>super : Symbol(Foo, Decl(superSymbolIndexedAccess2.ts, 0, 0)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) + } +} diff --git a/tests/baselines/reference/superSymbolIndexedAccess2.types b/tests/baselines/reference/superSymbolIndexedAccess2.types new file mode 100644 index 00000000000..72bb6914d3e --- /dev/null +++ b/tests/baselines/reference/superSymbolIndexedAccess2.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess2.ts === + +class Foo { +>Foo : Foo + + [Symbol.isConcatSpreadable]() { +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol + + return 0; +>0 : number + } +} + +class Bar extends Foo { +>Bar : Bar +>Foo : Foo + + [Symbol.isConcatSpreadable]() { +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol + + return super[Symbol.isConcatSpreadable](); +>super[Symbol.isConcatSpreadable]() : number +>super[Symbol.isConcatSpreadable] : () => number +>super : Foo +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol + } +} diff --git a/tests/baselines/reference/superSymbolIndexedAccess3.errors.txt b/tests/baselines/reference/superSymbolIndexedAccess3.errors.txt new file mode 100644 index 00000000000..7f25510e00b --- /dev/null +++ b/tests/baselines/reference/superSymbolIndexedAccess3.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess3.ts(11,16): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. + + +==== tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess3.ts (1 errors) ==== + var symbol = Symbol.for('myThing'); + + class Foo { + [symbol]() { + return 0; + } + } + + class Bar extends Foo { + [symbol]() { + return super[Bar](); + ~~~~~~~~~~ +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/superSymbolIndexedAccess3.js b/tests/baselines/reference/superSymbolIndexedAccess3.js new file mode 100644 index 00000000000..439a13c6e6e --- /dev/null +++ b/tests/baselines/reference/superSymbolIndexedAccess3.js @@ -0,0 +1,27 @@ +//// [superSymbolIndexedAccess3.ts] +var symbol = Symbol.for('myThing'); + +class Foo { + [symbol]() { + return 0; + } +} + +class Bar extends Foo { + [symbol]() { + return super[Bar](); + } +} + +//// [superSymbolIndexedAccess3.js] +var symbol = Symbol.for('myThing'); +class Foo { + [symbol]() { + return 0; + } +} +class Bar extends Foo { + [symbol]() { + return super[Bar](); + } +} diff --git a/tests/baselines/reference/superSymbolIndexedAccess4.errors.txt b/tests/baselines/reference/superSymbolIndexedAccess4.errors.txt new file mode 100644 index 00000000000..dbf18c3d00d --- /dev/null +++ b/tests/baselines/reference/superSymbolIndexedAccess4.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess4.ts(5,16): error TS2335: 'super' can only be referenced in a derived class. + + +==== tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess4.ts (1 errors) ==== + var symbol = Symbol.for('myThing'); + + class Bar { + [symbol]() { + return super[symbol](); + ~~~~~ +!!! error TS2335: 'super' can only be referenced in a derived class. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/superSymbolIndexedAccess4.js b/tests/baselines/reference/superSymbolIndexedAccess4.js new file mode 100644 index 00000000000..8d966511fc6 --- /dev/null +++ b/tests/baselines/reference/superSymbolIndexedAccess4.js @@ -0,0 +1,16 @@ +//// [superSymbolIndexedAccess4.ts] +var symbol = Symbol.for('myThing'); + +class Bar { + [symbol]() { + return super[symbol](); + } +} + +//// [superSymbolIndexedAccess4.js] +var symbol = Symbol.for('myThing'); +class Bar { + [symbol]() { + return super[symbol](); + } +} diff --git a/tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess1.ts b/tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess1.ts new file mode 100644 index 00000000000..160a76f5c61 --- /dev/null +++ b/tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess1.ts @@ -0,0 +1,14 @@ +//@target: ES6 +var symbol = Symbol.for('myThing'); + +class Foo { + [symbol]() { + return 0; + } +} + +class Bar extends Foo { + [symbol]() { + return super[symbol](); + } +} \ No newline at end of file diff --git a/tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess2.ts b/tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess2.ts new file mode 100644 index 00000000000..3f399d41629 --- /dev/null +++ b/tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess2.ts @@ -0,0 +1,13 @@ +//@target: ES6 + +class Foo { + [Symbol.isConcatSpreadable]() { + return 0; + } +} + +class Bar extends Foo { + [Symbol.isConcatSpreadable]() { + return super[Symbol.isConcatSpreadable](); + } +} \ No newline at end of file diff --git a/tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess3.ts b/tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess3.ts new file mode 100644 index 00000000000..2fbbbdc63e6 --- /dev/null +++ b/tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess3.ts @@ -0,0 +1,14 @@ +//@target: ES6 +var symbol = Symbol.for('myThing'); + +class Foo { + [symbol]() { + return 0; + } +} + +class Bar extends Foo { + [symbol]() { + return super[Bar](); + } +} \ No newline at end of file diff --git a/tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess4.ts b/tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess4.ts new file mode 100644 index 00000000000..095fcc1dbb7 --- /dev/null +++ b/tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess4.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var symbol = Symbol.for('myThing'); + +class Bar { + [symbol]() { + return super[symbol](); + } +} \ No newline at end of file