You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2022/12/12 23:53:45 UTC

[royale-compiler] 03/03: Tests: null conditional with dynamic access should result in compiler error

This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 5f1c0f9657d0a7b5f738c1af8e7ff6e6081325bb
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon Dec 12 15:53:19 2022 -0800

    Tests: null conditional with dynamic access should result in compiler error
---
 .../src/test/java/as/ASNullConditionalOperatorTests.java  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/compiler/src/test/java/as/ASNullConditionalOperatorTests.java b/compiler/src/test/java/as/ASNullConditionalOperatorTests.java
index ed045b524..96998209e 100644
--- a/compiler/src/test/java/as/ASNullConditionalOperatorTests.java
+++ b/compiler/src/test/java/as/ASNullConditionalOperatorTests.java
@@ -184,4 +184,19 @@ public class ASNullConditionalOperatorTests extends ASFeatureTestsBase
 
         compileAndRun(source);
     }
+
+	@Test
+    public void testNullConditionalArrayAccess()
+    {
+        String[] testCode = new String[]
+        {
+            "var o:Object = {};",
+			"var result:* = o?.a?.[0];",
+        };
+        String source = getAS(new String[0], new String[0], testCode, new String[0]);
+
+        compileAndExpectErrors(source, false, false, false, new String[0], "'[' is not allowed here\n");
+    }
+
+
 }
\ No newline at end of file