mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-19 00:42:28 -05:00
Accepted baselines
This commit is contained in:
57
tests/baselines/reference/abstractClass1.errors.txt
Normal file
57
tests/baselines/reference/abstractClass1.errors.txt
Normal file
@@ -0,0 +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'
|
||||
|
||||
107
tests/baselines/reference/abstractClass1.js
Normal file
107
tests/baselines/reference/abstractClass1.js
Normal file
@@ -0,0 +1,107 @@
|
||||
//// [abstractClass1.ts]
|
||||
|
||||
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
|
||||
var b = new Foo(); // Error because of invalid constructor arguments
|
||||
|
||||
module baz {
|
||||
export abstract class Qux {
|
||||
}
|
||||
export class Quz extends Qux {
|
||||
}
|
||||
}
|
||||
|
||||
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.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;
|
||||
14
tests/baselines/reference/abstractClassIdentifierName.js
Normal file
14
tests/baselines/reference/abstractClassIdentifierName.js
Normal file
@@ -0,0 +1,14 @@
|
||||
//// [abstractClassIdentifierName.ts]
|
||||
class abstract {
|
||||
|
||||
abstract(): void { }
|
||||
}
|
||||
|
||||
|
||||
//// [abstractClassIdentifierName.js]
|
||||
var abstract = (function () {
|
||||
function abstract() {
|
||||
}
|
||||
abstract.prototype.abstract = function () { };
|
||||
return abstract;
|
||||
})();
|
||||
@@ -0,0 +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))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/abstractClassIdentifierName.ts ===
|
||||
class abstract {
|
||||
>abstract : abstract
|
||||
|
||||
abstract(): void { }
|
||||
>abstract : () => void
|
||||
}
|
||||
|
||||
14
tests/baselines/reference/abstractIdentifierNameStrict.js
Normal file
14
tests/baselines/reference/abstractIdentifierNameStrict.js
Normal file
@@ -0,0 +1,14 @@
|
||||
//// [abstractIdentifierNameStrict.ts]
|
||||
var abstract = true;
|
||||
|
||||
function foo() {
|
||||
"use strict";
|
||||
var abstract = true;
|
||||
}
|
||||
|
||||
//// [abstractIdentifierNameStrict.js]
|
||||
var abstract = true;
|
||||
function foo() {
|
||||
"use strict";
|
||||
var abstract = true;
|
||||
}
|
||||
@@ -0,0 +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))
|
||||
}
|
||||
15
tests/baselines/reference/abstractIdentifierNameStrict.types
Normal file
15
tests/baselines/reference/abstractIdentifierNameStrict.types
Normal file
@@ -0,0 +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
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [abstractInterfaceIdentifierName.ts]
|
||||
|
||||
interface abstract {
|
||||
abstract(): void;
|
||||
}
|
||||
|
||||
|
||||
//// [abstractInterfaceIdentifierName.js]
|
||||
@@ -0,0 +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))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/abstractInterfaceIdentifierName.ts ===
|
||||
|
||||
interface abstract {
|
||||
>abstract : abstract
|
||||
|
||||
abstract(): void;
|
||||
>abstract : () => void
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user