accepted baselines
This commit is contained in:
parent
df3560f6a7
commit
b448310058
|
@ -1,67 +1,67 @@
|
|||
//// [APISample_linter.ts]
|
||||
|
||||
/*
|
||||
* Note: This test is a public API sample. The sample sources can be found
|
||||
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter
|
||||
* Please log a "breaking change" issue for any API breaking change affecting this issue
|
||||
*/
|
||||
|
||||
declare var process: any;
|
||||
declare var console: any;
|
||||
declare var readFileSync: any;
|
||||
|
||||
import * as ts from "typescript";
|
||||
|
||||
export function delint(sourceFile: ts.SourceFile) {
|
||||
delintNode(sourceFile);
|
||||
|
||||
function delintNode(node: ts.Node) {
|
||||
switch (node.kind) {
|
||||
case ts.SyntaxKind.ForStatement:
|
||||
case ts.SyntaxKind.ForInStatement:
|
||||
case ts.SyntaxKind.WhileStatement:
|
||||
case ts.SyntaxKind.DoStatement:
|
||||
if ((<ts.IterationStatement>node).statement.kind !== ts.SyntaxKind.Block) {
|
||||
report(node, "A looping statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
|
||||
case ts.SyntaxKind.IfStatement:
|
||||
let ifStatement = (<ts.IfStatement>node);
|
||||
if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) {
|
||||
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
if (ifStatement.elseStatement &&
|
||||
ifStatement.elseStatement.kind !== ts.SyntaxKind.Block &&
|
||||
ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) {
|
||||
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
|
||||
case ts.SyntaxKind.BinaryExpression:
|
||||
let op = (<ts.BinaryExpression>node).operatorToken.kind;
|
||||
if (op === ts.SyntaxKind.EqualsEqualsToken || op == ts.SyntaxKind.ExclamationEqualsToken) {
|
||||
report(node, "Use '===' and '!=='.")
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ts.forEachChild(node, delintNode);
|
||||
}
|
||||
|
||||
function report(node: ts.Node, message: string) {
|
||||
let { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
||||
console.log(`${sourceFile.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
const fileNames = process.argv.slice(2);
|
||||
fileNames.forEach(fileName => {
|
||||
// Parse a file
|
||||
let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true);
|
||||
|
||||
// delint it
|
||||
delint(sourceFile);
|
||||
|
||||
/*
|
||||
* Note: This test is a public API sample. The sample sources can be found
|
||||
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter
|
||||
* Please log a "breaking change" issue for any API breaking change affecting this issue
|
||||
*/
|
||||
|
||||
declare var process: any;
|
||||
declare var console: any;
|
||||
declare var readFileSync: any;
|
||||
|
||||
import * as ts from "typescript";
|
||||
|
||||
export function delint(sourceFile: ts.SourceFile) {
|
||||
delintNode(sourceFile);
|
||||
|
||||
function delintNode(node: ts.Node) {
|
||||
switch (node.kind) {
|
||||
case ts.SyntaxKind.ForStatement:
|
||||
case ts.SyntaxKind.ForInStatement:
|
||||
case ts.SyntaxKind.WhileStatement:
|
||||
case ts.SyntaxKind.DoStatement:
|
||||
if ((<ts.IterationStatement>node).statement.kind !== ts.SyntaxKind.Block) {
|
||||
report(node, "A looping statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
|
||||
case ts.SyntaxKind.IfStatement:
|
||||
let ifStatement = (<ts.IfStatement>node);
|
||||
if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) {
|
||||
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
if (ifStatement.elseStatement &&
|
||||
ifStatement.elseStatement.kind !== ts.SyntaxKind.Block &&
|
||||
ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) {
|
||||
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
|
||||
case ts.SyntaxKind.BinaryExpression:
|
||||
let op = (<ts.BinaryExpression>node).operatorToken.kind;
|
||||
if (op === ts.SyntaxKind.EqualsEqualsToken || op == ts.SyntaxKind.ExclamationEqualsToken) {
|
||||
report(node, "Use '===' and '!=='.")
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ts.forEachChild(node, delintNode);
|
||||
}
|
||||
|
||||
function report(node: ts.Node, message: string) {
|
||||
let { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
||||
console.log(`${sourceFile.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
const fileNames = process.argv.slice(2);
|
||||
fileNames.forEach(fileName => {
|
||||
// Parse a file
|
||||
let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true);
|
||||
|
||||
// delint it
|
||||
delint(sourceFile);
|
||||
});
|
||||
|
||||
//// [APISample_linter.js]
|
||||
|
@ -75,26 +75,26 @@ function delint(sourceFile) {
|
|||
delintNode(sourceFile);
|
||||
function delintNode(node) {
|
||||
switch (node.kind) {
|
||||
case 189 /* ForStatement */:
|
||||
case 190 /* ForInStatement */:
|
||||
case 188 /* WhileStatement */:
|
||||
case 187 /* DoStatement */:
|
||||
if (node.statement.kind !== 182 /* Block */) {
|
||||
case 190 /* ForStatement */:
|
||||
case 191 /* ForInStatement */:
|
||||
case 189 /* WhileStatement */:
|
||||
case 188 /* DoStatement */:
|
||||
if (node.statement.kind !== 183 /* Block */) {
|
||||
report(node, "A looping statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
case 186 /* IfStatement */:
|
||||
case 187 /* IfStatement */:
|
||||
var ifStatement = node;
|
||||
if (ifStatement.thenStatement.kind !== 182 /* Block */) {
|
||||
if (ifStatement.thenStatement.kind !== 183 /* Block */) {
|
||||
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
if (ifStatement.elseStatement &&
|
||||
ifStatement.elseStatement.kind !== 182 /* Block */ &&
|
||||
ifStatement.elseStatement.kind !== 186 /* IfStatement */) {
|
||||
ifStatement.elseStatement.kind !== 183 /* Block */ &&
|
||||
ifStatement.elseStatement.kind !== 187 /* IfStatement */) {
|
||||
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
case 172 /* BinaryExpression */:
|
||||
case 173 /* BinaryExpression */:
|
||||
var op = node.operatorToken.kind;
|
||||
if (op === 28 /* EqualsEqualsToken */ || op == 29 /* ExclamationEqualsToken */) {
|
||||
report(node, "Use '===' and '!=='.");
|
||||
|
|
|
@ -1,57 +1,57 @@
|
|||
tests/cases/compiler/abstractClass1.ts(15,9): error TS2502: Cannot create an instance of the abstract class 'Foo'
|
||||
tests/cases/compiler/abstractClass1.ts(16,9): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/abstractClass1.ts(16,9): error TS2502: Cannot create an instance of the abstract class 'Foo'
|
||||
tests/cases/compiler/abstractClass1.ts(25,1): error TS2502: Cannot create an instance of the abstract class 'Qux'
|
||||
tests/cases/compiler/abstractClass1.ts(35,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/abstractClass1.ts(35,1): error TS2502: Cannot create an instance of the abstract class 'Foo'
|
||||
|
||||
|
||||
==== tests/cases/compiler/abstractClass1.ts (6 errors) ====
|
||||
|
||||
abstract class Foo {
|
||||
constructor(f: any) { }
|
||||
public static bar(): void { }
|
||||
|
||||
public empty() { }
|
||||
}
|
||||
|
||||
class Bar extends Foo {
|
||||
constructor(f: any) {
|
||||
super(f);
|
||||
}
|
||||
}
|
||||
|
||||
var a = new Foo(1); // Error
|
||||
~~~~~~~~~~
|
||||
!!! error TS2502: Cannot create an instance of the abstract class 'Foo'
|
||||
var b = new Foo(); // Error because of invalid constructor arguments
|
||||
~~~~~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~
|
||||
!!! error TS2502: Cannot create an instance of the abstract class 'Foo'
|
||||
|
||||
module baz {
|
||||
export abstract class Qux {
|
||||
}
|
||||
export class Quz extends Qux {
|
||||
}
|
||||
}
|
||||
|
||||
new baz.Qux();
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2502: Cannot create an instance of the abstract class 'Qux'
|
||||
|
||||
// Valid
|
||||
var c = new Bar(1);
|
||||
c.empty();
|
||||
|
||||
// Calling a static method on a abstract class is valid
|
||||
Foo.bar();
|
||||
|
||||
var Copy = Foo;
|
||||
new Copy();
|
||||
~~~~~~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2502: Cannot create an instance of the abstract class 'Foo'
|
||||
tests/cases/compiler/abstractClass1.ts(15,9): error TS2511: Cannot create an instance of the abstract class 'Foo'.
|
||||
tests/cases/compiler/abstractClass1.ts(16,9): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/abstractClass1.ts(16,9): error TS2511: Cannot create an instance of the abstract class 'Foo'.
|
||||
tests/cases/compiler/abstractClass1.ts(25,1): error TS2511: Cannot create an instance of the abstract class 'Qux'.
|
||||
tests/cases/compiler/abstractClass1.ts(35,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/abstractClass1.ts(35,1): error TS2511: Cannot create an instance of the abstract class 'Foo'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/abstractClass1.ts (6 errors) ====
|
||||
|
||||
abstract class Foo {
|
||||
constructor(f: any) { }
|
||||
public static bar(): void { }
|
||||
|
||||
public empty() { }
|
||||
}
|
||||
|
||||
class Bar extends Foo {
|
||||
constructor(f: any) {
|
||||
super(f);
|
||||
}
|
||||
}
|
||||
|
||||
var a = new Foo(1); // Error
|
||||
~~~~~~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'Foo'.
|
||||
var b = new Foo(); // Error because of invalid constructor arguments
|
||||
~~~~~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'Foo'.
|
||||
|
||||
module baz {
|
||||
export abstract class Qux {
|
||||
}
|
||||
export class Quz extends Qux {
|
||||
}
|
||||
}
|
||||
|
||||
new baz.Qux();
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'Qux'.
|
||||
|
||||
// Valid
|
||||
var c = new Bar(1);
|
||||
c.empty();
|
||||
|
||||
// Calling a static method on a abstract class is valid
|
||||
Foo.bar();
|
||||
|
||||
var Copy = Foo;
|
||||
new Copy();
|
||||
~~~~~~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'Foo'.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
//// [abstractClass1.ts]
|
||||
//// [abstractClass1.ts]
|
||||
|
||||
abstract class Foo {
|
||||
constructor(f: any) { }
|
||||
|
@ -34,74 +34,74 @@ Foo.bar();
|
|||
|
||||
var Copy = Foo;
|
||||
new Copy();
|
||||
|
||||
|
||||
//// [abstractClass1.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Foo = (function () {
|
||||
function Foo(f) {
|
||||
}
|
||||
Foo.bar = function () { };
|
||||
Foo.prototype.empty = function () { };
|
||||
return Foo;
|
||||
})();
|
||||
var Bar = (function (_super) {
|
||||
__extends(Bar, _super);
|
||||
function Bar(f) {
|
||||
_super.call(this, f);
|
||||
}
|
||||
return Bar;
|
||||
})(Foo);
|
||||
var a = new Foo(1); // Error
|
||||
var b = new Foo(); // Error because of invalid constructor arguments
|
||||
var baz;
|
||||
(function (baz) {
|
||||
var Qux = (function () {
|
||||
function Qux() {
|
||||
}
|
||||
return Qux;
|
||||
})();
|
||||
baz.Qux = Qux;
|
||||
var Quz = (function (_super) {
|
||||
__extends(Quz, _super);
|
||||
function Quz() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return Quz;
|
||||
})(Qux);
|
||||
baz.Quz = Quz;
|
||||
})(baz || (baz = {}));
|
||||
new baz.Qux();
|
||||
// Valid
|
||||
var c = new Bar(1);
|
||||
c.empty();
|
||||
// Calling a static method on a abstract class is valid
|
||||
Foo.bar();
|
||||
var Copy = Foo;
|
||||
new Copy();
|
||||
|
||||
|
||||
//// [abstractClass1.d.ts]
|
||||
declare abstract class Foo {
|
||||
constructor(f: any);
|
||||
static bar(): void;
|
||||
empty(): void;
|
||||
}
|
||||
declare class Bar extends Foo {
|
||||
constructor(f: any);
|
||||
}
|
||||
declare var a: Foo;
|
||||
declare var b: any;
|
||||
declare module baz {
|
||||
abstract class Qux {
|
||||
}
|
||||
class Quz extends Qux {
|
||||
}
|
||||
}
|
||||
declare var c: Bar;
|
||||
declare var Copy: typeof Foo;
|
||||
|
||||
|
||||
//// [abstractClass1.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Foo = (function () {
|
||||
function Foo(f) {
|
||||
}
|
||||
Foo.bar = function () { };
|
||||
Foo.prototype.empty = function () { };
|
||||
return Foo;
|
||||
})();
|
||||
var Bar = (function (_super) {
|
||||
__extends(Bar, _super);
|
||||
function Bar(f) {
|
||||
_super.call(this, f);
|
||||
}
|
||||
return Bar;
|
||||
})(Foo);
|
||||
var a = new Foo(1); // Error
|
||||
var b = new Foo(); // Error because of invalid constructor arguments
|
||||
var baz;
|
||||
(function (baz) {
|
||||
var Qux = (function () {
|
||||
function Qux() {
|
||||
}
|
||||
return Qux;
|
||||
})();
|
||||
baz.Qux = Qux;
|
||||
var Quz = (function (_super) {
|
||||
__extends(Quz, _super);
|
||||
function Quz() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return Quz;
|
||||
})(Qux);
|
||||
baz.Quz = Quz;
|
||||
})(baz || (baz = {}));
|
||||
new baz.Qux();
|
||||
// Valid
|
||||
var c = new Bar(1);
|
||||
c.empty();
|
||||
// Calling a static method on a abstract class is valid
|
||||
Foo.bar();
|
||||
var Copy = Foo;
|
||||
new Copy();
|
||||
|
||||
|
||||
//// [abstractClass1.d.ts]
|
||||
declare abstract class Foo {
|
||||
constructor(f: any);
|
||||
static bar(): void;
|
||||
empty(): void;
|
||||
}
|
||||
declare class Bar extends Foo {
|
||||
constructor(f: any);
|
||||
}
|
||||
declare var a: Foo;
|
||||
declare var b: any;
|
||||
declare module baz {
|
||||
abstract class Qux {
|
||||
}
|
||||
class Quz extends Qux {
|
||||
}
|
||||
}
|
||||
declare var c: Bar;
|
||||
declare var Copy: typeof Foo;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
//// [abstractClassIdentifierName.ts]
|
||||
//// [abstractClassIdentifierName.ts]
|
||||
class abstract {
|
||||
|
||||
abstract(): void { }
|
||||
}
|
||||
|
||||
|
||||
//// [abstractClassIdentifierName.js]
|
||||
var abstract = (function () {
|
||||
function abstract() {
|
||||
}
|
||||
abstract.prototype.abstract = function () { };
|
||||
return abstract;
|
||||
})();
|
||||
|
||||
|
||||
//// [abstractClassIdentifierName.js]
|
||||
var abstract = (function () {
|
||||
function abstract() {
|
||||
}
|
||||
abstract.prototype.abstract = function () { };
|
||||
return abstract;
|
||||
})();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
=== tests/cases/compiler/abstractClassIdentifierName.ts ===
|
||||
class abstract {
|
||||
>abstract : Symbol(abstract, Decl(abstractClassIdentifierName.ts, 0, 0))
|
||||
|
||||
abstract(): void { }
|
||||
>abstract : Symbol(abstract, Decl(abstractClassIdentifierName.ts, 0, 16))
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/abstractClassIdentifierName.ts ===
|
||||
class abstract {
|
||||
>abstract : Symbol(abstract, Decl(abstractClassIdentifierName.ts, 0, 0))
|
||||
|
||||
abstract(): void { }
|
||||
>abstract : Symbol(abstract, Decl(abstractClassIdentifierName.ts, 0, 16))
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
=== tests/cases/compiler/abstractClassIdentifierName.ts ===
|
||||
class abstract {
|
||||
>abstract : abstract
|
||||
|
||||
abstract(): void { }
|
||||
>abstract : () => void
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/abstractClassIdentifierName.ts ===
|
||||
class abstract {
|
||||
>abstract : abstract
|
||||
|
||||
abstract(): void { }
|
||||
>abstract : () => void
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
//// [abstractIdentifierNameStrict.ts]
|
||||
//// [abstractIdentifierNameStrict.ts]
|
||||
var abstract = true;
|
||||
|
||||
function foo() {
|
||||
"use strict";
|
||||
var abstract = true;
|
||||
}
|
||||
|
||||
//// [abstractIdentifierNameStrict.js]
|
||||
var abstract = true;
|
||||
function foo() {
|
||||
"use strict";
|
||||
var abstract = true;
|
||||
}
|
||||
}
|
||||
|
||||
//// [abstractIdentifierNameStrict.js]
|
||||
var abstract = true;
|
||||
function foo() {
|
||||
"use strict";
|
||||
var abstract = true;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
=== tests/cases/compiler/abstractIdentifierNameStrict.ts ===
|
||||
var abstract = true;
|
||||
>abstract : Symbol(abstract, Decl(abstractIdentifierNameStrict.ts, 0, 3))
|
||||
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(abstractIdentifierNameStrict.ts, 0, 20))
|
||||
|
||||
"use strict";
|
||||
var abstract = true;
|
||||
>abstract : Symbol(abstract, Decl(abstractIdentifierNameStrict.ts, 4, 7))
|
||||
}
|
||||
=== tests/cases/compiler/abstractIdentifierNameStrict.ts ===
|
||||
var abstract = true;
|
||||
>abstract : Symbol(abstract, Decl(abstractIdentifierNameStrict.ts, 0, 3))
|
||||
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(abstractIdentifierNameStrict.ts, 0, 20))
|
||||
|
||||
"use strict";
|
||||
var abstract = true;
|
||||
>abstract : Symbol(abstract, Decl(abstractIdentifierNameStrict.ts, 4, 7))
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
=== tests/cases/compiler/abstractIdentifierNameStrict.ts ===
|
||||
var abstract = true;
|
||||
>abstract : boolean
|
||||
>true : boolean
|
||||
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
|
||||
"use strict";
|
||||
>"use strict" : string
|
||||
|
||||
var abstract = true;
|
||||
>abstract : boolean
|
||||
>true : boolean
|
||||
}
|
||||
=== tests/cases/compiler/abstractIdentifierNameStrict.ts ===
|
||||
var abstract = true;
|
||||
>abstract : boolean
|
||||
>true : boolean
|
||||
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
|
||||
"use strict";
|
||||
>"use strict" : string
|
||||
|
||||
var abstract = true;
|
||||
>abstract : boolean
|
||||
>true : boolean
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//// [abstractInterfaceIdentifierName.ts]
|
||||
//// [abstractInterfaceIdentifierName.ts]
|
||||
|
||||
interface abstract {
|
||||
abstract(): void;
|
||||
}
|
||||
|
||||
|
||||
//// [abstractInterfaceIdentifierName.js]
|
||||
|
||||
|
||||
//// [abstractInterfaceIdentifierName.js]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
=== tests/cases/compiler/abstractInterfaceIdentifierName.ts ===
|
||||
|
||||
interface abstract {
|
||||
>abstract : Symbol(abstract, Decl(abstractInterfaceIdentifierName.ts, 0, 0))
|
||||
|
||||
abstract(): void;
|
||||
>abstract : Symbol(abstract, Decl(abstractInterfaceIdentifierName.ts, 1, 20))
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/abstractInterfaceIdentifierName.ts ===
|
||||
|
||||
interface abstract {
|
||||
>abstract : Symbol(abstract, Decl(abstractInterfaceIdentifierName.ts, 0, 0))
|
||||
|
||||
abstract(): void;
|
||||
>abstract : Symbol(abstract, Decl(abstractInterfaceIdentifierName.ts, 1, 20))
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
=== tests/cases/compiler/abstractInterfaceIdentifierName.ts ===
|
||||
|
||||
interface abstract {
|
||||
>abstract : abstract
|
||||
|
||||
abstract(): void;
|
||||
>abstract : () => void
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/abstractInterfaceIdentifierName.ts ===
|
||||
|
||||
interface abstract {
|
||||
>abstract : abstract
|
||||
|
||||
abstract(): void;
|
||||
>abstract : () => void
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructor.ts(2,5): error TS1236: 'abstract' modifier can only appear on a class or member function declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructor.ts(2,5): error TS1240: Abstract member functions cannot have an implementation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructor.ts (2 errors) ====
|
||||
abstract class A {
|
||||
abstract constructor() {}
|
||||
~~~~~~~~
|
||||
!!! error TS1236: 'abstract' modifier can only appear on a class or member function declaration.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1240: Abstract member functions cannot have an implementation.
|
||||
}
|
11
tests/baselines/reference/classAbstractConstructor.js
Normal file
11
tests/baselines/reference/classAbstractConstructor.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
//// [classAbstractConstructor.ts]
|
||||
abstract class A {
|
||||
abstract constructor() {}
|
||||
}
|
||||
|
||||
//// [classAbstractConstructor.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
|
@ -0,0 +1,52 @@
|
|||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,5): error TS1236: 'abstract' modifier can only appear on a class or member function declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,5): error TS1240: Abstract member functions cannot have an implementation.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,28): error TS1184: An implementation cannot be declared in ambient contexts.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(11,15): error TS2415: Class 'CC' incorrectly extends base class 'AA'.
|
||||
Non-abstract class 'CC' does not implement inherited abstract member 'AA.foo'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(13,15): error TS2415: Class 'DD' incorrectly extends base class 'BB'.
|
||||
Non-abstract class 'DD' does not implement inherited abstract member 'BB.foo'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(17,15): error TS2415: Class 'FF' incorrectly extends base class 'CC'.
|
||||
Non-abstract class 'FF' does not implement inherited abstract member 'CC.foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts (6 errors) ====
|
||||
declare abstract class A {
|
||||
abstract constructor() {}
|
||||
~~~~~~~~
|
||||
!!! error TS1236: 'abstract' modifier can only appear on a class or member function declaration.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1240: Abstract member functions cannot have an implementation.
|
||||
~
|
||||
!!! error TS1184: An implementation cannot be declared in ambient contexts.
|
||||
}
|
||||
|
||||
declare abstract class AA {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
declare abstract class BB extends AA {}
|
||||
|
||||
declare class CC extends AA {}
|
||||
~~
|
||||
!!! error TS2415: Class 'CC' incorrectly extends base class 'AA'.
|
||||
!!! error TS2415: Non-abstract class 'CC' does not implement inherited abstract member 'AA.foo'.
|
||||
|
||||
declare class DD extends BB {}
|
||||
~~
|
||||
!!! error TS2415: Class 'DD' incorrectly extends base class 'BB'.
|
||||
!!! error TS2415: Non-abstract class 'DD' does not implement inherited abstract member 'BB.foo'.
|
||||
|
||||
declare abstract class EE extends BB {}
|
||||
|
||||
declare class FF extends CC {}
|
||||
~~
|
||||
!!! error TS2415: Class 'FF' incorrectly extends base class 'CC'.
|
||||
!!! error TS2415: Non-abstract class 'FF' does not implement inherited abstract member 'CC.foo'.
|
||||
|
||||
declare abstract class GG extends CC {}
|
||||
|
||||
declare abstract class AAA {}
|
||||
|
||||
declare abstract class BBB extends AAA {}
|
||||
|
||||
declare class CCC extends AAA {}
|
|
@ -0,0 +1,39 @@
|
|||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInheritance.ts(13,7): error TS2415: Class 'CC' incorrectly extends base class 'AA'.
|
||||
Non-abstract class 'CC' does not implement inherited abstract member 'AA.foo'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInheritance.ts(15,7): error TS2415: Class 'DD' incorrectly extends base class 'BB'.
|
||||
Non-abstract class 'DD' does not implement inherited abstract member 'BB.foo'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInheritance.ts(19,7): error TS2415: Class 'FF' incorrectly extends base class 'CC'.
|
||||
Non-abstract class 'FF' does not implement inherited abstract member 'CC.foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInheritance.ts (3 errors) ====
|
||||
abstract class A {}
|
||||
|
||||
abstract class B extends A {}
|
||||
|
||||
class C extends A {}
|
||||
|
||||
abstract class AA {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
abstract class BB extends AA {}
|
||||
|
||||
class CC extends AA {}
|
||||
~~
|
||||
!!! error TS2415: Class 'CC' incorrectly extends base class 'AA'.
|
||||
!!! error TS2415: Non-abstract class 'CC' does not implement inherited abstract member 'AA.foo'.
|
||||
|
||||
class DD extends BB {}
|
||||
~~
|
||||
!!! error TS2415: Class 'DD' incorrectly extends base class 'BB'.
|
||||
!!! error TS2415: Non-abstract class 'DD' does not implement inherited abstract member 'BB.foo'.
|
||||
|
||||
abstract class EE extends BB {}
|
||||
|
||||
class FF extends CC {}
|
||||
~~
|
||||
!!! error TS2415: Class 'FF' incorrectly extends base class 'CC'.
|
||||
!!! error TS2415: Non-abstract class 'FF' does not implement inherited abstract member 'CC.foo'.
|
||||
|
||||
abstract class GG extends CC {}
|
96
tests/baselines/reference/classAbstractInheritance.js
Normal file
96
tests/baselines/reference/classAbstractInheritance.js
Normal file
|
@ -0,0 +1,96 @@
|
|||
//// [classAbstractInheritance.ts]
|
||||
abstract class A {}
|
||||
|
||||
abstract class B extends A {}
|
||||
|
||||
class C extends A {}
|
||||
|
||||
abstract class AA {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
abstract class BB extends AA {}
|
||||
|
||||
class CC extends AA {}
|
||||
|
||||
class DD extends BB {}
|
||||
|
||||
abstract class EE extends BB {}
|
||||
|
||||
class FF extends CC {}
|
||||
|
||||
abstract class GG extends CC {}
|
||||
|
||||
//// [classAbstractInheritance.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
})(A);
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C;
|
||||
})(A);
|
||||
var AA = (function () {
|
||||
function AA() {
|
||||
}
|
||||
return AA;
|
||||
})();
|
||||
var BB = (function (_super) {
|
||||
__extends(BB, _super);
|
||||
function BB() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return BB;
|
||||
})(AA);
|
||||
var CC = (function (_super) {
|
||||
__extends(CC, _super);
|
||||
function CC() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return CC;
|
||||
})(AA);
|
||||
var DD = (function (_super) {
|
||||
__extends(DD, _super);
|
||||
function DD() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return DD;
|
||||
})(BB);
|
||||
var EE = (function (_super) {
|
||||
__extends(EE, _super);
|
||||
function EE() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return EE;
|
||||
})(BB);
|
||||
var FF = (function (_super) {
|
||||
__extends(FF, _super);
|
||||
function FF() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return FF;
|
||||
})(CC);
|
||||
var GG = (function (_super) {
|
||||
__extends(GG, _super);
|
||||
function GG() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return GG;
|
||||
})(CC);
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMethodWithImplementation.ts(2,5): error TS1240: Abstract member functions cannot have an implementation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMethodWithImplementation.ts (1 errors) ====
|
||||
abstract class A {
|
||||
abstract foo() {}
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1240: Abstract member functions cannot have an implementation.
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
//// [classAbstractMethodWithImplementation.ts]
|
||||
abstract class A {
|
||||
abstract foo() {}
|
||||
}
|
||||
|
||||
//// [classAbstractMethodWithImplementation.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.prototype.foo = function () { };
|
||||
return A;
|
||||
})();
|
|
@ -0,0 +1,36 @@
|
|||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(6,13): error TS1237: 'private' modifier cannot be used with 'abstract' modifier.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(8,14): error TS1029: 'public' modifier must precede 'abstract' modifier.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(9,14): error TS1029: 'protected' modifier must precede 'abstract' modifier.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(10,14): error TS1029: 'private' modifier must precede 'abstract' modifier.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(12,14): error TS1237: 'static' modifier cannot be used with 'abstract' modifier.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(14,12): error TS1237: 'static' modifier cannot be used with 'abstract' modifier.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts (6 errors) ====
|
||||
abstract class A {
|
||||
abstract foo_a();
|
||||
|
||||
public abstract foo_b();
|
||||
protected abstract foo_c();
|
||||
private abstract foo_d();
|
||||
~~~~~~~~
|
||||
!!! error TS1237: 'private' modifier cannot be used with 'abstract' modifier.
|
||||
|
||||
abstract public foo_bb();
|
||||
~~~~~~
|
||||
!!! error TS1029: 'public' modifier must precede 'abstract' modifier.
|
||||
abstract protected foo_cc();
|
||||
~~~~~~~~~
|
||||
!!! error TS1029: 'protected' modifier must precede 'abstract' modifier.
|
||||
abstract private foo_dd();
|
||||
~~~~~~~
|
||||
!!! error TS1029: 'private' modifier must precede 'abstract' modifier.
|
||||
|
||||
abstract static foo_d();
|
||||
~~~~~~
|
||||
!!! error TS1237: 'static' modifier cannot be used with 'abstract' modifier.
|
||||
|
||||
static abstract foo_e();
|
||||
~~~~~~~~
|
||||
!!! error TS1237: 'static' modifier cannot be used with 'abstract' modifier.
|
||||
}
|
23
tests/baselines/reference/classAbstractMixedWithModifiers.js
Normal file
23
tests/baselines/reference/classAbstractMixedWithModifiers.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
//// [classAbstractMixedWithModifiers.ts]
|
||||
abstract class A {
|
||||
abstract foo_a();
|
||||
|
||||
public abstract foo_b();
|
||||
protected abstract foo_c();
|
||||
private abstract foo_d();
|
||||
|
||||
abstract public foo_bb();
|
||||
abstract protected foo_cc();
|
||||
abstract private foo_dd();
|
||||
|
||||
abstract static foo_d();
|
||||
|
||||
static abstract foo_e();
|
||||
}
|
||||
|
||||
//// [classAbstractMixedWithModifiers.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
42
tests/baselines/reference/classAbstractOverloads.errors.txt
Normal file
42
tests/baselines/reference/classAbstractOverloads.errors.txt
Normal file
|
@ -0,0 +1,42 @@
|
|||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(7,5): error TS2512: All overload signatures must match with respect to modifier 'abstract'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(10,14): error TS2512: All overload signatures must match with respect to modifier 'abstract'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(12,14): error TS2512: All overload signatures must match with respect to modifier 'abstract'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(15,5): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(20,14): error TS2516: All declarations of an abstract member function must be consecutive.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts (5 errors) ====
|
||||
abstract class A {
|
||||
abstract foo();
|
||||
abstract foo() : number;
|
||||
abstract foo();
|
||||
|
||||
abstract bar();
|
||||
bar();
|
||||
~~~
|
||||
!!! error TS2512: All overload signatures must match with respect to modifier 'abstract'.
|
||||
abstract bar();
|
||||
|
||||
abstract baz();
|
||||
~~~
|
||||
!!! error TS2512: All overload signatures must match with respect to modifier 'abstract'.
|
||||
baz();
|
||||
abstract baz();
|
||||
~~~
|
||||
!!! error TS2512: All overload signatures must match with respect to modifier 'abstract'.
|
||||
baz() {}
|
||||
|
||||
qux();
|
||||
~~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
|
||||
abstract class B {
|
||||
abstract foo() : number;
|
||||
abstract foo();
|
||||
~~~
|
||||
!!! error TS2516: All declarations of an abstract member function must be consecutive.
|
||||
x : number;
|
||||
abstract foo();
|
||||
abstract foo();
|
||||
}
|
38
tests/baselines/reference/classAbstractOverloads.js
Normal file
38
tests/baselines/reference/classAbstractOverloads.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
//// [classAbstractOverloads.ts]
|
||||
abstract class A {
|
||||
abstract foo();
|
||||
abstract foo() : number;
|
||||
abstract foo();
|
||||
|
||||
abstract bar();
|
||||
bar();
|
||||
abstract bar();
|
||||
|
||||
abstract baz();
|
||||
baz();
|
||||
abstract baz();
|
||||
baz() {}
|
||||
|
||||
qux();
|
||||
}
|
||||
|
||||
abstract class B {
|
||||
abstract foo() : number;
|
||||
abstract foo();
|
||||
x : number;
|
||||
abstract foo();
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
//// [classAbstractOverloads.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.prototype.baz = function () { };
|
||||
return A;
|
||||
})();
|
||||
var B = (function () {
|
||||
function B() {
|
||||
}
|
||||
return B;
|
||||
})();
|
29
tests/baselines/reference/classAbstractProperties.errors.txt
Normal file
29
tests/baselines/reference/classAbstractProperties.errors.txt
Normal file
|
@ -0,0 +1,29 @@
|
|||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(2,5): error TS1236: 'abstract' modifier can only appear on a class or member function declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(3,12): error TS1236: 'abstract' modifier can only appear on a class or member function declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(4,15): error TS1236: 'abstract' modifier can only appear on a class or member function declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(5,13): error TS1236: 'abstract' modifier can only appear on a class or member function declaration.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(10,13): error TS1237: 'private' modifier cannot be used with 'abstract' modifier.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts (5 errors) ====
|
||||
abstract class A {
|
||||
abstract x : number;
|
||||
~~~~~~~~
|
||||
!!! error TS1236: 'abstract' modifier can only appear on a class or member function declaration.
|
||||
public abstract y : number;
|
||||
~~~~~~~~
|
||||
!!! error TS1236: 'abstract' modifier can only appear on a class or member function declaration.
|
||||
protected abstract z : number;
|
||||
~~~~~~~~
|
||||
!!! error TS1236: 'abstract' modifier can only appear on a class or member function declaration.
|
||||
private abstract w : number;
|
||||
~~~~~~~~
|
||||
!!! error TS1236: 'abstract' modifier can only appear on a class or member function declaration.
|
||||
|
||||
abstract foo_x() : number;
|
||||
public abstract foo_y() : number;
|
||||
protected abstract foo_z() : number;
|
||||
private abstract foo_w() : number;
|
||||
~~~~~~~~
|
||||
!!! error TS1237: 'private' modifier cannot be used with 'abstract' modifier.
|
||||
}
|
19
tests/baselines/reference/classAbstractProperties.js
Normal file
19
tests/baselines/reference/classAbstractProperties.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
//// [classAbstractProperties.ts]
|
||||
abstract class A {
|
||||
abstract x : number;
|
||||
public abstract y : number;
|
||||
protected abstract z : number;
|
||||
private abstract w : number;
|
||||
|
||||
abstract foo_x() : number;
|
||||
public abstract foo_y() : number;
|
||||
protected abstract foo_z() : number;
|
||||
private abstract foo_w() : number;
|
||||
}
|
||||
|
||||
//// [classAbstractProperties.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
33
tests/baselines/reference/classAbstractSuperCalls.errors.txt
Normal file
33
tests/baselines/reference/classAbstractSuperCalls.errors.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractSuperCalls.ts(14,26): error TS2513: Abstract member function 'foo' on type 'B' cannot be called via super expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractSuperCalls.ts (1 errors) ====
|
||||
|
||||
class A {
|
||||
foo() { return 1; }
|
||||
}
|
||||
|
||||
abstract class B extends A {
|
||||
abstract foo();
|
||||
bar() { super.foo(); }
|
||||
baz() { return this.foo; }
|
||||
}
|
||||
|
||||
class C extends B {
|
||||
foo() { return 2; }
|
||||
qux() { return super.foo(); } // error, super is abstract
|
||||
~~~
|
||||
!!! error TS2513: Abstract member function 'foo' on type 'B' cannot be called via super expression.
|
||||
norf() { return super.bar(); }
|
||||
}
|
||||
|
||||
class AA {
|
||||
foo() { return 1; }
|
||||
bar() { return this.foo(); }
|
||||
}
|
||||
|
||||
abstract class BB extends AA {
|
||||
abstract foo();
|
||||
// inherits bar. But BB is abstract, so this is OK.
|
||||
}
|
||||
|
75
tests/baselines/reference/classAbstractSuperCalls.js
Normal file
75
tests/baselines/reference/classAbstractSuperCalls.js
Normal file
|
@ -0,0 +1,75 @@
|
|||
//// [classAbstractSuperCalls.ts]
|
||||
|
||||
class A {
|
||||
foo() { return 1; }
|
||||
}
|
||||
|
||||
abstract class B extends A {
|
||||
abstract foo();
|
||||
bar() { super.foo(); }
|
||||
baz() { return this.foo; }
|
||||
}
|
||||
|
||||
class C extends B {
|
||||
foo() { return 2; }
|
||||
qux() { return super.foo(); } // error, super is abstract
|
||||
norf() { return super.bar(); }
|
||||
}
|
||||
|
||||
class AA {
|
||||
foo() { return 1; }
|
||||
bar() { return this.foo(); }
|
||||
}
|
||||
|
||||
abstract class BB extends AA {
|
||||
abstract foo();
|
||||
// inherits bar. But BB is abstract, so this is OK.
|
||||
}
|
||||
|
||||
|
||||
//// [classAbstractSuperCalls.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.prototype.foo = function () { return 1; };
|
||||
return A;
|
||||
})();
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
B.prototype.bar = function () { _super.prototype.foo.call(this); };
|
||||
B.prototype.baz = function () { return this.foo; };
|
||||
return B;
|
||||
})(A);
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
C.prototype.foo = function () { return 2; };
|
||||
C.prototype.qux = function () { return _super.prototype.foo.call(this); }; // error, super is abstract
|
||||
C.prototype.norf = function () { return _super.prototype.bar.call(this); };
|
||||
return C;
|
||||
})(B);
|
||||
var AA = (function () {
|
||||
function AA() {
|
||||
}
|
||||
AA.prototype.foo = function () { return 1; };
|
||||
AA.prototype.bar = function () { return this.foo(); };
|
||||
return AA;
|
||||
})();
|
||||
var BB = (function (_super) {
|
||||
__extends(BB, _super);
|
||||
function BB() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return BB;
|
||||
})(AA);
|
|
@ -0,0 +1,23 @@
|
|||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractUsingAbstractMethod.ts(16,5): error TS2511: Cannot create an instance of the abstract class 'C'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractUsingAbstractMethod.ts (1 errors) ====
|
||||
abstract class A {
|
||||
abstract foo() : number;
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
foo() { return 1; }
|
||||
}
|
||||
|
||||
abstract class C extends A {
|
||||
abstract foo() : number;
|
||||
}
|
||||
|
||||
var a = new B;
|
||||
a.foo();
|
||||
|
||||
a = new C; // error, cannot instantiate abstract class.
|
||||
~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'C'.
|
||||
a.foo();
|
|
@ -0,0 +1,50 @@
|
|||
//// [classAbstractUsingAbstractMethod.ts]
|
||||
abstract class A {
|
||||
abstract foo() : number;
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
foo() { return 1; }
|
||||
}
|
||||
|
||||
abstract class C extends A {
|
||||
abstract foo() : number;
|
||||
}
|
||||
|
||||
var a = new B;
|
||||
a.foo();
|
||||
|
||||
a = new C; // error, cannot instantiate abstract class.
|
||||
a.foo();
|
||||
|
||||
//// [classAbstractUsingAbstractMethod.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
B.prototype.foo = function () { return 1; };
|
||||
return B;
|
||||
})(A);
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C;
|
||||
})(A);
|
||||
var a = new B;
|
||||
a.foo();
|
||||
a = new C; // error, cannot instantiate abstract class.
|
||||
a.foo();
|
|
@ -0,0 +1,39 @@
|
|||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classInstantiatingAbstractClass.ts(8,1): error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classInstantiatingAbstractClass.ts(10,1): error TS2511: Cannot create an instance of the abstract class 'C'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classInstantiatingAbstractClass.ts(26,10): error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classInstantiatingAbstractClass.ts (3 errors) ====
|
||||
|
||||
abstract class A {}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
abstract class C extends B {}
|
||||
|
||||
new A;
|
||||
~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
new B;
|
||||
new C;
|
||||
~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'C'.
|
||||
|
||||
var a : A;
|
||||
var b : B;
|
||||
var c : C;
|
||||
|
||||
a = new B;
|
||||
b = new B;
|
||||
c = new B;
|
||||
|
||||
module M {
|
||||
export abstract class A {}
|
||||
}
|
||||
|
||||
import myA = M.A;
|
||||
|
||||
var aa = new myA;
|
||||
~~~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
|
75
tests/baselines/reference/classInstantiatingAbstractClass.js
Normal file
75
tests/baselines/reference/classInstantiatingAbstractClass.js
Normal file
|
@ -0,0 +1,75 @@
|
|||
//// [classInstantiatingAbstractClass.ts]
|
||||
|
||||
abstract class A {}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
abstract class C extends B {}
|
||||
|
||||
new A;
|
||||
new B;
|
||||
new C;
|
||||
|
||||
var a : A;
|
||||
var b : B;
|
||||
var c : C;
|
||||
|
||||
a = new B;
|
||||
b = new B;
|
||||
c = new B;
|
||||
|
||||
module M {
|
||||
export abstract class A {}
|
||||
}
|
||||
|
||||
import myA = M.A;
|
||||
|
||||
var aa = new myA;
|
||||
|
||||
|
||||
//// [classInstantiatingAbstractClass.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
})(A);
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C;
|
||||
})(B);
|
||||
new A;
|
||||
new B;
|
||||
new C;
|
||||
var a;
|
||||
var b;
|
||||
var c;
|
||||
a = new B;
|
||||
b = new B;
|
||||
c = new B;
|
||||
var M;
|
||||
(function (M) {
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
M.A = A;
|
||||
})(M || (M = {}));
|
||||
var myA = M.A;
|
||||
var aa = new myA;
|
|
@ -0,0 +1,46 @@
|
|||
tests/cases/conformance/classes/classDeclarations/classWithAbstractMethods.ts(1,7): error TS2514: Classes containing abstract functions must be marked abstract.
|
||||
tests/cases/conformance/classes/classDeclarations/classWithAbstractMethods.ts(2,5): error TS1238: Abstract methods can only appear within an abstract class.
|
||||
tests/cases/conformance/classes/classDeclarations/classWithAbstractMethods.ts(5,7): error TS2415: Class 'B' incorrectly extends base class 'A'.
|
||||
Non-abstract class 'B' does not implement inherited abstract member 'A.foo'.
|
||||
tests/cases/conformance/classes/classDeclarations/classWithAbstractMethods.ts(21,7): error TS2415: Class 'BB' incorrectly extends base class 'AA'.
|
||||
Non-abstract class 'BB' does not implement inherited abstract member 'AA.foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classWithAbstractMethods.ts (4 errors) ====
|
||||
class A {
|
||||
~
|
||||
!!! error TS2514: Classes containing abstract functions must be marked abstract.
|
||||
abstract foo();
|
||||
~~~~~~~~
|
||||
!!! error TS1238: Abstract methods can only appear within an abstract class.
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
~
|
||||
!!! error TS2415: Class 'B' incorrectly extends base class 'A'.
|
||||
!!! error TS2415: Non-abstract class 'B' does not implement inherited abstract member 'A.foo'.
|
||||
|
||||
abstract class C extends A {}
|
||||
|
||||
class D extends A {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
abstract class E extends A {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
abstract class AA {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
class BB extends AA {}
|
||||
~~
|
||||
!!! error TS2415: Class 'BB' incorrectly extends base class 'AA'.
|
||||
!!! error TS2415: Non-abstract class 'BB' does not implement inherited abstract member 'AA.foo'.
|
||||
|
||||
abstract class CC extends AA {}
|
||||
|
||||
class DD extends AA {
|
||||
foo() {}
|
||||
}
|
98
tests/baselines/reference/classWithAbstractMethods.js
Normal file
98
tests/baselines/reference/classWithAbstractMethods.js
Normal file
|
@ -0,0 +1,98 @@
|
|||
//// [classWithAbstractMethods.ts]
|
||||
class A {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
abstract class C extends A {}
|
||||
|
||||
class D extends A {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
abstract class E extends A {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
abstract class AA {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
class BB extends AA {}
|
||||
|
||||
abstract class CC extends AA {}
|
||||
|
||||
class DD extends AA {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
//// [classWithAbstractMethods.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
})(A);
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C;
|
||||
})(A);
|
||||
var D = (function (_super) {
|
||||
__extends(D, _super);
|
||||
function D() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
D.prototype.foo = function () { };
|
||||
return D;
|
||||
})(A);
|
||||
var E = (function (_super) {
|
||||
__extends(E, _super);
|
||||
function E() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
E.prototype.foo = function () { };
|
||||
return E;
|
||||
})(A);
|
||||
var AA = (function () {
|
||||
function AA() {
|
||||
}
|
||||
return AA;
|
||||
})();
|
||||
var BB = (function (_super) {
|
||||
__extends(BB, _super);
|
||||
function BB() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return BB;
|
||||
})(AA);
|
||||
var CC = (function (_super) {
|
||||
__extends(CC, _super);
|
||||
function CC() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return CC;
|
||||
})(AA);
|
||||
var DD = (function (_super) {
|
||||
__extends(DD, _super);
|
||||
function DD() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
DD.prototype.foo = function () { };
|
||||
return DD;
|
||||
})(AA);
|
|
@ -1,4 +1,4 @@
|
|||
tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts (1 errors) ====
|
||||
|
@ -14,7 +14,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11
|
|||
//treatment of other similar violations.
|
||||
[(super(), "prop")]() { }
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts (1 errors) ====
|
||||
|
@ -14,7 +14,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts(11
|
|||
//treatment of other similar violations.
|
||||
[(super(), "prop")]() { }
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod12.ts(6,10): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod12.ts(6,10): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod12.ts (1 errors) ====
|
||||
|
@ -9,7 +9,7 @@ tests/cases/conformance/decorators/class/method/decoratorOnClassMethod12.ts(6,10
|
|||
class C extends S {
|
||||
@super.decorator
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
method() { }
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts(8,5): error TS2377: Constructors for derived classes must contain a 'super' call.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts(17,5): error TS2377: Constructors for derived classes must contain a 'super' call.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts(18,24): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts(18,24): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts(23,5): error TS2377: Constructors for derived classes must contain a 'super' call.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts(24,31): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts(24,31): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts (5 errors) ====
|
||||
|
@ -30,7 +30,7 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassC
|
|||
var r2 = () => super(); // error for misplaced super call (nested function)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
}
|
||||
~~~~~
|
||||
!!! error TS2377: Constructors for derived classes must contain a 'super' call.
|
||||
|
@ -42,7 +42,7 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassC
|
|||
var r = function () { super() } // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
}
|
||||
~~~~~
|
||||
!!! error TS2377: Constructors for derived classes must contain a 'super' call.
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,8): error TS1110: Type expected.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,8): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(10,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(13,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(17,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,8): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(10,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(13,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(17,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,15): error TS1110: Type expected.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,15): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(22,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(25,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(29,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,15): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(22,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(25,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(29,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts (10 errors) ====
|
||||
|
@ -22,43 +22,43 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassS
|
|||
~~~~~
|
||||
!!! error TS1110: Type expected.
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
b() {
|
||||
super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
}
|
||||
get C() {
|
||||
super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
return 1;
|
||||
}
|
||||
set C(v) {
|
||||
super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
}
|
||||
|
||||
static a: super();
|
||||
~~~~~
|
||||
!!! error TS1110: Type expected.
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
static b() {
|
||||
super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
}
|
||||
static get C() {
|
||||
super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
return 1;
|
||||
}
|
||||
static set C(v) {
|
||||
super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
tests/cases/compiler/emitThisInSuperMethodCall.ts(10,17): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/compiler/emitThisInSuperMethodCall.ts(17,17): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/compiler/emitThisInSuperMethodCall.ts(23,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/compiler/emitThisInSuperMethodCall.ts(10,17): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
tests/cases/compiler/emitThisInSuperMethodCall.ts(17,17): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
tests/cases/compiler/emitThisInSuperMethodCall.ts(23,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
|
||||
|
||||
==== tests/cases/compiler/emitThisInSuperMethodCall.ts (3 errors) ====
|
||||
|
@ -15,7 +15,7 @@ tests/cases/compiler/emitThisInSuperMethodCall.ts(23,13): error TS2338: 'super'
|
|||
function inner() {
|
||||
super.sayHello();
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ tests/cases/compiler/emitThisInSuperMethodCall.ts(23,13): error TS2338: 'super'
|
|||
() => {
|
||||
super.sayHello();
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ tests/cases/compiler/emitThisInSuperMethodCall.ts(23,13): error TS2338: 'super'
|
|||
function inner() {
|
||||
super.sayHello();
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(30,16): error
|
|||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(34,9): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(38,9): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(46,14): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(58,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(62,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(67,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(71,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(58,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(62,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(67,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(71,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts (14 errors) ====
|
||||
|
@ -94,26 +94,26 @@ tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(71,9): error T
|
|||
//super call in class member initializer of derived type
|
||||
t = super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
|
||||
fn() {
|
||||
//super call in class member function of derived type
|
||||
super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
}
|
||||
|
||||
//super call in class accessor (get and set) of derived type
|
||||
get foo() {
|
||||
super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
return null;
|
||||
}
|
||||
set foo(n) {
|
||||
super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
}
|
||||
}
|
||||
|
|
@ -9,30 +9,30 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess
|
|||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(25,9): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(29,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(30,9): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(57,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(61,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(57,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(61,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(64,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(65,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(65,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(68,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(69,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(73,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(76,40): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(87,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(91,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(69,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(73,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(76,40): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(87,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(91,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(94,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(95,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(95,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(98,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(99,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(109,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(110,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(99,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(109,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(110,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(111,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(113,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(114,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(115,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(114,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(115,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(116,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(119,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(120,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(121,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(120,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(121,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(122,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(127,16): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(127,30): error TS2335: 'super' can only be referenced in a derived class.
|
||||
|
@ -119,13 +119,13 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess
|
|||
super();
|
||||
super.publicMember = 1;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
|
||||
fn() {
|
||||
var x = super.publicMember;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
|
||||
get a() {
|
||||
|
@ -133,7 +133,7 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess
|
|||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
var x = super.publicMember;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
return undefined;
|
||||
}
|
||||
set a(n) {
|
||||
|
@ -141,18 +141,18 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess
|
|||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
n = super.publicMember;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
fn2() {
|
||||
function inner() {
|
||||
super.publicFunc();
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
}
|
||||
var x = {
|
||||
test: function () { return super.publicFunc(); }
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,13 +165,13 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess
|
|||
super();
|
||||
super.privateMember = 1;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
|
||||
fn() {
|
||||
var x = super.privateMember;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
|
||||
get a() {
|
||||
|
@ -179,7 +179,7 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess
|
|||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
var x = super.privateMember;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
return undefined;
|
||||
}
|
||||
set a(n) {
|
||||
|
@ -187,7 +187,7 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess
|
|||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
n = super.privateMember;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,10 +199,10 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess
|
|||
static fn() {
|
||||
super.publicStaticMember = 3;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
super.privateStaticMember = 3;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
super.privateStaticFunc();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'.
|
||||
|
@ -212,10 +212,10 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess
|
|||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
super.publicStaticMember = 3;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
super.privateStaticMember = 3;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
super.privateStaticFunc();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'.
|
||||
|
@ -226,10 +226,10 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess
|
|||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
super.publicStaticMember = 3;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
super.privateStaticMember = 3;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
super.privateStaticFunc();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(6,5): error TS2377: Constructors for derived classes must contain a 'super' call.
|
||||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(7,24): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(8,26): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(9,32): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(7,24): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(8,26): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(9,32): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(12,17): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(12,17): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(15,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(16,17): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/compiler/illegalSuperCallsInConstructor.ts(16,17): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
|
||||
|
||||
==== tests/cases/compiler/illegalSuperCallsInConstructor.ts (8 errors) ====
|
||||
|
@ -19,15 +19,15 @@ tests/cases/compiler/illegalSuperCallsInConstructor.ts(16,17): error TS2337: Sup
|
|||
var r2 = () => super();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
var r3 = () => { super(); }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
var r4 = function () { super(); }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
var r5 = {
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
get foo() {
|
||||
|
@ -37,7 +37,7 @@ tests/cases/compiler/illegalSuperCallsInConstructor.ts(16,17): error TS2337: Sup
|
|||
super();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
return 1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
},
|
||||
|
@ -49,7 +49,7 @@ tests/cases/compiler/illegalSuperCallsInConstructor.ts(16,17): error TS2337: Sup
|
|||
super();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
}
|
||||
~~~~~~~~~~~~~
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@ tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(79,16): error TS10
|
|||
tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(85,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(94,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(100,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(111,25): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(111,25): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(119,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(125,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(217,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(217,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts (8 errors) ====
|
||||
|
@ -129,7 +129,7 @@ tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(217,24): error TS2
|
|||
super(10);
|
||||
this.p1 = super.c2_p1;
|
||||
~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
/** c3 p1*/
|
||||
public p1: number;
|
||||
|
@ -241,6 +241,6 @@ tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(217,24): error TS2
|
|||
super();
|
||||
this.d = super.b;
|
||||
~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(6,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(8,22): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(6,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(8,22): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(10,15): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(10,21): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(10,21): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(12,8): error TS1110: Type expected.
|
||||
tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(12,8): error TS2341: Property 'foo' is private and only accessible within class 'Base'.
|
||||
|
||||
|
@ -14,17 +14,17 @@ tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAcces
|
|||
class Derived extends Base {
|
||||
x = super.foo; // error
|
||||
~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
y() {
|
||||
return super.foo; // error
|
||||
~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
z: typeof super.foo; // error
|
||||
~~~~~
|
||||
!!! error TS1003: Identifier expected.
|
||||
~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
|
||||
a: this.foo; // error
|
||||
~~~~
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass3.ts(11,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass3.ts(11,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass3.ts (1 errors) ====
|
||||
|
@ -14,6 +14,6 @@ tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAcce
|
|||
this.x; // OK, accessed within a subclass of the declaring class
|
||||
super.x; // Error, x is not public
|
||||
~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(14,23): error TS2339: Property 'z' does not exist on type 'B'.
|
||||
tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(16,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(16,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(18,24): error TS2339: Property 'y' does not exist on type 'A'.
|
||||
tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(19,24): error TS2339: Property 'z' does not exist on type 'A'.
|
||||
tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(22,18): error TS2446: Property 'x' is protected and only accessible through an instance of class 'B'.
|
||||
|
@ -33,7 +33,7 @@ tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAcc
|
|||
|
||||
var s1 = super.x; // error
|
||||
~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
var s2 = super.f();
|
||||
var s3 = super.y; // error
|
||||
~
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass2.ts(11,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass2.ts(19,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass2.ts(11,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass2.ts(19,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass2.ts (2 errors) ====
|
||||
|
@ -15,7 +15,7 @@ tests/cases/conformance/classes/members/accessibility/protectedStaticClassProper
|
|||
this.x; // OK, accessed within a class derived from their declaring class
|
||||
super.x; // Error, x is not public
|
||||
~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,6 @@ tests/cases/conformance/classes/members/accessibility/protectedStaticClassProper
|
|||
this.x; // OK, accessed within a class derived from their declaring class
|
||||
super.x; // Error, x is not public
|
||||
~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
tests/cases/compiler/superAccess.ts(9,24): error TS2339: Property 'S1' does not exist on type 'MyBase'.
|
||||
tests/cases/compiler/superAccess.ts(10,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superAccess.ts(11,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superAccess.ts(10,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/compiler/superAccess.ts(11,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
|
||||
|
||||
==== tests/cases/compiler/superAccess.ts (3 errors) ====
|
||||
|
@ -17,9 +17,9 @@ tests/cases/compiler/superAccess.ts(11,24): error TS2340: Only public and protec
|
|||
!!! error TS2339: Property 'S1' does not exist on type 'MyBase'.
|
||||
var l4 = super.S2; // Expected => Error: Only public instance methods of the base class are accessible via the 'super' keyword
|
||||
~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
var l5 = super.f(); // Expected => Error: Only public instance methods of the base class are accessible via the 'super' keyword
|
||||
~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
tests/cases/compiler/superAccess2.ts(7,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/compiler/superAccess2.ts(8,17): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/compiler/superAccess2.ts(8,17): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
tests/cases/compiler/superAccess2.ts(8,22): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/compiler/superAccess2.ts(11,28): error TS2336: 'super' cannot be referenced in constructor arguments.
|
||||
tests/cases/compiler/superAccess2.ts(11,33): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
|
@ -25,7 +25,7 @@ tests/cases/compiler/superAccess2.ts(21,15): error TS2339: Property 'x' does not
|
|||
!!! error TS1034: 'super' must be followed by an argument list or member access.
|
||||
static yy = super; // error for static initializer accessing super
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
~
|
||||
!!! error TS1034: 'super' must be followed by an argument list or member access.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
tests/cases/compiler/superCallOutsideConstructor.ts(6,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/compiler/superCallOutsideConstructor.ts(12,13): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/compiler/superCallOutsideConstructor.ts(16,13): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/compiler/superCallOutsideConstructor.ts(6,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/compiler/superCallOutsideConstructor.ts(12,13): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/compiler/superCallOutsideConstructor.ts(16,13): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
|
||||
|
||||
==== tests/cases/compiler/superCallOutsideConstructor.ts (3 errors) ====
|
||||
|
@ -11,7 +11,7 @@ tests/cases/compiler/superCallOutsideConstructor.ts(16,13): error TS2337: Super
|
|||
class D extends C {
|
||||
x = super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -19,13 +19,13 @@ tests/cases/compiler/superCallOutsideConstructor.ts(16,13): error TS2337: Super
|
|||
var y = () => {
|
||||
super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
}
|
||||
|
||||
var y2 = function() {
|
||||
super();
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,12 +4,12 @@ tests/cases/compiler/superErrors.ts(4,19): error TS2335: 'super' can only be ref
|
|||
tests/cases/compiler/superErrors.ts(4,24): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/compiler/superErrors.ts(5,31): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/compiler/superErrors.ts(5,36): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/compiler/superErrors.ts(22,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/compiler/superErrors.ts(27,27): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/compiler/superErrors.ts(31,36): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/compiler/superErrors.ts(22,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
tests/cases/compiler/superErrors.ts(27,27): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
tests/cases/compiler/superErrors.ts(31,36): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
tests/cases/compiler/superErrors.ts(31,41): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/compiler/superErrors.ts(39,27): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/compiler/superErrors.ts(43,36): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/compiler/superErrors.ts(39,27): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
tests/cases/compiler/superErrors.ts(43,36): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
tests/cases/compiler/superErrors.ts(43,41): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/compiler/superErrors.ts(47,22): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/compiler/superErrors.ts(48,28): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
|
@ -52,20 +52,20 @@ tests/cases/compiler/superErrors.ts(49,40): error TS1034: 'super' must be follow
|
|||
function inner() {
|
||||
super.sayHello();
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
}
|
||||
|
||||
// super call in a lambda in an inner function in a constructor
|
||||
function inner2() {
|
||||
var x = () => super.sayHello();
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
}
|
||||
|
||||
// super call in a lambda in a function expression in a constructor
|
||||
(function() { return () => super; })();
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
~
|
||||
!!! error TS1034: 'super' must be followed by an argument list or member access.
|
||||
}
|
||||
|
@ -77,13 +77,13 @@ tests/cases/compiler/superErrors.ts(49,40): error TS1034: 'super' must be follow
|
|||
function inner() {
|
||||
var x = () => super.sayHello();
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
}
|
||||
|
||||
// super call in a lambda in a function expression in a constructor
|
||||
(function() { return () => super; })();
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
~
|
||||
!!! error TS1034: 'super' must be followed by an argument list or member access.
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
tests/cases/compiler/superInLambdas.ts(47,49): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superInLambdas.ts(51,49): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superInLambdas.ts(47,49): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/compiler/superInLambdas.ts(51,49): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/compiler/superInLambdas.ts(61,34): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/compiler/superInLambdas.ts(65,34): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
|
||||
|
@ -53,13 +53,13 @@ tests/cases/compiler/superInLambdas.ts(65,34): error TS1034: 'super' must be fol
|
|||
// super property in a nested lambda in a constructor
|
||||
var superName = () => () => () => super.name;
|
||||
~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
sayHello(): void {
|
||||
// super property in a nested lambda in a method
|
||||
var superName = () => () => () => super.name;
|
||||
~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
tests/cases/compiler/superPropertyAccess.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/superPropertyAccess.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/superPropertyAccess.ts(22,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superPropertyAccess.ts(22,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/compiler/superPropertyAccess.ts(24,9): error TS2341: Property 'p1' is private and only accessible within class 'MyBase'.
|
||||
tests/cases/compiler/superPropertyAccess.ts(26,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superPropertyAccess.ts(28,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superPropertyAccess.ts(32,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superPropertyAccess.ts(34,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superPropertyAccess.ts(26,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/compiler/superPropertyAccess.ts(28,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/compiler/superPropertyAccess.ts(32,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/compiler/superPropertyAccess.ts(34,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
|
||||
|
||||
==== tests/cases/compiler/superPropertyAccess.ts (8 errors) ====
|
||||
|
@ -36,7 +36,7 @@ tests/cases/compiler/superPropertyAccess.ts(34,23): error TS2340: Only public an
|
|||
|
||||
super.m2.bind(this); // Should error, instance property, not a public instance member function
|
||||
~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
|
||||
super.p1(); // Should error, private not public instance member function
|
||||
~~~~~~~~
|
||||
|
@ -44,20 +44,20 @@ tests/cases/compiler/superPropertyAccess.ts(34,23): error TS2340: Only public an
|
|||
|
||||
var l1 = super.d1; // Should error, instance data property not a public instance member function
|
||||
~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
|
||||
var l1 = super.d2; // Should error, instance data property not a public instance member function
|
||||
~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
|
||||
super.m1 = function (a: string) { return ""; }; // Should be allowed, we will not restrict assignment
|
||||
|
||||
super.value = 0; // Should error, instance data property not a public instance member function
|
||||
~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
|
||||
var z = super.value; // Should error, instance data property not a public instance member function
|
||||
~~~~~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
tests/cases/compiler/superPropertyAccess1.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/superPropertyAccess1.ts(13,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superPropertyAccess1.ts(19,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superPropertyAccess1.ts(13,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/compiler/superPropertyAccess1.ts(19,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/compiler/superPropertyAccess1.ts(22,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/superPropertyAccess1.ts(24,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superPropertyAccess1.ts(24,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
|
||||
|
||||
==== tests/cases/compiler/superPropertyAccess1.ts (5 errors) ====
|
||||
|
@ -22,7 +22,7 @@ tests/cases/compiler/superPropertyAccess1.ts(24,15): error TS2340: Only public a
|
|||
super.bar();
|
||||
super.x; // error
|
||||
~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
|
||||
constructor() {
|
||||
|
@ -30,7 +30,7 @@ tests/cases/compiler/superPropertyAccess1.ts(24,15): error TS2340: Only public a
|
|||
super.bar();
|
||||
super.x; // error
|
||||
~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
|
||||
public get y() {
|
||||
|
@ -39,7 +39,7 @@ tests/cases/compiler/superPropertyAccess1.ts(24,15): error TS2340: Only public a
|
|||
super.bar();
|
||||
super.x; // error
|
||||
~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
tests/cases/compiler/superPropertyAccess2.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/superPropertyAccess2.ts(13,15): error TS2339: Property 'x' does not exist on type 'typeof C'.
|
||||
tests/cases/compiler/superPropertyAccess2.ts(18,15): error TS2339: Property 'bar' does not exist on type 'C'.
|
||||
tests/cases/compiler/superPropertyAccess2.ts(19,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
tests/cases/compiler/superPropertyAccess2.ts(19,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
tests/cases/compiler/superPropertyAccess2.ts(22,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/superPropertyAccess2.ts(24,15): error TS2339: Property 'x' does not exist on type 'typeof C'.
|
||||
|
||||
|
@ -33,7 +33,7 @@ tests/cases/compiler/superPropertyAccess2.ts(24,15): error TS2339: Property 'x'
|
|||
!!! error TS2339: Property 'bar' does not exist on type 'C'.
|
||||
super.x; // error
|
||||
~
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
||||
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
|
||||
}
|
||||
|
||||
public static get y() {
|
||||
|
|
|
@ -4,7 +4,7 @@ tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(7,13): e
|
|||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(8,13): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(11,20): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(20,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(21,24): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(21,24): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
|
||||
|
||||
==== tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts (7 errors) ====
|
||||
|
@ -42,7 +42,7 @@ tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(21,24):
|
|||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
return super.test();
|
||||
~~~~~
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
||||
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue