Add tests to NormalizeTest to show that normalization does not occur when LHS is property reference for new logical assignment operators.
@@ -329,6 +329,22 @@ public final class NormalizeTest extends CompilerTestCase {
test("x ??= 1;", "x ?? (x = 1);");
}
+ @Test
+ public void testLogicalAssignPropertyReferenceShorthand() {
+ // When the LHS is getprop, normalization does not occur
+ test("x.a ||= 1;", "x.a ||= 1;");
+ test("x.a &&= 1;", "x.a &&= 1;");
+ test("x.a ??= 1;", "x.a ??= 1;");
+ }
+
+ @Test
+ public void testLogicalAssignPropertyReferenceElementShorthand() {
+ // When the LHS is getelem, normalization does not occur
+ test("x[a] ||= 1;", "x[a] ||= 1;");
+ test("x[a] &&= 1;", "x[a] &&= 1;");
+ test("x[a] ??= 1;", "x[a] ??= 1;");
+ }
+
@Test
public void testDuplicateVarInExterns() {
test(
