Skip to content

Commit a27091b

Browse files
authored
fix(2015): abstract property created, overshadowing override (#2016)
1 parent 0c8895b commit a27091b

File tree

59 files changed

+15
-312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+15
-312
lines changed

internal/transformers/tstransforms/typeeraser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (tx *TypeEraserTransformer) visit(node *ast.Node) *ast.Node {
121121
return tx.Factory().UpdateExpressionWithTypeArguments(n, tx.Visitor().VisitNode(n.Expression), nil)
122122

123123
case ast.KindPropertyDeclaration:
124-
if ast.HasSyntacticModifier(node, ast.ModifierFlagsAmbient) {
124+
if ast.HasSyntacticModifier(node, ast.ModifierFlagsAmbient|ast.ModifierFlagsAbstract) {
125125
// TypeScript `declare` fields are elided
126126
return nil
127127
}

testdata/baselines/reference/submodule/compiler/abstractPropertyBasics.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ class C extends B {
2525

2626
//// [abstractPropertyBasics.js]
2727
class B {
28-
prop;
29-
raw;
30-
ro;
3128
}
3229
class C extends B {
3330
get prop() { return "foo"; }

testdata/baselines/reference/submodule/compiler/abstractPropertyBasics.js.diff

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
--- old.abstractPropertyBasics.js
22
+++ new.abstractPropertyBasics.js
3-
@@= skipped -24, +24 lines =@@
4-
5-
//// [abstractPropertyBasics.js]
3+
@@= skipped -26, +26 lines =@@
64
class B {
7-
+ prop;
8-
+ raw;
9-
+ ro;
105
}
116
class C extends B {
127
- constructor() {

testdata/baselines/reference/submodule/compiler/abstractPropertyInConstructor.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ class AbstractClass {
111111
// OK, references are to another instance
112112
other.cb(other.prop);
113113
}
114-
prop;
115-
cb;
116114
other = this.prop;
117115
fn = () => this.prop;
118116
method2() {
@@ -151,8 +149,6 @@ class User {
151149
}
152150
}
153151
class C1 {
154-
x;
155-
y;
156152
constructor() {
157153
let self = this; // ok
158154
let { x, y: y1 } = this; // error

testdata/baselines/reference/submodule/compiler/abstractPropertyInConstructor.js.diff

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
// OK, references are to another instance
1414
other.cb(other.prop);
1515
}
16-
+ prop;
17-
+ cb;
1816
+ other = this.prop;
1917
+ fn = () => this.prop;
2018
method2() {
@@ -29,7 +27,7 @@
2927
// there is no implementation of 'prop' in any base class
3028
this.cb(this.prop.toLowerCase());
3129
this.method(1);
32-
@@= skipped -17, +21 lines =@@
30+
@@= skipped -17, +19 lines =@@
3331
}
3432
}
3533
class Implementation extends DerivedAbstractClass {
@@ -42,16 +40,7 @@
4240
this.cb(this.prop);
4341
}
4442
method(n) {
45-
@@= skipped -19, +19 lines =@@
46-
}
47-
}
48-
class C1 {
49-
+ x;
50-
+ y;
51-
constructor() {
52-
let self = this; // ok
53-
let { x, y: y1 } = this; // error
54-
@@= skipped -7, +9 lines =@@
43+
@@= skipped -26, +26 lines =@@
5544
}
5645
}
5746
class C2 {

testdata/baselines/reference/submodule/compiler/abstractPropertyNegative.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,13 @@ abstract class AbstractAccessorMismatch {
4747

4848
//// [abstractPropertyNegative.js]
4949
class B {
50-
prop;
51-
ro;
5250
}
5351
class C extends B {
5452
ro = "readonly please";
55-
notAllowed;
5653
}
5754
let c = new C();
5855
c.ro = "error: lhs of assignment can't be readonly";
5956
class WrongTypeProperty {
60-
num;
6157
}
6258
class WrongTypePropertyImpl extends WrongTypeProperty {
6359
num = "nope, wrong";

testdata/baselines/reference/submodule/compiler/abstractPropertyNegative.js.diff

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
--- old.abstractPropertyNegative.js
22
+++ new.abstractPropertyNegative.js
3-
@@= skipped -46, +46 lines =@@
4-
5-
//// [abstractPropertyNegative.js]
3+
@@= skipped -48, +48 lines =@@
64
class B {
7-
+ prop;
8-
+ ro;
95
}
106
class C extends B {
117
- constructor() {
@@ -14,12 +10,10 @@
1410
- }
1511
- get concreteWithNoBody() { }
1612
+ ro = "readonly please";
17-
+ notAllowed;
1813
}
1914
let c = new C();
2015
c.ro = "error: lhs of assignment can't be readonly";
2116
class WrongTypeProperty {
22-
+ num;
2317
}
2418
class WrongTypePropertyImpl extends WrongTypeProperty {
2519
- constructor() {
@@ -30,7 +24,7 @@
3024
}
3125
class WrongTypeAccessor {
3226
}
33-
@@= skipped -24, +21 lines =@@
27+
@@= skipped -22, +15 lines =@@
3428
get num() { return "nope, wrong"; }
3529
}
3630
class WrongTypeAccessorImpl2 extends WrongTypeAccessor {

testdata/baselines/reference/submodule/conformance/abstractProperty(target=es2015).js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class C extends A {
1919

2020
//// [abstractProperty.js]
2121
class A {
22-
x;
2322
foo() {
2423
console.log(this.x);
2524
}

testdata/baselines/reference/submodule/conformance/abstractProperty(target=es2015).js.diff

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
--- old.abstractProperty(target=es2015).js
22
+++ new.abstractProperty(target=es2015).js
3-
@@= skipped -18, +18 lines =@@
4-
5-
//// [abstractProperty.js]
6-
class A {
7-
+ x;
8-
foo() {
9-
console.log(this.x);
3+
@@= skipped -23, +23 lines =@@
104
}
115
}
126
class B extends A {

testdata/baselines/reference/submodule/conformance/abstractProperty(target=esnext).js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class C extends A {
1919

2020
//// [abstractProperty.js]
2121
class A {
22-
x;
2322
foo() {
2423
console.log(this.x);
2524
}

0 commit comments

Comments
 (0)