Ensure CheckConformance and CheckAccessControls passes work with new operators.
Check passes have to be updated to support the new syntax; these may include CheckConformance, CheckUnreachableCode, and CheckAccessControls
@@ -2926,6 +2926,22 @@ public final class CheckAccessControlsEs6ClassTest extends CompilerTestCase {
error(CONST_PROPERTY_REASSIGNED_VALUE));
}
+ @Test
+ public void testConstantProperty1aLogicalAssignment() {
+ test(
+ srcs(
+ lines(
+ "class A {",
+ " constructor() {",
+ " /** @const */",
+ " this.bar = null;",
+ "",
+ " this.bar ??= 4;",
+ " }",
+ "}")),
+ error(CONST_PROPERTY_REASSIGNED_VALUE));
+ }
+
@Test
public void testConstantPropertyReassigned_crossModuleWithCollidingNames() {
disableRewriteClosureCode();
@@ -2969,6 +2985,20 @@ public final class CheckAccessControlsEs6ClassTest extends CompilerTestCase {
"}")));
}
+ @Test
+ public void testConstantProperty_conventionNotEnforced1LogicalAssignment() {
+ test(
+ srcs(
+ lines(
+ "class A {",
+ " constructor() {",
+ " this.BAR = null;",
+ "",
+ " this.BAR ??= 4;",
+ " }",
+ "}")));
+ }
+
@Test
public void testConstantProperty2() {
test(
