Skip to content

Commit

Permalink
Better test files
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanCavanaugh committed Jan 28, 2021
1 parent e86e10d commit d2affa2
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 250 deletions.
78 changes: 0 additions & 78 deletions tests/baselines/reference/divergentAccessorsTypes1.errors.txt

This file was deleted.

53 changes: 21 additions & 32 deletions tests/baselines/reference/divergentAccessorsTypes1.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,54 +65,43 @@ type Test3 = {

//// [divergentAccessorsTypes1.js]
"use strict";
var Test1 = /** @class */ (function () {
function Test1() {
class Test1 {
get foo() { return ""; }
set foo(s) {
let a = s;
let b = s;
}
Object.defineProperty(Test1.prototype, "foo", {
get: function () { return ""; },
set: function (s) {
var a = s;
var b = s;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Test1.prototype, "bar", {
get: function () { return ""; },
set: function (s) {
},
enumerable: false,
configurable: true
});
return Test1;
}());
get bar() { return ""; }
set bar(s) {
}
}
{
var t = new Test1();
const t = new Test1();
t.foo = 32;
var m = t.foo;
let m = t.foo;
// See how CFA interacts with out-of-type writes
t.bar = 42;
var n = t.bar;
let n = t.bar;
t.bar = false;
var o = t.bar;
let o = t.bar;
}
{
var t = {};
const t = {};
t.foo = 32;
var m = t.foo;
let m = t.foo;
// See how CFA interacts with out-of-type writes
t.bar = 42;
var n = t.bar;
let n = t.bar;
t.bar = false;
var o = t.bar;
let o = t.bar;
}
{
var t = {};
const t = {};
t.foo = 32;
var m = t.foo;
let m = t.foo;
// See how CFA interacts with out-of-type writes
t.bar = 42;
var n = t.bar;
let n = t.bar;
t.bar = false;
var o = t.bar;
let o = t.bar;
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
tests/cases/compiler/divergentAccessorsVisibility1.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(6,19): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(9,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(11,19): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(11,19): error TS2798: A get accessor must be at least as accessible as the setter
tests/cases/compiler/divergentAccessorsVisibility1.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(12,9): error TS2798: A get accessor must be at least as accessible as the setter
tests/cases/compiler/divergentAccessorsVisibility1.ts(14,19): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(15,19): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(17,19): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(18,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(20,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(20,17): error TS2798: A get accessor must be at least as accessible as the setter
tests/cases/compiler/divergentAccessorsVisibility1.ts(21,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(21,9): error TS2798: A get accessor must be at least as accessible as the setter
tests/cases/compiler/divergentAccessorsVisibility1.ts(23,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(23,17): error TS2798: A get accessor must be at least as accessible as the setter
tests/cases/compiler/divergentAccessorsVisibility1.ts(24,19): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(24,19): error TS2798: A get accessor must be at least as accessible as the setter
tests/cases/compiler/divergentAccessorsVisibility1.ts(26,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(27,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/divergentAccessorsVisibility1.ts(66,14): error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'.
tests/cases/compiler/divergentAccessorsVisibility1.ts(69,14): error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'.
tests/cases/compiler/divergentAccessorsVisibility1.ts(72,14): error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'.
Expand Down Expand Up @@ -69,82 +51,46 @@ tests/cases/compiler/divergentAccessorsVisibility1.ts(155,11): error TS2445: Pro
tests/cases/compiler/divergentAccessorsVisibility1.ts(156,11): error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'.


==== tests/cases/compiler/divergentAccessorsVisibility1.ts (69 errors) ====
==== tests/cases/compiler/divergentAccessorsVisibility1.ts (51 errors) ====
class Base {
get PublicPublic() { return 0; }
~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
set PublicPublic(v) { return; }
~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

get PublicProtected() { return 0; }
~~~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
protected set PublicProtected(v) { return; }
~~~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

get PublicPrivate() { return 0; }
~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
private set PublicPrivate(v) { return; }
~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

protected get ProtectedPublic() { return 0; }
~~~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
~~~~~~~~~~~~~~~
!!! error TS2798: A get accessor must be at least as accessible as the setter
set ProtectedPublic(v) { return; }
~~~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
~~~~~~~~~~~~~~~
!!! error TS2798: A get accessor must be at least as accessible as the setter

protected get ProtectedProtected() { return 0; }
~~~~~~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
protected set ProtectedProtected(v) { return; }
~~~~~~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

protected get ProtectedPrivate() { return 0; }
~~~~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
private set ProtectedPrivate(v) { return; }
~~~~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

private get PrivatePublic() { return 0; }
~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
~~~~~~~~~~~~~
!!! error TS2798: A get accessor must be at least as accessible as the setter
set PrivatePublic(v) { return; }
~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
~~~~~~~~~~~~~
!!! error TS2798: A get accessor must be at least as accessible as the setter

private get PrivateProtected() { return 0; }
~~~~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
~~~~~~~~~~~~~~~~
!!! error TS2798: A get accessor must be at least as accessible as the setter
protected set PrivateProtected(v) { return; }
~~~~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
~~~~~~~~~~~~~~~~
!!! error TS2798: A get accessor must be at least as accessible as the setter

private get PrivatePrivate() { return 0; }
~~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
private set PrivatePrivate(v) { return; }
~~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

test() {
this.PublicPublic = 0;
Expand Down
109 changes: 25 additions & 84 deletions tests/baselines/reference/divergentAccessorsVisibility1.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,79 +160,26 @@ function fn() {

//// [divergentAccessorsVisibility1.js]
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var Base = /** @class */ (function () {
function Base() {
}
Object.defineProperty(Base.prototype, "PublicPublic", {
get: function () { return 0; },
set: function (v) { return; },
enumerable: false,
configurable: true
});
Object.defineProperty(Base.prototype, "PublicProtected", {
get: function () { return 0; },
set: function (v) { return; },
enumerable: false,
configurable: true
});
Object.defineProperty(Base.prototype, "PublicPrivate", {
get: function () { return 0; },
set: function (v) { return; },
enumerable: false,
configurable: true
});
Object.defineProperty(Base.prototype, "ProtectedPublic", {
get: function () { return 0; },
set: function (v) { return; },
enumerable: false,
configurable: true
});
Object.defineProperty(Base.prototype, "ProtectedProtected", {
get: function () { return 0; },
set: function (v) { return; },
enumerable: false,
configurable: true
});
Object.defineProperty(Base.prototype, "ProtectedPrivate", {
get: function () { return 0; },
set: function (v) { return; },
enumerable: false,
configurable: true
});
Object.defineProperty(Base.prototype, "PrivatePublic", {
get: function () { return 0; },
set: function (v) { return; },
enumerable: false,
configurable: true
});
Object.defineProperty(Base.prototype, "PrivateProtected", {
get: function () { return 0; },
set: function (v) { return; },
enumerable: false,
configurable: true
});
Object.defineProperty(Base.prototype, "PrivatePrivate", {
get: function () { return 0; },
set: function (v) { return; },
enumerable: false,
configurable: true
});
Base.prototype.test = function () {
class Base {
get PublicPublic() { return 0; }
set PublicPublic(v) { return; }
get PublicProtected() { return 0; }
set PublicProtected(v) { return; }
get PublicPrivate() { return 0; }
set PublicPrivate(v) { return; }
get ProtectedPublic() { return 0; }
set ProtectedPublic(v) { return; }
get ProtectedProtected() { return 0; }
set ProtectedProtected(v) { return; }
get ProtectedPrivate() { return 0; }
set ProtectedPrivate(v) { return; }
get PrivatePublic() { return 0; }
set PrivatePublic(v) { return; }
get PrivateProtected() { return 0; }
set PrivateProtected(v) { return; }
get PrivatePrivate() { return 0; }
set PrivatePrivate(v) { return; }
test() {
this.PublicPublic = 0;
this.PublicProtected = 0;
this.PublicPrivate = 0;
Expand Down Expand Up @@ -260,15 +207,10 @@ var Base = /** @class */ (function () {
this.PrivatePublic += 0;
this.PrivateProtected += 0;
this.PrivatePrivate += 0;
};
return Base;
}());
var Derived = /** @class */ (function (_super) {
__extends(Derived, _super);
function Derived() {
return _super !== null && _super.apply(this, arguments) || this;
}
Derived.prototype.test2 = function () {
}
class Derived extends Base {
test2() {
this.PublicPublic = 0;
this.PublicProtected = 0;
this.PublicPrivate = 0;
Expand Down Expand Up @@ -296,9 +238,8 @@ var Derived = /** @class */ (function (_super) {
this.PrivatePublic += 0;
this.PrivateProtected += 0;
this.PrivatePrivate += 0;
};
return Derived;
}(Base));
}
}
function fn() {
base.PublicPublic = 0;
base.PublicProtected = 0;
Expand Down
Loading

0 comments on commit d2affa2

Please sign in to comment.