Skip to content

Commit bc9138d

Browse files
lauraharkercopybara-github
authored andcommitted
Add test for ambiguation of related prototype & instance props
This case seems to work correctly but is not covered in AmbiguatePropertiesTest. PiperOrigin-RevId: 322079970
1 parent 76afa8e commit bc9138d

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

test/com/google/javascript/jscomp/AmbiguatePropertiesTest.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,48 @@ public void testGenericPrototypeObject() {
12491249
test(js, output);
12501250
}
12511251

1252+
@Test
1253+
public void testRelatedInstanceAndPrototypePropNotAmbiguated() {
1254+
test(
1255+
lines(
1256+
"class Foo {", //
1257+
" constructor() {",
1258+
" this.y = 0;",
1259+
" }",
1260+
" x() {}",
1261+
"}"),
1262+
lines(
1263+
"class Foo {", //
1264+
" constructor() {",
1265+
" this.b = 0;",
1266+
" }",
1267+
" a() {}",
1268+
"}"));
1269+
}
1270+
1271+
@Test
1272+
public void testRelatedInstanceAndSuperclassPrototypePropNotAmbiguated() {
1273+
test(
1274+
lines(
1275+
"class Foo {", //
1276+
" x() {}",
1277+
"}",
1278+
"class Bar extends Foo {",
1279+
" constructor() {",
1280+
" this.y = 0;",
1281+
" }",
1282+
"}"),
1283+
lines(
1284+
"class Foo {", //
1285+
" a() {}",
1286+
"}",
1287+
"class Bar extends Foo {",
1288+
" constructor() {",
1289+
" this.b = 0;",
1290+
" }",
1291+
"}"));
1292+
}
1293+
12521294
@Test
12531295
public void testPropertiesWithTypesThatHaveBeenNarrowed() {
12541296
String js = lines(

0 commit comments

Comments
 (0)