diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_BooleanLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_BooleanLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..095245879e546d47e83684cee7f75801acd93299 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_BooleanLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + */ + +let num = 153n; +let bool = false; + +console.info('bool: ' + bool + ' num: ' + num); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_MultilineStringLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_MultilineStringLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..27c209ee3c0fdb414e92b653f0442e1cb9f7e6d4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_MultilineStringLiteral.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + */ + +let mulStr = `This is a +multi-line string literal.`; +let num = 153n; + +let result = num + mulStr; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_NullLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_NullLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..eeede2c59f1cd613e9a18b6196a92b449bd7320e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_NullLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + */ + +let n = null; +let num = 135n; + +console.info('n: ' + n + ' num: ' + num) diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_StringLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_StringLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..c026906e5fc391b4231eb10b66b3185e53e85536 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_StringLiteral.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter * '\'' + * ; + */ + +let num = 153n; +let str = "abc"; + +let result = num + str; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_UndefinedLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_UndefinedLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d6fab1fbf179cfbf2f60786c24f6655478380ea --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_UndefinedLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + */ + +let und = undefined; +let num = 153n; + +console.info('und: ' + und + ' num: ' + num) diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_additiveExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_additiveExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c370e0ea263ce4c5c6aa0fba5f60d81777100bc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_additiveExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.22 + * additiveExpression: + * expression '+' expression + * | expression '-' expression + * ; + */ + +153n + 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..a60c1aeba45b9d2b092a6a86adf3c37a680b5d8e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayLiteral.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let x5 = [153n, 2, 1_153n]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayType.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4f88b31a77d4d05f53aa9d2f68bc4535c22988e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 3.17.1 + * arrayType: + * type '[' ']' + * ; + */ + +let arr: bigint[] = [153n, 1_153n]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_assignmentExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..cd4699cd2704c16475306c18e677761ffab0c109 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_assignmentExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + */ + +let a = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_awaitExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_awaitExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..905b641ab0bb077d329af6dd8018f5462d36c4d0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_awaitExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 17.16.2 + * awaitExpression: + * 'await' expression + * ; + */ + +function foo(): Promise { + return new Promise((resolve, reject) => { + resolve(152n); + }); +} +const res = await foo(); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_bitwiseAndLogicalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_bitwiseAndLogicalExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..425f1beed024e41937f63822edb460fe3b53f477 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_bitwiseAndLogicalExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.26 + * bitwiseAndLogicalExpression: + * expression '&' expression + * | expression '^' expression + * | expression '|' expression + * ; + */ + +153n & 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_classInitializer.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec9e5bd2d316335bfde9c5b2d1f84761f2ca7865 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_classInitializer.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class ExampleClass1 { + static initialized = 153n; + static initializerBlock() { + if (ExampleClass1.initialized == 153n) { + ExampleClass1.initialized = 1_153n; + } + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalAndExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalAndExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..14e359bd7135449a735b30912162e304df78ee01 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalAndExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.27 + * conditionalAndExpression: + * expression '&&' expression + * ; + */ + +153n && 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..bbf42e0bef5a1d3f0325bbbdbf082982533b979f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.30 + * conditionalExpression: + * expression '?' expression ':' expression + * ; + */ + +(153n > 1_153n) ? 153n : 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalOrExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalOrExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..8cfa9ae23a1ee15a4a1e676de144b672bd0f43df --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalOrExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.28 + * conditionalOrExpression: + * expression '||' expression + * ; + */ + +153n || 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantDeclarations.ets new file mode 100644 index 0000000000000000000000000000000000000000..afc91b2902b2ae9e0bad2bb9f673b449defc1e71 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantDeclarations.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const c: bigint = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..cbaea8d452cb955c9bc2426d699c1503a079d539 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const a = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ensureNotNullishExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ensureNotNullishExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..2354acb95191c9395cc20d6a8302d08cd515c820 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ensureNotNullishExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.18 + * ensureNotNullishExpression: + * expression '!' + * ; + */ + +153n!; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_equalityExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_equalityExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..258aec4ebb5ccd55e571b8a54d4b79702482c0e5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_equalityExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.25 + * equalityExpression: + * expression ('==' | '===' | '!=' | '!==') expression + * ; + */ + +153n == 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_expression.ets new file mode 100644 index 0000000000000000000000000000000000000000..36a092d71522b6e6d4000782e594ad9ac3b30311 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_expression.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +const PI = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_fieldAccessExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..d8a6112f3a8f94b6786d89cd58fc45966a10a5d1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_fieldAccessExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person1 { + name: bigint = 153n; +} + +let person = new Person1(); +person.name = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_finallyClause.ets new file mode 100644 index 0000000000000000000000000000000000000000..a089e8b6aca83a7ae10a57a1b7c83c7d669f4954 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_finallyClause.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +function processOne() { + try { + } catch (error) { + } finally { + const res = 153n; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forOfStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forOfStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..57dab166e32c8613f80ee019e03b9b2e5f3cec04 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forOfStatement.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.9 + * forOfStatement: + * 'for' '(' forVariable 'of' expression ')' statement + * ; + */ + +let arr = [150n, 151n, 153n]; +let item: bigint = 153n; +for (item of arr) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..d44119feace45adc9566dddfeb44a2201b57158c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +let i: bigint = 153n; +for (; i < 155n; i++) { + if (true) { + break; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_functionCallExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..feab7ed5dbe0b5fc26ae091f5b08a303be4a2781 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_functionCallExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ('?.' | typeArguments)? arguments block? + * ; + */ + +function func1(x: bigint): number { + return 0; +} + +func1(153n); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ifStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..83556b87d67875f99eb77d3ea064cd2f4b1a91af --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ifStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if (153n) { + console.log(153n); +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_indexingExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..57aa2ea8970343ff06527bb34d06304cb5563ee4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_indexingExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +let numbers = [153n, 2, 1_153n, 4, 5]; +numbers[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_initializerBlock.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_initializerBlock.ets new file mode 100644 index 0000000000000000000000000000000000000000..86933629d728576ce7ed71c94ecb19bdb4eee016 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_initializerBlock.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 15.10 + * initializerBlock: + * 'static' block + * ; + */ + +class Test { + static initializerBlock() { + let sum = 153n + 1_153n ; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_instanceOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_instanceOfExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..77418ac85f2c4313109df0598674d280cf611be1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_instanceOfExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.16 + * instanceOfExpression: + * expression 'instanceof' type + * ; + */ + +153n instanceof bigint; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_interfaceDefaultMethodDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_interfaceDefaultMethodDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..6b7c619e152ef936696a127545b6b2c4c18b7310 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_interfaceDefaultMethodDeclaration.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 17.11 + * interfaceDefaultMethodDeclaration: + * 'private'? identifier signature block + * ; + */ + +interface DefaultInterface { + defaultMethod(): bigint { + return 153n; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..443a5fc85c10267d7f29abf06713ba74127d9445 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +let result = async (x: bigint, y: number, z?: number): Promise => { + return 153n; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000000000000000000000000000000000..3d7ea5906d81afa5575ddef4f38124a55cb9c3a4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpressionWithReceiver.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result4 = (this: A): bigint => { return 153n; }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_loopStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..dfcd4b2ac99e679305d3647796f7cc08706a1b60 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_loopStatement.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while(153n) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_methodCallExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..af2a7dfc3a0fc476f38c4b1e1bcc13e099a1e0ce --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_methodCallExpression.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class Person2 { + name: bigint = 153n; + setName(name: bigint): void { + this.name = name; + } +} + +let person = new Person2(); +person.setName(153n); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_multiplicativeExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_multiplicativeExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..4f8f340c1e4d8773188b46204c7774aca44da943 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_multiplicativeExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.21 + * multiplicativeExpression: + * expression '*' expression + * | expression '/' expression + * | expression '%' expressionc + * ; + */ + +153n * 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_namespaceDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..55137a3b1dad6d86a4a6da1b9ffbb13831417196 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_namespaceDeclaration.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace NS1 { + let a: bigint = 135n; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newArrayInstance.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newArrayInstance.ets new file mode 100644 index 0000000000000000000000000000000000000000..964f3b384b397341c75a656dbb6e8563c344fc05 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newArrayInstance.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 17.3 + * newArrayInstance: + * 'new' arrayElementType dimensionExpression+ (arrayElement)? + * ; + */ + +let a = new bigint[1]; +a[0] = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..0b79e7e90aca0f60a24b4bb6f71a490a2a19d0d2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class D { + constructor(p: bigint) {} +} + +new D(153n); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_nullishCoalescingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_nullishCoalescingExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..a040ddc1f2c6f6f1a13c2407ab20c415000e58a9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_nullishCoalescingExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.19 + * nullishCoalescingExpression: + * expression '??' expression + * ; + */ + +153n ?? 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..8a56cfe09ff2e2497a57672d26d2532193c041a5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + name: string = "NAME"; + age: bigint = 153n; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectReference.ets new file mode 100644 index 0000000000000000000000000000000000000000..db938c363af24825e7b6790fb95d5c857b30a96a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectReference.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +let a: bigint = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_optionalParameter.ets new file mode 100644 index 0000000000000000000000000000000000000000..18b8f28edf535e70b9b0d6c0f77d4289d489ee3d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_optionalParameter.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier '?' ':' type + * ; + */ + +function pair(x: number, y: bigint = 153n) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parameterList.ets new file mode 100644 index 0000000000000000000000000000000000000000..98fc7892cc5776f97416c81e3148be8f03c299b9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parameterList.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function func1(y: string, x: bigint = 153n): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parenthesizedExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..c46e462f68ae0159719b71797d7489e62f2f5fdd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parenthesizedExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +let y6 = (153n); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_recordLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_recordLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..05582cc678c93b1e8d69231e69702a5d032a0bc5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_recordLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.5.3 + * recordLiteral: + * '{' keyValueSequence? '}' + * ; + */ + +let map: Record = { + "John": 153n, + "Mary": 153n, +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_relationalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_relationalExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..d41288877a47cf84640dcd25ea8995b0a52086ba --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_relationalExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.24 + * relationalExpression: + * expression '<' expression + * | expression '>' expression + * | expression '<=' expression + * | expression '>=' expression + * ; + */ + +153n < 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_restParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_restParameter.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d3081be67601e3a6a3532ed1755f594fab0fa91 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_restParameter.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 4.8.5 + * restParameter: + * annotationUsage? '...' identifier ':' type + * ; + */ + +function sum(...bigints: bigint[]): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_returnStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..10446fa22e51d0703ace8f3b9d5a9c7b77a29bc0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_returnStatement.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add() { + return 135n + 134n; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_separateModuleDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..10d9107b67c064787a616e4933942c58014d23e3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_separateModuleDeclaration.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +let a: bigint = 165n; +console.info('a: ' + a); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_shiftExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_shiftExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..51585d09f9751413b08ddcb201df6335fb6a8239 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_shiftExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.23 + * shiftExpression: + * expression '<<' expression + * | expression '>>' expression + * | expression '>>>' expression + * ; + */ + +153n << 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_signature.ets new file mode 100644 index 0000000000000000000000000000000000000000..77748b7e40c7b6100bd58a14edfb0dc49420d610 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_signature.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function func1(x: bigint = 153n): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_spreadExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ea5b61eadb669ca582fc48686f57942add9c88c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_spreadExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + *Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let array1 = [1, 2, 1_153n]; +let array2 = [153n, 5]; +let array3 = [...array1, ...array2]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_statement.ets new file mode 100644 index 0000000000000000000000000000000000000000..a21e3bc408b0ea94f504abe9d64d7886ba47d4d8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_statement.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throw Statement + * | tryStatement + * ; + */ + +let x = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_stringInterpolation.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_stringInterpolation.ets new file mode 100644 index 0000000000000000000000000000000000000000..59631d72b49c7083b2bbe0ae1dc092ac9072d392 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_stringInterpolation.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.31 + * stringInterpolation: + * ' ` ' (BacktickCharacter | embeddedExpression)* ' ` ' + * ; + */ + +let name = 153n; +`Hello, my name is ${name}.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_thisExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c1d209efc01af2de4a373e0f5d003a550616623 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_thisExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class ThisExample { + public field: bigint; + constructor() { + this.field = 153n; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_throwStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_throwStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..a6f16f20d5d058ec7d1f1769119dcec1081b9a71 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_throwStatement.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.14 + * throwStatement: + * 'throw' expression + * ; + */ + +throw new Error("error" + 153n); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..209a94d46234477402bbab45c30be47d96fac3c6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topDeclaration.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +export let x: bigint = 153n, y: bigint = 154n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topLevelStatements.ets new file mode 100644 index 0000000000000000000000000000000000000000..db01b271e3751108c874050ec9a39d6d4ce6ee6c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topLevelStatements.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement * + * ; + */ + +let a: bigint = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_trailingLambdaCall.ets new file mode 100644 index 0000000000000000000000000000000000000000..cc7d4c4643533d490a28eb16b83c3c5d0224c214 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_trailingLambdaCall.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + methodTwo(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.methodTwo(153n) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tryStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..748798e1c81e5408e66d6952ad6aaf76104d85ad --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tryStatement.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processOne(): bigint { + try { + const res = 153n; + return res; + } catch (error) { + return -1n; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tupleType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tupleType.ets new file mode 100644 index 0000000000000000000000000000000000000000..e8a46773ef5797dce8809877026b0bfe4f525791 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tupleType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + */ + +let tup: [bigint, number, boolean, number] = [153n, 1, true, 10]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeOfExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..69f77080b56e4581ed1a508994226f59c25ea0c1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeOfExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let s: bigint = 153n; +typeof s; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeParameters.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeParameters.ets new file mode 100644 index 0000000000000000000000000000000000000000..23b7db29862ccd87d495765e9271e27a8b55097a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeParameters.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 5.1 + * typeParameters: + * '<' typeParameterList '>' + * ; + */ + +class C1 { + public a: bigint = 153n; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unaryExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unaryExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..1afcb3bb27dfa7220b7ca2462c904bbb3adc97a5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unaryExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.20 + * unaryExpression: + * expression '++' + * | expression '--' + * | '++' expression + * | '--' expression + * | '+' expression + * | '-' expression + * | '~' expression + * | '!' expression + * ; + */ + +!153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unionType.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d349fe8c5e6432ce4abf73bc3040a3fe0085499 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unionType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let u: string | bigint = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_variableDeclarations.ets new file mode 100644 index 0000000000000000000000000000000000000000..2b580a891145598f75829d0e17ddc201efb4d130 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_variableDeclarations.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let v: bigint = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_whileStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..221dce6e0c8f478e414ebcf3976026c6ab1c719a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_whileStatement.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +let m = 153n; +let n = 155n; +while(m < n) { + m--; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_MultilineStringLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_MultilineStringLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..7bf73f082918c1ab64bf2d6a6643757694f9a17a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_MultilineStringLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + */ + +let mulStr = `This is a +multi-line string literal.`; +let bool = true; + +let result = bool + mulStr; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_NullLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_NullLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..244395103cde0e8c74530ac75e8e91df295c3af8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_NullLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + */ + +let n = null; +let bool = true; + +console.info('n: ' + n + ' bool: ' + bool); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_StringLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_StringLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..48b4863f33077b4703b06df761278b5ac2087a20 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_StringLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter * '\'' + * ; + */ + +let bool = true; +let str = "abc"; + +let result = bool + str; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_UndefinedLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_UndefinedLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..6d834f4c8f51bacd9b600dbc478925ce60226676 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_UndefinedLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + */ + +let und = undefined; +let bool = true; + +console.info('und: ' + und + ' bool: ' + bool); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..8f0895c87e8e0e2fb1785f3b8164c84e6917f357 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationDeclaration.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 18.1 + * annotationDeclaration: + * '@interface' identifier '{' annotationField* '}' + * ; + */ + +@interface A { + value: boolean = true; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationUsage.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationUsage.ets new file mode 100644 index 0000000000000000000000000000000000000000..577f3b40a9d5a263fdfe7f52bac75075b3668a45 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationUsage.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 18.2 + * annotationUsage: + * 'at' qualifiedName annotationValues? + * ; + */ + +@interface DetailedAnnotation { + authorName: boolean; + creationDate: string; +} +@DetailedAnnotation({ + authorName: true, + creationDate: "2025-03-19" +}) +class DocumentedClass {}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..29204f295187de3addd1ff3c9e63b343dd072f61 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayLiteral.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let x5 = [true, false, true]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayType.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ad0a735e26385da6708fbee65b6de819add0755 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 3.17.1 + * arrayType: + * type '[' ']' + * ; + */ + +let arr: boolean[] = [true, false]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_assignmentExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..a511c6f844cab4f4393ae3fecde1fa285304fa0a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_assignmentExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + */ + +let a = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_awaitExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_awaitExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..d3156019eef1bc1edad419d395e219befa317405 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_awaitExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 17.16.2 + * awaitExpression: + * 'await' expression + * ; + */ + +function foo(): Promise { + return new Promise((resolve, reject) => { + resolve(true); + }); +} +const res = await foo(); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_bitwiseAndLogicalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_bitwiseAndLogicalExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..8dbcaf242765f7039aa589d0646c3dc3e97a01bd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_bitwiseAndLogicalExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.26 + * bitwiseAndLogicalExpression: + * expression '&' expression + * | expression '^' expression + * | expression '|' expression + * ; + */ + +true & true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_classInitializer.ets new file mode 100644 index 0000000000000000000000000000000000000000..75a282632b2cadffed403611badafe84561650ff --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_classInitializer.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class ExampleClass1 { + static initialized = false; + static initializerBlock() { + if (!ExampleClass1.initialized) { + ExampleClass1.initialized = true; + } + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalAndExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalAndExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..e3f3a2854039fdd881fa649d5730dd0adb0227a1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalAndExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.27 + * conditionalAndExpression: + * expression '&&' expression + * ; + */ + +true && true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..7419cee8b78877e879949509d2e6fb99f3c05a5c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.30 + * conditionalExpression: + * expression '?' expression ':' expression + * ; + */ + +true ? false : true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalOrExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalOrExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..fe2b76b8384f615c15e803d0641269c527244953 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalOrExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.28 + * conditionalOrExpression: + * expression '||' expression + * ; + */ + +true || false; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantDeclarations.ets new file mode 100644 index 0000000000000000000000000000000000000000..0ae2f514dd48c83d138c985780d1e73f9f8b6b07 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantDeclarations.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const c: boolean = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..97fd925d8945cfbb7be43b5bdad844f9ab578d26 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const a = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ensureNotNullishExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ensureNotNullishExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..7af9008c1e5a685a6392fb40c5122fca5b097d1c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ensureNotNullishExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.18 + * ensureNotNullishExpression: + * expression '!' + * ; + */ + +true!; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_equalityExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_equalityExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..93affe9d9b677c07a2f0ebcc83032fe7a9cce8d6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_equalityExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.25 + * equalityExpression: + * expression ('==' | '===' | '!=' | '!==') expression + * ; + */ + +true == true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_expression.ets new file mode 100644 index 0000000000000000000000000000000000000000..6ecffed9c48d13027418441cc4c8f814f29a28f5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_expression.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +const a = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_fieldAccessExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..bcd925ef5b9ab5147f406fcf6d13d72ef0c8cde1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_fieldAccessExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person1 { + name: boolean = true; +} + +let person = new Person1(); +person.name = false; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_finallyClause.ets new file mode 100644 index 0000000000000000000000000000000000000000..9979996f3d19292ea15c20e90a8113f3ebd3d3a0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_finallyClause.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +function processOne() { + try { + } catch (error) { + } finally { + const res = true; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forOfStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forOfStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..a3daf4f7ceced289168c318cebdd863206739a43 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forOfStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.9 + * forOfStatement: + * 'for' '(' forVariable 'of' expression ')' statement + * ; + */ + +let arr = [true, false, true]; +let item: boolean = true; +for (item of arr) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e2493f41d846fc0699926a55d2d94927ce83aa0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forStatement.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +let a: boolean = true; +for (let i = 1; (i < 10 && a); i++) { + if (true) { + break; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_functionCallExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..98ec9289dc191a4f933343dcf200209055b1b99e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_functionCallExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ('?.' | typeArguments)? arguments block? + * ; + */ + +function func1(x: boolean): number { + return 0; +} + +func1(true); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ifStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..fcb569488544f8f1c5f299ad523f27a2973797ad --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ifStatement.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if (true) { + console.log(true); +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_indexingExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e85ac62c1cd51d3e7defa0747635a969aaf5ece --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_indexingExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +let s = [true, 2, true, 4, false]; +s[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_initializerBlock.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_initializerBlock.ets new file mode 100644 index 0000000000000000000000000000000000000000..3cceb2eb46b5df0842690c54ffc9303b43e57433 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_initializerBlock.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 15.10 + * initializerBlock: + * 'static' block + * ; + */ + +class Test { + static initializerBlock() { + let a = true ; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_interfaceDefaultMethodDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_interfaceDefaultMethodDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..d338e21ab875c7727bb8099dce68927211a5cafa --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_interfaceDefaultMethodDeclaration.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 17.11 + * interfaceDefaultMethodDeclaration: + * 'private'? identifier signature block + * ; + */ + +interface DefaultInterface { + defaultMethod(): boolean { + return true; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..57c79a6e13587abc88d200dadcf3c895e689f369 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +let result = async (x: boolean, y: number, z?: number): Promise => { + return true; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000000000000000000000000000000000..859663f51784ee049ea1de41559cb63304e3581b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpressionWithReceiver.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result4 = (this: A): boolean => { return true; }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_loopStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..20f551a16144c9a997e65df4389ee8306ca95972 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_loopStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while(true) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_methodCallExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..b42732ac06dd3e8215bb2b208762a0d28107ef6d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_methodCallExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class Person2 { + name: boolean = true; + setName(name: boolean): void { + this.name = name; + } +} + +let person = new Person2(); +person.setName(true); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_namespaceDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..8f08fff6014f85af583da9d6d0ad093f896abb20 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_namespaceDeclaration.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace NS1 { + let a: boolean = true; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newArrayInstance.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newArrayInstance.ets new file mode 100644 index 0000000000000000000000000000000000000000..022a24b1b8b44e3bec868c2fdbbce2bb8cc268f0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newArrayInstance.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 17.3 + * newArrayInstance: + * 'new' arrayElementType dimensionExpression+ (arrayElement)? + * ; + */ + +let a = new boolean[1]; +a[0] = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..22c621fff072c0fd61c4f2d55afd57de9a943c56 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class D { + constructor(p: boolean) {} +} + +new D(false); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_nullishCoalescingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_nullishCoalescingExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad1e3c1ed033b278cdc8130e236a8602244fadac --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_nullishCoalescingExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.19 + * nullishCoalescingExpression: + * expression '??' expression + * ; + */ + +null ?? true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..9fc2057b24fb6b9657e5e758c0e6a723efdf5fbe --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + name: string = "NAME"; + age: boolean = true; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectReference.ets new file mode 100644 index 0000000000000000000000000000000000000000..af14535ff0be139abc4e701476222552b3eda916 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectReference.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +let a: boolean = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_optionalParameter.ets new file mode 100644 index 0000000000000000000000000000000000000000..6651cc43e32c5b6a383a74180199efebea459660 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_optionalParameter.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier '?' ':' type + * ; + */ + +function pair(x: number, y: boolean = true) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parameterList.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ce92f07c870da669dfaf8f9ab8db5c7202dc8a7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parameterList.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function func1(y: string, x: boolean = true): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parenthesizedExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..f3891a1b28dc9e5a3a1df6d585e01f074e45dc8b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parenthesizedExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +let y6 = (true); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_recordLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_recordLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..7940ca33e7ec471bf37f63d8feaa5d55467b7c4a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_recordLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.5.3 + * recordLiteral: + * '{' keyValueSequence? '}' + * ; + */ + +let map: Record = { + "John": true, + "Mary": true, +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_relationalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_relationalExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..c6c421bb679cf6c2ca9a554dfa77e60ca752e514 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_relationalExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.24 + * relationalExpression: + * expression '<' expression + * | expression '>' expression + * | expression '<=' expression + * | expression '>=' expression + * ; + */ + +true < true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_restParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_restParameter.ets new file mode 100644 index 0000000000000000000000000000000000000000..bd3e59076f173af2ff2bd156493d3b3edf59ef1f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_restParameter.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 4.8.5 + * restParameter: + * annotationUsage? '...' identifier ':' type + * ; + */ + +function sum(...booleans: boolean[]): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_returnStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..021f63897aaaa41d0822231c923889695cd8b3e4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_returnStatement.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add(boolean1: boolean) { + return boolean1; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_separateModuleDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..158856ca296c9c347dc5ec1c5660ed288664ddab --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_separateModuleDeclaration.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +let a: boolean = true; +console.info('a: ' + a); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_signature.ets new file mode 100644 index 0000000000000000000000000000000000000000..7447a5def6f9c7809c5a8f6fce9b399a6d83ddd6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_signature.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function func1(x: number): boolean { + return true; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_spreadExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..81739226a66067ddc9c2d1016fc20a28b91fbef3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_spreadExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + *Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let array1 = [false, 2, true]; +let array2 = [4, true]; +let array3 = [...array1, ...array2]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_statement.ets new file mode 100644 index 0000000000000000000000000000000000000000..028c263cf7d3c1d19ac11b377c505d6096fd9142 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_statement.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throw Statement + * | tryStatement + * ; + */ + +let x = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_stringInterpolation.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_stringInterpolation.ets new file mode 100644 index 0000000000000000000000000000000000000000..7cb52f46859839fe94b2090101146d796c6a0775 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_stringInterpolation.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.31 + * stringInterpolation: + * ' ` ' (BacktickCharacter | embeddedExpression)* ' ` ' + * ; + */ + +let name = true; +`Hello, my name is ${name}.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_thisExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e0e7605e67cb69114803f562f45e8ed4b63417f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_thisExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class ThisExample { + public field: boolean; + constructor() { + this.field = true; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_throwStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_throwStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..f61895e130df2d77c983971f16289e0373f87381 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_throwStatement.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.14 + * throwStatement: + * 'throw' expression + * ; + */ + +throw new Error("boolean: " + true); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..c9e41d1945ecdf526ef47768be98ee38d7cd528a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topDeclaration.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +export let x: boolean = true, y: boolean = false; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topLevelStatements.ets new file mode 100644 index 0000000000000000000000000000000000000000..da22ffcd1dbc9b4ecb98aace57cbdc88bc384ba6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topLevelStatements.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement * + * ; + */ + +let a: boolean = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_trailingLambdaCall.ets new file mode 100644 index 0000000000000000000000000000000000000000..501b2f7f63520a596d6b0b72672dd48378ca632c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_trailingLambdaCall.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + methodTwo(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.methodTwo(true) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tryStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..6d00cbab8923264888dfc4ec47b81a6abff3b964 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tryStatement.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processOne(): boolean { + try { + const res = true; + return res; + } catch (error) { + return false; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tupleType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tupleType.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae1f2ea471d5f3521fd88f021f7a0d3725b547e3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tupleType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + */ + +let tup: [boolean, number, boolean, number] = [false, 1, true, 10]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeOfExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..0ddd5ce38a05f6e1fb8f4a600a7661d652c3a3a6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeOfExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let s: boolean = true; +typeof s; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeParameters.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeParameters.ets new file mode 100644 index 0000000000000000000000000000000000000000..22d578c0c7a4a1474980bb80c2ce450ec7ad7527 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeParameters.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 5.1 + * typeParameters: + * '<' typeParameterList '>' + * ; + */ + +class C1 { + public a: boolean = true; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unaryExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unaryExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..e4b48d70fd5e440845b2fff4a4d4690e7e270c07 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unaryExpression.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.20 + * unaryExpression: + * expression '++' + * | expression '--' + * | '++' expression + * | '--' expression + * | '+' expression + * | '-' expression + * | '~' expression + * | '!' expression + * ; + */ + +!true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unionType.ets new file mode 100644 index 0000000000000000000000000000000000000000..de9d71f44faea47d10320756fcffb622e937ca8c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unionType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let u: string | boolean = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_variableDeclarations.ets new file mode 100644 index 0000000000000000000000000000000000000000..ddfec5d01bbc1dc65fad0716469fcc344d1e7dc6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_variableDeclarations.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let v: boolean = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_whileStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..bc2f7a402cc2c4a9816f744b529c1eaad1fb0e12 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_whileStatement.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +let m = true; +while(m) { + m = false; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_NullLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_NullLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c93b8fd382eb9d4256bf4581eb54e9e2297304a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_NullLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + */ + +let n = null; +let mulStr = `This is a + multi-line string literal.`; + +let result = mulStr + n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_UndefinedLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_UndefinedLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e3d77039d230f2619525dee8dcc61d74114b023 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_UndefinedLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + */ + +let und = undefined; +let mulStr = `This is a + multi-line string literal.`; + +let result = mulStr + und; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_additiveExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_additiveExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..49438e40f15c83523b1fb1ea25c0f0ae11dd9b32 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_additiveExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.22 + * additiveExpression: + * expression '+' expression + * | expression '-' expression + * ; + */ + +`This is a + multi-line string literal.` + `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..26e1013f9dec28f67aae62148adcf9e5943cd8ee --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayLiteral.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let x5 = [1, 2, `This is a + multi-line string literal.`]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayType.ets new file mode 100644 index 0000000000000000000000000000000000000000..73401f96ab02024d59b2060ca94573c8974d4bdc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayType.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 3.17.1 + * arrayType: + * type '[' ']' + * ; + */ + +let arr: string[] = [`This is a + multi-line string literal.`, `This is a + multi-line string literal.`]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_assignmentExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..63c53003db738a1a400df714367128888e3627fc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_assignmentExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + */ + +let a = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_awaitExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_awaitExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..1490afe2549afcf773ab6f59fab0a7f666149a75 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_awaitExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 17.16.2 + * awaitExpression: + * 'await' expression + * ; + */ + +function foo(): Promise { + return new Promise((resolve, reject) => { + resolve(`This is a + multi-line string literal.`); + }); +} +const res = await foo(); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_classInitializer.ets new file mode 100644 index 0000000000000000000000000000000000000000..627d294eadf0806d25acdf48fa7757921d6a897a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_classInitializer.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class ExampleClass1 { + static initialized = `This is a + multi-line string literal.`; + static initializerBlock() { + if (ExampleClass1.initialized == `This is a + multi-line string literal.`) { + ExampleClass1.initialized = `This is a + multi-line string literal.`; + } + } +} + diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalAndExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalAndExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..c954407f2ae504b19a507eda218b9a3434f12b4c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalAndExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.27 + * conditionalAndExpression: + * expression '&&' expression + * ; + */ + +`This is a + multi-line string literal.` && `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..b7de23c8f80fc89733ea634764fb8bf343e1bfac --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.30 + * conditionalExpression: + * expression '?' expression ':' expression + * ; + */ + +(7 > 5) ? `This is a + multi-line string literal.` : 5; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalOrExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalOrExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..343a37deb0662262b426b1d46dbded8c3d495e4a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalOrExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.28 + * conditionalOrExpression: + * expression '||' expression + * ; + */ + +`This is a + multi-line string literal.` || `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantDeclarations.ets new file mode 100644 index 0000000000000000000000000000000000000000..06fd410223835cf798b957fe4dfc0ba60d82caaa --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantDeclarations.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const c: string = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..868ffd1f72e1a7ea4503fcb0489c825be60cf3d9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const a = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ensureNotNullishExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ensureNotNullishExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..128576b5623e0b6a4232e5ad06c5185d0357ae5b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ensureNotNullishExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.18 + * ensureNotNullishExpression: + * expression '!' + * ; + */ + +`This is a + multi-line string literal.`!; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_equalityExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_equalityExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..b30315c39b59b5924e3c2f1c1750b114e289a619 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_equalityExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.25 + * equalityExpression: + * expression ('==' | '===' | '!=' | '!==') expression + * ; + */ + +`This is a + multi-line string literal.` == `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_expression.ets new file mode 100644 index 0000000000000000000000000000000000000000..41358d0a9c6f98841d4a44b97ab79944e0f8e862 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_expression.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +const a = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_fieldAccessExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2ddbf1111e582bc331e709e3099bfbfde356585 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_fieldAccessExpression.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person1 { + name: string = `This is a + multi-line string literal.`; +} + +let person = new Person1(); +person.name = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_finallyClause.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c853bf808b8c134e31199e10d66cf3454803e68 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_finallyClause.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +function processOne() { + try { + } catch (error) { + } finally { + const res = `This is a + multi-line string literal.`; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forOfStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forOfStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..0828fbe7afbf98570230d566e31d0ef07dc37065 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forOfStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.9 + * forOfStatement: + * 'for' '(' forVariable 'of' expression ')' statement + * ; + */ + +let arr = ['1', '2', `This is a + multi-line string literal.`]; +let item: string = `This is a + multi-line string literal.`; +for (item of arr) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..61ce32a3e2ca0b2891286cbebc35c8bfd1a7abec --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +let a = `This is a + multi-line string literal.`; +for (let i = 0; i < a.length; i++) { + if (true) { + break; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_functionCallExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..cb13c774bd926fbc2d939f48f1bad5e1f24d9ac9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_functionCallExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ('?.' | typeArguments)? arguments block? + * ; + */ + +function func1(x: string): number { + return 0; +} + +func1(`This is a + multi-line string literal.`); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ifStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..c64d70691f2721b6334ba792fbefcfe0b89febab --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ifStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if (true) { + console.log(`This is a + multi-line string literal.`); +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_indexingExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..461d95f3b085acc7b0a380142be4a825a858b8f0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_indexingExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +let strings = [`This is a + multi-line string literal.`, '2', '3', '4', '5']; +strings[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_instanceOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_instanceOfExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..035c336e4225b5b2e3f70d22c9c0a89c3657907f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_instanceOfExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.16 + * instanceOfExpression: + * expression 'instanceof' type + * ; + */ + +`This is a + multi-line string literal.` instanceof string; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..e83231daecd15b827123463c8cac5353959900a8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +let result = async (): Promise => { + let a = `This is a + multi-line string literal.` + return a; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f9d2b1cc3ce5bce736d6bfddf967ecf6c8cf591 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpressionWithReceiver.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result4 = (this: A): string => { return `This is a + multi-line string literal.`; }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_loopStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..45df1e2c31bd289befc917061d2ddb15cdd9795d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_loopStatement.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while(`This is a + multi-line string literal.`) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_methodCallExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba9f67430546123e97a508672d33da5cece02db2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_methodCallExpression.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class Person2 { + name: string = `This is a + multi-line string literal.`; + setName(name: string): void { + this.name = name; + } +} + +let person = new Person2(); +person.setName(`This is a + multi-line string literal.`); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_namespaceDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..19bc85478c87b512c918f07667af15fe97780cde --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_namespaceDeclaration.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace NS1 { + let a: string = `This is a + multi-line string literal.`; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newArrayInstance.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newArrayInstance.ets new file mode 100644 index 0000000000000000000000000000000000000000..f141d90bebd6098e3bb60cb50a63e4af07f1604d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newArrayInstance.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 17.3 + * newArrayInstance: + * 'new' arrayElementType dimensionExpression+ (arrayElement)? + * ; + */ + +let a = new string[1]; +a[0] = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c15140da32ea0d71777f728f7337ad88612b6bc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class D { + constructor(p: string) {} +} + +new D(`This is a + multi-line string literal.`); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_nullishCoalescingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_nullishCoalescingExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..dc6b4b33d3b816c296a205d9ca4eca3cf083828f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_nullishCoalescingExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.19 + * nullishCoalescingExpression: + * expression '??' expression + * ; + */ + +`This is a + multi-line string literal.` ?? 42; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..d5523339951c93bab6087811411e2e874748558c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + name: string = `This is a + multi-line string literal.`; + age: number = 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectReference.ets new file mode 100644 index 0000000000000000000000000000000000000000..42d50a6bb2b8d86bcc4236a77836600f1e6abf33 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectReference.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +let a: string = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_optionalParameter.ets new file mode 100644 index 0000000000000000000000000000000000000000..6057ba6ee84f5f66364850471ae5027af86a32d3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_optionalParameter.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier '?' ':' type + * ; + */ + +function pair(x: number, y: string = `This is a + multi-line string literal.`) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parameterList.ets new file mode 100644 index 0000000000000000000000000000000000000000..e91f4aeacb93016cc187cbdb8575881f94c1b2d0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parameterList.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function func1(x: number, y: string = `This is a + multi-line string literal.`): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parenthesizedExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..d244f32122ea8114e3a60632efbbc7523d088a81 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parenthesizedExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +let y6 = (`This is a + multi-line string literal.`); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_relationalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_relationalExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..f825a5dbf0eba8502c892caa3ea5a672e084d2b9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_relationalExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.24 + * relationalExpression: + * expression '<' expression + * | expression '>' expression + * | expression '<=' expression + * | expression '>=' expression + * ; + */ + +`This is a + multi-line string literal.` < `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_restParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_restParameter.ets new file mode 100644 index 0000000000000000000000000000000000000000..fb01657f079361312dfe88c1257f1effdfbd3a0a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_restParameter.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 4.8.5 + * restParameter: + * annotationUsage? '...' identifier ':' type + * ; + */ + +function sum(...string: string[]): number { + return 0; +} + +let x: string[] = [`This is a + multi-line string literal.`, `This is a + multi-line string literal.`] +sum(...x); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_returnStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..a99a278349ea88a9f904a60d68f1c245230bba98 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_returnStatement.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add(string2: string, string1: string = `This is a + multi-line string literal.`) { + return string1 + string2; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_separateModuleDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..33b7db0970ba5bb26fbe816e9d1bf3bc75e0a1be --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_separateModuleDeclaration.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +console.log(`This is a + multi-line string literal.`); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_signature.ets new file mode 100644 index 0000000000000000000000000000000000000000..cb37f6b01cb575dda4e8c6d7874a3b6649153b23 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_signature.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function func1(x: string): string { + return `This is a + multi-line string literal.`; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_spreadExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..52af425dbcdcbbffe800da8514042a7ab2a24f15 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_spreadExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + *Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let array1 = [1, 2, `This is a + multi-line string literal.`]; +let array2 = [4, `This is a + multi-line string literal.`]; +let array3 = [...array1, ...array2]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_statement.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8699c0ffa61a272a974e58c7b75bdd25d54c244 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_statement.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throw Statement + * | tryStatement + * ; + */ + +let x = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_stringInterpolation.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_stringInterpolation.ets new file mode 100644 index 0000000000000000000000000000000000000000..ddf570866103ad1e0362200640d932160b865eb9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_stringInterpolation.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.31 + * stringInterpolation: + * ' ` ' (BacktickCharacter | embeddedExpression)* ' ` ' + * ; + */ + +let name = `This is a + multi-line string literal.`; +`Hello, my name is ${name}.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_switchStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_switchStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..cbc4466c243e9f6adce6ef245db7f7fd90b68c4d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_switchStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.13 + * switchStatement: + * (identifier ':')? 'switch' '(' expression ')' switchBlock + * ; + */ + +let name = `This is a + multi-line string literal.`; +switch (name) { + case '1': break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_thisExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..33867201431e1e6b68b0104bcaa02cb2b9aaa793 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_thisExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class ThisExample { + public field: string; + constructor() { + this.field = `This is a + multi-line string literal.`; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_throwStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_throwStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..87a8505994baf5dfc0757105cb48ff735944a29c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_throwStatement.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.14 + * throwStatement: + * 'throw' expression + * ; + */ + +throw new Error(`This is a + multi-line string literal.`); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..3f24e9531a36a34309caa5963c035fc2218da95f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topDeclaration.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +export const x: string = `This is a + multi-line string literal.` diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topLevelStatements.ets new file mode 100644 index 0000000000000000000000000000000000000000..35e3f602db8d182607105a779b59f4debda24e44 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topLevelStatements.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement * + * ; + */ + +let a: string = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_trailingLambdaCall.ets new file mode 100644 index 0000000000000000000000000000000000000000..faa9bc1b0d9c6522ecd95f08ef60e713cb08fce9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_trailingLambdaCall.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + methodTwo(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.methodTwo(`This is a + multi-line string literal.`) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tryStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..0a7282096e65a07fcc710f49a0bd21bf4fbaee7c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tryStatement.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processOne(): string { + try { + const res = `This is a + multi-line string literal.`; + return res; + } catch (error) { + return '-1'; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tupleType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tupleType.ets new file mode 100644 index 0000000000000000000000000000000000000000..9552322415cf1be33cf1a4afc6d04da685958459 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tupleType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + */ + +let tup: [string, number] = [`This is a + multi-line string literal.`, 1]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeOfExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..04907644f13a62d0e03b80ad6bae07755ce662d1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeOfExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let s: string = `This is a + multi-line string literal.`; +typeof s; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeParameters.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeParameters.ets new file mode 100644 index 0000000000000000000000000000000000000000..c90d316029402ffa949017325d3ce12b071148c2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeParameters.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 5.1 + * typeParameters: + * '<' typeParameterList '>' + * ; + */ + +class C1 { + public a: string = `This is a + multi-line string literal.`; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unaryExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unaryExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..901461ddee0a4f56b08d93fbebba59b8cda9ece9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unaryExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.20 + * unaryExpression: + * expression '++' + * | expression '--' + * | '++' expression + * | '--' expression + * | '+' expression + * | '-' expression + * | '~' expression + * | '!' expression + * ; + */ + +!`This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unionType.ets new file mode 100644 index 0000000000000000000000000000000000000000..5cc61857c2e93ebfb4ede78605b6f52abe39fe09 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unionType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let u: string | number = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_variableDeclarations.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a09d38e730ee8978b8afddea93f0501fd788d00 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_variableDeclarations.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let v: string = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_whileStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..a2f0094414d9f9f0ad326134ab92a9c79baa5e77 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_whileStatement.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +let m = `This is a + multi-line string literal.`; +while(m) { + m = `This is a + multi-line string literal.`; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..e9964b9551c7b02c64565827bf3d558415ef28f6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayLiteral.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let x5 = [undefined, 2, 3]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayType.ets new file mode 100644 index 0000000000000000000000000000000000000000..8010c34c704acaf079dbc4186a4152b1623a6178 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 3.17.1 + * arrayType: + * type '[' ']' + * ; + */ + +let arr: undefined[] = [undefined, undefined]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_assignmentExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..7300bf530bf2a4c8a61b5084f8fca52ca70090f7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_assignmentExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + */ + +let a = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_awaitExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_awaitExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d013ae9301b1f786580f7211994a4564b9575de --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_awaitExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 17.16.2 + * awaitExpression: + * 'await' expression + * ; + */ + +function foo(): Promise { + return new Promise((resolve, reject) => { + resolve(undefined); + }); +} +const res = await foo(); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_classInitializer.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad8a4b17e29092df27b126d0cfd9d416008b25d1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_classInitializer.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class ExampleClass1 { + static initialized = undefined; + static initializerBlock() { + if (ExampleClass1.initialized === undefined) { + ExampleClass1.initialized = undefined; + } + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalAndExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalAndExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..e884d027668b13745e89b5e7d60e3efa6b68cbcb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalAndExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.27 + * conditionalAndExpression: + * expression '&&' expression + * ; + */ + +undefined && undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..b41eefc6774bfaf3303135bf78062e7b8bc6a543 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.30 + * conditionalExpression: + * expression '?' expression ':' expression + * ; + */ + +(7 > 5) ? undefined : 5; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalOrExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalOrExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..93a4e5e9915f031fb2a2b84312be83d19cbe9376 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalOrExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.28 + * conditionalOrExpression: + * expression '||' expression + * ; + */ + +undefined || undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantDeclarations.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d9d3c0909a9cfbd5a88a5b9e908c180cda8c14b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantDeclarations.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const c: undefined = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..7609a15447719706b0fb1155b744b317b9844e21 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const s = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ensureNotNullishExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ensureNotNullishExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ee492284e4c0563a5f89752d465cbd8a7a7455c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ensureNotNullishExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.18 + * ensureNotNullishExpression: + * expression '!' + * ; + */ + +!undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_equalityExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_equalityExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2f62e113b2c0eaef60bbdae12048e50563b6380 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_equalityExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.25 + * equalityExpression: + * expression ('==' | '===' | '!=' | '!==') expression + * ; + */ + +undefined == undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_expression.ets new file mode 100644 index 0000000000000000000000000000000000000000..32abe8181e697df1d4cd8378418ca0cf41384040 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_expression.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +const a = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_fieldAccessExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..fc344a0fcbd0255600bb184eb82987c23f217efc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_fieldAccessExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person1 { + name: undefined = undefined; +} + +let person = new Person1(); +person.name = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_finallyClause.ets new file mode 100644 index 0000000000000000000000000000000000000000..12bde76599766d1a28c93f5534141b6d43660511 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_finallyClause.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +function processOne() { + try { + } catch (error) { + } finally { + const res = undefined; + } +} \ No newline at end of file diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forOfStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forOfStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..701db3735686e4e9825cf1989bb26f2435e93b0f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forOfStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.9 + * forOfStatement: + * 'for' '(' forVariable 'of' expression ')' statement + * ; + */ + +let arr = [undefined]; +let item: undefined = undefined; +for (item of arr) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..82ad097582b83370e7bdfcefb52ae59787e873f7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +let i: undefined = undefined; +for (; i != undefined; i = undefined) { + if (true) { + break; + } +} + diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionCallExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..507fcc307fa2d265f76ee96d948fa6cb18e53d91 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionCallExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ('?.' | typeArguments)? arguments block? + * ; + */ + +function func1(x: undefined): undefined { + return undefined; +} + +func1(undefined); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionType.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c2905e8fd47ce85b05c49d7bc1c457ad13359c6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionType.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 3.19 + * functionType: + * '(' ftParameterList? ')' ftReturnType + * ; + */ + +type t = undefined; + +type aaa = (action: t) => undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ifStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c4108d6dc988b89f916a4c7f5f428c36ef350f4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ifStatement.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if (true) { + console.log("undefined " + undefined); +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_indexingExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6edd75535ce51a4c628ad79d2f2cf8cd7c0f9b1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_indexingExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +let undef = [undefined, 2, undefined, 4, undefined]; +undef[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_initializerBlock.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_initializerBlock.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c0a176f99a09eee4a122dda5a358de1c382c47e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_initializerBlock.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 15.10 + * initializerBlock: + * 'static' block + * ; + */ + +class Test { + static initializerBlock() { + let undef = undefined; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_instanceOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_instanceOfExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..b7ed7b775cc1b940c1ed87dfaad1f72944f38e38 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_instanceOfExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.16 + * instanceOfExpression: + * expression 'instanceof' type + * ; + */ + +undefined instanceof undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e1eabb0de946014bb4366d649d7cde6e39af179 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +let result = async (x: undefined): Promise => { + return x; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000000000000000000000000000000000..8eca9b8da0298d36634ee521f267b0c860aea5eb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpressionWithReceiver.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result4 = (this: A): undefined => { return undefined; }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_loopStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..1cea29d06d067d3457621c1f8d3d71440ae5ede7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_loopStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while(undefined) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_methodCallExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..9b70db7d94172be9b7599e4fe65dee0bc9ea388f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_methodCallExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class Person2 { + name: undefined = undefined; + setName(name: undefined): void { + this.name = name; + } +} + +let person = new Person2(); +person.setName(undefined); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_namespaceDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..04b7990f79d0ebd1f3104326c7b55b99a598fad2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_namespaceDeclaration.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace NS1 { + let a: undefined = undefined; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_newExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..c8bfb036dd2084dd41a3b6cae518177029f5844d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_newExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class D { + constructor(p: undefined) {} +} + +new D(undefined); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_nullishCoalescingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_nullishCoalescingExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..0a15f639aeb0e3f328c5cf202e62db7c022a4d4f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_nullishCoalescingExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.19 + * nullishCoalescingExpression: + * expression '??' expression + * ; + */ + +undefined ?? 42; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..0cacf2ef4c1b7b50a5013554d485c9360cac3545 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + name: undefined = undefined; + age: undefined = undefined; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectReference.ets new file mode 100644 index 0000000000000000000000000000000000000000..79e637202f32e1d5d69854e5c1cf8492626e4ae4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectReference.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +let a: undefined = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_optionalParameter.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b9edced3785f5561eedee3f41dc5b5f4a010f44 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_optionalParameter.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier '?' ':' type + * ; + */ + +function pair(x: undefined, y: undefined = undefined) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parameterList.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d20e9d26b48874aad3bac51cd9a318c3da102cb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parameterList.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function func1(x: undefined, y: undefined): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parenthesizedExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..6db569893f2a477ee12ab449d10c66bd58a9513f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parenthesizedExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +let y6 = (undefined); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_restParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_restParameter.ets new file mode 100644 index 0000000000000000000000000000000000000000..3517e0b2e606d7c6ed2c95e8b275c6fd86baedc2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_restParameter.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 4.8.5 + * restParameter: + * annotationUsage? '...' identifier ':' type + * ; + */ + +function sum(...undefineds: undefined[]): undefined { + return undefined; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_returnStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca859e7c41a3a55b476015c16993287162a5fe63 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_returnStatement.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add(undef: undefined) { + return undef; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_separateModuleDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..663ba94d8cbc360dc783fa67d52a9d1b421d1f31 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_separateModuleDeclaration.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +console.log('undefined: ' + undefined) diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_signature.ets new file mode 100644 index 0000000000000000000000000000000000000000..7f62fae1b7ec4a92db189cd8e0fc704b279a871c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_signature.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function func1(x: undefined): undefined { + return undefined; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_spreadExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d93daf3e792bd6856831f43decfbd8b620d0391 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_spreadExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + *Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let array1 = [undefined, 2, 3]; +let array2 = [4, undefined]; +let array3 = [...array1, ...array2]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_statement.ets new file mode 100644 index 0000000000000000000000000000000000000000..a22d5208ff4b040dc8d60b4a96e2ddde065a21f6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_statement.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throw Statement + * | tryStatement + * ; + */ + +let x = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_stringInterpolation.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_stringInterpolation.ets new file mode 100644 index 0000000000000000000000000000000000000000..cd9ab19e40e5ec36e2832ec4580de9a93f29619d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_stringInterpolation.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.31 + * stringInterpolation: + * ' ` ' (BacktickCharacter | embeddedExpression)* ' ` ' + * ; + */ + +let name = undefined; +`Hello, my name is ${name}.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_thisExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..75cbc1a149eda01dc18a9884de93de8aaff94674 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_thisExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class ThisExample { + public field: undefined; + constructor() { + this.field = undefined; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_throwStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_throwStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..85bfeee3f1875366a5d464a77bc7db641e1cb79f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_throwStatement.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.14 + * throwStatement: + * 'throw' expression + * ; + */ + +let a = undefined; +throw new Error(`error ${a} ` + undefined); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..1768c3b87bb7479dc4dc88a87dfe3f6a46b5a526 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topDeclaration.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +export let x: undefined[], y: undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topLevelStatements.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f848144bbd7f7fc93e477bd735362fa8fdb81dc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topLevelStatements.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement * + * ; + */ + +let a: undefined = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_trailingLambdaCall.ets new file mode 100644 index 0000000000000000000000000000000000000000..c80dce42dd211043c09d3e128d2c25f11a8ee4b1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_trailingLambdaCall.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + methodTwo(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.methodTwo(undefined) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tryStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..9808b40fbd1098ae6b7e71654185082a2a1be24b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tryStatement.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processOne(a: undefined): undefined { + try { + const res = undefined; + return res; + } catch (error) { + return a; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tupleType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tupleType.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1da1fef04cb9f133a042d845eab4fc362033b7f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tupleType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + */ + +let tup: [undefined, boolean, number] = [undefined, true, 10]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeArguments.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeArguments.ets new file mode 100644 index 0000000000000000000000000000000000000000..9413288e891fa5f8b09ab5cb19c70656ce25c258 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeArguments.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 5.2.1 + * typeArguments: + * '<' type(','type)* '>' + * ; + */ + +let a: Array<[number, null, undefined]>; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeOfExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..82cefef45e3266b7dea95d741b88599acbac1734 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeOfExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let s: undefined = undefined; +typeof s; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeParameters.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeParameters.ets new file mode 100644 index 0000000000000000000000000000000000000000..d2c775c3cf4b392818b3cd80629e930629d3e0fd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeParameters.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 5.1 + * typeParameters: + * '<' typeParameterList '>' + * ; + */ + +class C1 { + public a: undefined = undefined; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unaryExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unaryExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..b4c6236bed0b7afc59370a81b44b3e57c630beef --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unaryExpression.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.20 + * unaryExpression: + * expression '++' + * | expression '--' + * | '++' expression + * | '--' expression + * | '+' expression + * | '-' expression + * | '~' expression + * | '!' expression + * ; + */ + +!undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unionType.ets new file mode 100644 index 0000000000000000000000000000000000000000..521aa72fe111f7825467222f0b4330938cb48fc3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unionType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let u: undefined | number = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_variableDeclarations.ets new file mode 100644 index 0000000000000000000000000000000000000000..9dbffd7eb186cbd5edbbe3c796cdc1da3a69a21c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_variableDeclarations.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let v: undefined = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_whileStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..52e873cf058ace3609b199ddcc594baa5150eda6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_whileStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +let m = 5; +let n = 3; +while(undefined) { + m--; +}