swc/crates/swc_ecma_parser/tests/tsc/superInStaticMembers1.ts
2022-02-04 17:08:38 +09:00

493 lines
13 KiB
TypeScript

// @target: es5, es2015, es2021, es2022, esnext
// @noTypesAndSymbols: true
// @filename: external.ts
export class Reflect {}
export interface Foo {}
export declare namespace Bar { type _ = unknown; }
export const enum Baz {}
export default class {};
// @filename: locals.ts
export {};
declare class B { static w(): number; }
class C extends B {
static _ = [
(() => {
var Reflect; // collision (es2015-es2021 only)
super.w();
})(),
(() => {
var { Reflect } = { Reflect: null }; // collision (es2015-es2021 only)
super.w();
})(),
(() => {
var [Reflect] = [null]; // collision (es2015-es2021 only)
super.w();
})(),
(() => {
class Reflect {} // collision (es2015-es2021 only)
super.w();
})(),
(() => {
function Reflect() {} // collision (es2015-es2021 only)
super.w();
})(),
(() => {
enum Reflect {} // collision (es2015-es2021 only)
super.w();
})(),
(() => {
const enum Reflect {} // collision (es2015-es2021 only)
super.w();
})(),
(() => {
type Reflect = unknown; // no collision
super.w();
})(),
(() => {
interface Reflect {}; // no collision
super.w();
})(),
(() => {
(class Reflect {}); // no collision
super.w();
})(),
(() => {
(function Reflect() {}); // no collision
super.w();
})(),
];
static {
var { Reflect } = { Reflect: null }; // collision (es2015-es2021 only)
super.w();
}
static {
var [Reflect] = [null]; // collision (es2015-es2021 only)
super.w();
}
static {
var Reflect; // collision (es2015-es2021 only)
super.w();
}
static {
class Reflect {} // collision (es2015-es2021 only)
super.w();
}
static {
function Reflect() {} // collision (es2015-es2021 only)
super.w();
}
static {
enum Reflect {} // collision (es2015-es2021 only)
super.w();
}
static {
const enum Reflect {} // collision (es2015-es2021 only)
super.w();
}
static {
type Reflect = unknown; // no collision
super.w();
}
static {
interface Reflect {} // no collision
super.w();
}
static {
(class Reflect {}) // no collision
super.w();
}
static {
(function Reflect() {}) // no collision
super.w();
}
}
// @filename: varInContainingScopeStaticField1.ts
export {};
declare class B { static w(): number; }
var Reflect = null; // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
// @filename: varInContainingScopeStaticField2.ts
export {};
declare class B { static w(): number; }
var { Reflect } = { Reflect: null }; // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
// @filename: varInContainingScopeStaticField3.ts
export {};
declare class B { static w(): number; }
var [Reflect] = [null]; // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
// @filename: varInContainingScopeStaticBlock1.ts
export {};
declare class B { static w(): number; }
var Reflect = null; // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
// @filename: varInContainingScopeStaticBlock2.ts
export {};
declare class B { static w(): number; }
var { Reflect } = { Reflect: null }; // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
// @filename: varInContainingScopeStaticBlock3.ts
export {};
declare class B { static w(): number; }
var [Reflect] = [null]; // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
// @filename: classDeclInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
class Reflect {} // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
// @filename: classDeclInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
class Reflect {} // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
// @filename: funcDeclInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
function Reflect() {} // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
// @filename: funcDeclInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
function Reflect() {} // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
// @filename: valueNamespaceInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
namespace Reflect {} // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
// @filename: valueNamespaceInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
namespace Reflect {} // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
// @filename: enumInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
enum Reflect {} // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
// @filename: enumInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
enum Reflect {} // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
// @filename: constEnumInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
const enum Reflect {} // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
// @filename: constEnumInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
const enum Reflect {} // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
// @filename: namespaceImportInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
import * as Reflect from "./external"; // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
// @filename: namespaceImportInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
import * as Reflect from "./external"; // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
// @filename: namedImportInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
import { Reflect } from "./external"; // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
// @filename: namedImportInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
import { Reflect } from "./external"; // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
// @filename: namedImportOfInterfaceInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
import { Foo as Reflect } from "./external"; // collision (es2015-es2021 only, not a type-only import)
class C extends B {
static _ = super.w();
}
// @filename: namedImportOfInterfaceInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
import { Foo as Reflect } from "./external"; // collision (es2015-es2021 only, not a type-only import)
class C extends B {
static { super.w(); }
}
// @filename: namedImportOfUninstantiatedNamespaceInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
import { Bar as Reflect } from "./external"; // collision (es2015-es2021 only, not a type-only import)
class C extends B {
static _ = super.w();
}
// @filename: namedImportOfUninstantiatedNamespaceInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
import { Bar as Reflect } from "./external"; // collision (es2015-es2021 only, not a type-only import)
class C extends B {
static { super.w(); }
}
// @filename: namedImportOfConstEnumInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
import { Baz as Reflect } from "./external"; // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
// @filename: namedImportOfConstEnumInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
import { Baz as Reflect } from "./external"; // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
// @filename: typeOnlyNamedImportInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
import type { Reflect } from "./external"; // no collision
class C extends B {
static _ = super.w();
}
// @filename: typeOnlyNamedImportInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
import type { Reflect } from "./external"; // no collision
class C extends B {
static { super.w(); }
}
// @filename: defaultImportInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
import Reflect from "./external"; // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
// @filename: defaultImportInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
import Reflect from "./external"; // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
// @filename: typeOnlyDefaultImportInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
import type Reflect from "./external"; // no collision
class C extends B {
static _ = super.w();
}
// @filename: typeOnlyDefaultImportInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
import type Reflect from "./external"; // no collision
class C extends B {
static { super.w(); }
}
// @filename: typeInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
type Reflect = unknown; // no collision
class C extends B {
static _ = super.w();
}
// @filename: typeInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
type Reflect = unknown; // no collision
class C extends B {
static { super.w(); }
}
// @filename: interfaceInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
interface Reflect {}; // no collision
class C extends B {
static _ = super.w();
}
// @filename: interfaceInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
interface Reflect {}; // no collision
class C extends B {
static { super.w(); }
}
// @filename: uninstantiatedNamespaceInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
declare namespace Reflect { type _ = unknown; }; // no collision
class C extends B {
static _ = super.w();
}
// @filename: uninstantiatedNamespaceInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
declare namespace Reflect { type _ = unknown; }; // no collision
class C extends B {
static { super.w(); }
}
// @filename: classExprInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
(class Reflect {}); // no collision
class C extends B {
static _ = super.w();
}
// @filename: classExprInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
(class Reflect {}); // no collision
class C extends B {
static { super.w(); }
}
// @filename: inContainingClassExprStaticField.ts
export {};
declare class B { static w(): number; }
(class Reflect { // collision (es2015-es2021 only)
static {
class C extends B {
static _ = super.w();
}
}
});
// @filename: inContainingClassExprStaticBlock.ts
export {};
declare class B { static w(): number; }
(class Reflect { // collision (es2015-es2021 only)
static {
class C extends B {
static { super.w(); }
}
}
});
// @filename: funcExprInContainingScopeStaticField.ts
export {};
declare class B { static w(): number; }
(function Reflect() {}); // no collision
class C extends B {
static _ = super.w();
}
// @filename: funcExprInContainingScopeStaticBlock.ts
export {};
declare class B { static w(): number; }
(function Reflect() {}); // no collision
class C extends B {
static { super.w(); }
}
// @filename: inContainingFuncExprStaticField.ts
export {};
declare class B { static w(): number; }
(function Reflect() { // collision (es2015-es2021 only)
class C extends B {
static _ = super.w();
}
});
// @filename: inContainingFuncExprStaticBlock.ts
export {};
declare class B { static w(): number; }
(function Reflect() { // collision (es2015-es2021 only)
class C extends B {
static { super.w(); }
}
});