diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_annotationDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_annotationDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..ab0021cd3039e094594c714020e09f3189342a22 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 18.1 + * annotationDeclaration: + * '@interface' identifier '{' annotationField* '}' + * ; + */ + +@interface A { + a: number[]; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_annotationUsage.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_annotationUsage.ets new file mode 100644 index 0000000000000000000000000000000000000000..469b08acf8968f86ba5e75d93042d6151bc58adb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_annotationUsage.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 18.2 + * annotationUsage: + * 'at' qualifiedName annotationValues? + * ; + */ + +@interface test {} +@test +class MyClass { + a: number[] = [1, 2, 3]; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_arrayLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..8fdc6f41758348246a3292e84a53d833847b2679 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let a: number[] = [1, 2, 3]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_assignmentExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..2340864b2b4f1b75a5294ca38d630c8e732d6aff --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + + */ + +let a: number[] = [1, 2, 3]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_castExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_castExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..1dfa70262aba39f52cde59bc8ac03723c98e45fa --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_castExpression.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.15 + * castExpression: + * expression 'as' type + * ; + */ + +let a: number[] = [1, 2, 3] as number[]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_classInitializer.ets new file mode 100644 index 0000000000000000000000000000000000000000..42605d1a2d8be7d5b693f3e6d35a688813da3d61 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class test { + static a: number[] = [1, 2, 3]; + static initializerBlock() { + if (!test.a) { + test.a = [1, 2, 3]; + } + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_constantDeclarations.ets new file mode 100644 index 0000000000000000000000000000000000000000..62cdc2eae2d1e1d6dee7a2def2a4c18337e2665f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const a: number[] = [1, 2, 3]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_constantExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..d50663c10c51759ec33cd221f2eb9fd76085f01b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const a: number[] = [1, 2, 3]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_ensureNotNullishExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_ensureNotNullishExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..f02076ab55eb8279696a2b6ac7cbff0ed04d7bdc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.18 + * ensureNotNullishExpression: + * expression '!' + * ; + */ + +let a: number[] = [0, 1]; +a!; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_equalityExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_equalityExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..70b146a5acd4ec341ffb7bd3937ef1648f369d17 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.25 + * equalityExpression: + * expression ('==' | '===' | '!=' | '!==') expression + * ; + */ + +let a: number[] = [0, 1]; +let b: number[] = [0, 1]; +a == b; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_exportDirective.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_exportDirective.ets new file mode 100644 index 0000000000000000000000000000000000000000..c3d6fe336b86843e74a0c1c7dd54a22d5a5b77ee --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_exportDirective.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 13.9 + * exportDirective: + * selectiveExportDirective + * | singleExportDirective + * | exportTypeDirective + * | reExportDirective + * ; + */ + +export a; +let a: number[] = [1, 2, 3]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_exportTypeDirective.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_exportTypeDirective.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ebb7590955df1e9e29673d2608d34129ba7c2b3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_exportTypeDirective.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 13.9.3 + * exportTypeDirective: + * 'export' 'type' selectiveBindings + * ; + */ + +class A { + a: number[] = [1, 2, 3]; +} +export type { A }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_expression.ets new file mode 100644 index 0000000000000000000000000000000000000000..6916e4ea07d95f49434fa8f7ab01410051497dda --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +let a: number[] = [0, 1]; +a instanceof [number, string]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_fieldAccessExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..d0caa92ff3e7fb25284866f9e92181406fc44eac --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_fieldAccessExpression.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person { + a: number[] = [1, 2, 3]; +} +let test = new Person(); +test.a = [1, 2, 3]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_finallyClause.ets new file mode 100644 index 0000000000000000000000000000000000000000..019a27e31e5e6421787e683b8dd3539e6f6e6a2c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_finallyClause.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +function ProcessFile(name: string) { + try {} + finally { + let a: number[]; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_forStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..d399e9666975d7fc35836b7db7901902d885b9ad --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_forStatement.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +for (let a: number[] = [1, 2, 3]; ; ) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_functionCallExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..7dcf283359753474cbfbe8c927759ff720fb81d6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ( '?.' | typeArguments)? arguments block? + * ; + */ + +class Person { + sayHello(a: number[]) {} +} +let test: Person | null = null; +test?.sayHello([1, 2, 3]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_functionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_functionType.ets new file mode 100644 index 0000000000000000000000000000000000000000..a774af4612540a25062b2963a564e72ef34789e6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_functionType.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 3.19 + * functionType: + * '(' ftParameterList? ')' ftReturnType + * ; + */ + +let binaryOp: (a: number[]) => number; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_functionTypeWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_functionTypeWithReceiver.ets new file mode 100644 index 0000000000000000000000000000000000000000..4f81240cc107e032400ed977d0824c44fb14ccdb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_functionTypeWithReceiver.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 17.12.4 + * functionTypeWithReceiver: + * '(' receiverParameter (',' ftParameterList)? ')' ftReturnType + * ; + */ + +type FA = (this: number[]) => boolean; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_ifStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..541f5d20d39ba9e89b8cb51380d13be24fd4c684 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if (true) { + let a: number[]; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_indexingExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..f77c512ca1d6b3445ea4cc751ebc403815acd963 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +const a: number[] | null = null; +a?.[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_initializerBlock.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_initializerBlock.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a47905da541762ac1bf83c593a44ec0c4a4ff78 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 15.10 + * initializerBlock: + * 'static' block + * ; + */ + +class Test { + static { + let a: number[] = [0, 1]; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_instanceOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_instanceOfExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ddacc074ff284d1bf9b2c51d8e87d46f99ef5e6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.16 + * instanceOfExpression: + * expression 'instanceof' type + * ; + */ + +let a: number[] = [0, 1]; +a instanceof [number, string]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_lambdaExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..c662150ce2af989f41b25e156e99f362a5483b0c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_lambdaExpression.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? + * ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +(a: number[]): number => { return 0 }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000000000000000000000000000000000..1546af2febd057c10208562956c2f2fbce84c5f4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result1 = (this: A, a: number[]) => {}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_loopStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..f8054a4aff3424a6bfaba1431ef4111aad458139 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while(true) { + let a: number[] = [0, 1]; + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_methodCallExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..33bf86c09b85ec4692a3d3c3b3e3e48417dd70ab --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_methodCallExpression.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class MyClass { + sayHello(a: number[]) {} +} +let test = new MyClass(); +test.sayHello([0, 1]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_namespaceDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..094f152011f020ef74a0988ce88186b177182c27 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace test { + let a: number[]; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_newExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b693698a91cb7fc2df76c63fb5853138a024ff0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_newExpression.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class A { + constructor(a: number[]) {} +} +let instance = new A([0, 1]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_nullishCoalescingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_nullishCoalescingExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..11796a6033a51e7b5f0a3e8d96428efe17f1057a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.19 + * nullishCoalescingExpression: + * expression '??' expression + * ; + */ + +let a: number[] = [0, 1]; +a ?? "Default"; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_objectLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..dce29fdab3c30efcb68723ede73d214cca8f4fdd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + a: number[] = [0, 1]; +} +let test: Person = { a: [0, 1] }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_objectReference.ets new file mode 100644 index 0000000000000000000000000000000000000000..524e35f133c0ef99ef17b29b45db41547ff61b7c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_objectReference.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +class BaseClass { + constructor(a: number[]) {} +} +class A extends BaseClass { + constructor(a: number[]) { + super([0, 1]); + } +} +new A([0, 1]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_optionalParameter.ets new file mode 100644 index 0000000000000000000000000000000000000000..69a964ce691ac947d705d7364b78aac8ceeba342 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier'?' ':' type + * ; + */ + +function test(x: number, a: number[] = [0, 1]) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_parameterList.ets new file mode 100644 index 0000000000000000000000000000000000000000..44ce9688aa179caa8d3f82e5feaf5ca16af74ad3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function test(a: number[]): string { + return "name"; +} +test([0, 1]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_parenthesizedExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..c02fa6cde4accaf1b11161804840f3d4e13c2399 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_parenthesizedExpression.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +function test(a: number[]): string { + return "name"; +} +test([0, 1]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_restParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_restParameter.ets new file mode 100644 index 0000000000000000000000000000000000000000..47107154acf6f8c06112663cc71290383ec63281 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 4.8.5 + * restParameter: + * annotationUsage? '...' identifier ':' type + * ; + */ + +function test(...numbers: number[]): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_returnStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ff190abb8a12863961a9d254e4650ddc427711b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add(a: number[]) { + return a; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_selectiveExportDirective.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_selectiveExportDirective.ets new file mode 100644 index 0000000000000000000000000000000000000000..67eb2d5b1bad210a9fb32abdb1119da5eced400b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_selectiveExportDirective.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 13.9.1 + * selectiveExportDirective: + * 'export' selectiveBindings + * ; + */ + +let a: number[]; +export { a }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_separateModuleDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..799fca6558aeba0ee6ce27742f77d8a7829666fa --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +interface test { + doSomething(a: number[]): void +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_signature.ets new file mode 100644 index 0000000000000000000000000000000000000000..e0545e04c51ee2c86a0bfed125e9d157322c6d12 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_signature.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function test(a: number[]) {} +test([0, 1]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_singleExportDirective.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_singleExportDirective.ets new file mode 100644 index 0000000000000000000000000000000000000000..d0cb66afe61d36f7698c90a6f9ab1b92ee8eb9f7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_singleExportDirective.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 13.9.2 + * singleExportDirective: + * 'export' 'default'? identifier + * ; + */ + +export a; +let a: number[]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_spreadExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..d44ab7d29f423433d75660b3f9241e3c95aa4f32 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_spreadExpression.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let a: number[] = [0, 1]; +let a1: number[] = [0, 1]; +let test = [...a, ...a1]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_statement.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1b2b10bafe8e807c9d31826f4f8edde99507d7d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throwStatementt + * | tryStatement + * ; + */ + +let a: number[] = [0, 1]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_switchStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_switchStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..c2a8c8062c5b02f65677bf0cb1bb12c23c001259 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_switchStatement.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 8.13 + * switchStatement: + * (identifier ':')? 'switch' '(' expression ')' switchBlock + * ; + */ + +let a: number[] = [0, 1]; +switch (1) { + case 1: { + a = [0, 1]; + break; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_thisExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f3fa785e13183ab614dded8a4e3e85720b4467d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class test { + a: number[]; + constructor(a: number[]) { + this.a = a; + } +} +let person = new test([0, 1]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_topDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..063c150779a517678920cd5457403bc8b7ce0af5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +export default const a: number[] = [0, 1]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_topLevelStatements.ets new file mode 100644 index 0000000000000000000000000000000000000000..95839a48067dbe5526f95943b64fffbb52ee55a1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement* + * ; + */ + +type a = number[]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_trailingLambdaCall.ets new file mode 100644 index 0000000000000000000000000000000000000000..88f4515870b25691e07f848639ff91eb618348d9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + test(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.test([0, 1]) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_tryStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae8228ec8a0cbb0dafbb38bc7e35ad2b5ff089b5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processTwo(a: number): number { + try { + const a: number[] = [0, 1]; + return 0; + } catch (error) { + return -1; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_tupleType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_tupleType.ets new file mode 100644 index 0000000000000000000000000000000000000000..2dbde984415c3967b171968744c1a10e009a1183 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + */ + +let a: number[] | [number, "string"]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_typeAlias.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_typeAlias.ets new file mode 100644 index 0000000000000000000000000000000000000000..15d3370e753c780a586a552d50c2a64b5be6b6f4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_typeAlias.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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 4.6.1 + * typeAlias: + * 'type' identifier typeParameters? '=' type + * ; + */ + +type a = number[]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_typeOfExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..0632b29767407cc5826a35d37b3a779277dd1f36 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let a: number[] = [0, 1]; +typeof a; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_unionType.ets new file mode 100644 index 0000000000000000000000000000000000000000..c393711639a08041fa7afa65a34ab36d4e4c6795 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let a: number[] | int[] = [0, 1]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_variableDeclarations.ets new file mode 100644 index 0000000000000000000000000000000000000000..17dbabd5f2aa8bde3bfe732f52c46448ee2d8784 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let a: number[] = [0, 1]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_whileStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..26520f7dfd57211c7fd965c1580a22ccaafbc10a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_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 3.17.1 + * arrayType: + * type '[' ']' + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +while(3 < 5) { + let a: number[] = [0]; + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_annotationUsage.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_annotationUsage.ets new file mode 100644 index 0000000000000000000000000000000000000000..d381fee335caec70fe78b2db2e890006d533e97d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_annotationUsage.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 18.2 + * annotationUsage: + * 'at' qualifiedName annotationValues? + * ; + */ + +@interface test {} +@test +class MyClass { + tuple: [number, string] = [0, "default"]; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_arrayLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c4fbdde57077487cfaf3891e16d95c79ab0cf8b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let tuple: [number, string] = [0, "default"]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_assignmentExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..67a839927d12c4fd31b4669d6df865ba0e8b1b58 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + + */ + +let tuple: [number, string] = [0, "default"]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_castExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_castExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..f910e37f6142c385d497dbbb57b42f03eb8e5c1a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_castExpression.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.15 + * castExpression: + * expression 'as' type + * ; + */ + +let tuple: [number, string] = [0, "default"] as [number, string]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_classInitializer.ets new file mode 100644 index 0000000000000000000000000000000000000000..a4ce73c24be1dcbca356e23dffef7b487873fbee --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class test { + static tuple: [number, string] = [0, "default"]; + static initializerBlock() { + if (!test.tuple) { + test.tuple = [0, "default"]; + } + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_constantDeclarations.ets new file mode 100644 index 0000000000000000000000000000000000000000..998ad1de45af74ee39b561945891a3dbec386964 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const tuple: [number, string] = [0, "default"]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_constantExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee1475d3a9d4b5d9c868c5c8e66d8d442f553efe --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const tuple: [number, string] = [0, "default"]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_exportDirective.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_exportDirective.ets new file mode 100644 index 0000000000000000000000000000000000000000..69bbf930b90584945c9426c95570a4cf418387a9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_exportDirective.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 13.9 + * exportDirective: + * selectiveExportDirective + * | singleExportDirective + * | exportTypeDirective + * | reExportDirective + * ; + */ + +export tuple; +let tuple: [number, string] = [0, "default"]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_exportTypeDirective.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_exportTypeDirective.ets new file mode 100644 index 0000000000000000000000000000000000000000..679621d7e49c12a83ee56a53321426ee13d89563 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_exportTypeDirective.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 13.9.3 + * exportTypeDirective: + * 'export' 'type' selectiveBindings + * ; + */ + +class A { + tuple: [number, string] = [0, "default"]; +} +export type { A }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_expression.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9f32e88d07513ac1b90f1a58680f0621b3bb7af --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +let tuple: [number, string] = [0, "default"]; +tuple instanceof [number, string]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_fieldAccessExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..69c9cb6e861ff11b7651dbaacfe5c1be77586898 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_fieldAccessExpression.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person { + tuple: [number, string] = [0, "default"]; +} +let test = new Person(); +test.tuple = [0, "default"]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_finallyClause.ets new file mode 100644 index 0000000000000000000000000000000000000000..f9885c43d3dc52fd41ece9d9102da6dec64d8a5a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_finallyClause.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +function ProcessFile(name: string) { + try { + let tuple: [number, string] = [0, "default"]; + } + finally {} +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_forStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..ea232188d1cb63a39c7aaa64d683397d4403b896 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_forStatement.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +for (let tuple: [number, string] = [0, "default"]; ; ) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_functionCallExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..c2a1df0066b14196a08bfb3578068c1cc83597e7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ( '?.' | typeArguments)? arguments block? + * ; + */ + +class Person { + sayHello(tuple: [number, string]) {} +} +let test: Person | null = null; +test?.sayHello([0, "default"]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_functionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_functionType.ets new file mode 100644 index 0000000000000000000000000000000000000000..1285995439895c7bf186ebdb9daf7bcb62a2eecb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_functionType.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 3.19 + * functionType: + * '(' ftParameterList? ')' ftReturnType + * ; + */ + +let binaryOp: (tuple: [number, string]) => number; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_functionTypeWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_functionTypeWithReceiver.ets new file mode 100644 index 0000000000000000000000000000000000000000..986294cd5a2444477c634b77c76220d97d0f16b9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_functionTypeWithReceiver.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 17.12.4 + * functionTypeWithReceiver: + * '(' receiverParameter (',' ftParameterList)? ')' ftReturnType + * ; + */ + +type FA = (this: [number, string]) => boolean; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_ifStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4a45b2f02b7275cd66f91b9435d0b878180edc7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if (true) { + let tuple: [number, string]; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_indexingExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..0914a178f1a083f4e6e1d3311ad26c4d11cbe7f9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +const tuple: [number] | null = null; +tuple?.[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_initializerBlock.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_initializerBlock.ets new file mode 100644 index 0000000000000000000000000000000000000000..74328f19a737bb14fefd5ebb8cb1ed829dc24056 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 15.10 + * initializerBlock: + * 'static' block + * ; + */ + +class Test { + static { + let tuple: [number, string] = [0, "default"]; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_instanceOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_instanceOfExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f292b931e3857ff92a1782c1f376e541603e381 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.16 + * instanceOfExpression: + * expression 'instanceof' type + * ; + */ + +let tuple: [number, string] = [0, "default"]; +tuple instanceof [number, string]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_lambdaExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..173c7a4d19784834fcb64e63663cbb0c0f22a8cb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_lambdaExpression.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? + * ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +(tuple: [number, string]): number => { return 0 }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000000000000000000000000000000000..1cb2b220a93a1220d5d7ee81de061358ea27c151 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result1 = (this: A, tuple: [number, string]) => {}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_loopStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..707f4afcda728800adf14130b29ba4a39cb33862 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while(true) { + let tuple: [number, string] = [0, "default"]; + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_methodCallExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..f3ba799ed7d909a9b88f40eb74490e5fcddb18f7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_methodCallExpression.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class MyClass { + sayHello(tuple: [number, string]) {} +} +let test = new MyClass(); +test.sayHello([0, "default"]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_namespaceDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..683e7e0424ecbac0148f52a6826ed3ec102592fb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace test { + let tuple: [number, string]; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_newExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..635921cf1173de15772b4ea4417186a7930738eb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_newExpression.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class A { + constructor(tuple: [number, string]) {} +} +let instance = new A([0, "default"]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_objectLiteral.ets new file mode 100644 index 0000000000000000000000000000000000000000..7d4dc5ece550274ca3e0af23f3acebcb41ebba63 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + tuple: [number, string] = [0, "default"]; +} +let test: Person = { tuple: [0, "default"] }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_objectReference.ets new file mode 100644 index 0000000000000000000000000000000000000000..a3b4dedd7c0a55d4ec65a4f2bdf9c37c817055eb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_objectReference.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +class BaseClass { + constructor(tuple: [number, string]) {} +} +class A extends BaseClass { + constructor(tuple: [number, string]) { + super([0, "default"]); + } +} +new A([0, "default"]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_optionalParameter.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e5e5ee22036c5586930a477eea4604dd209b0cc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier'?' ':' type + * ; + */ + +function test(x: number, tuple: [number, string] = [0, "default"]) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_parameterList.ets new file mode 100644 index 0000000000000000000000000000000000000000..80c8162e84184095edd21e8b32cf897f9bbf844d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function test(tuple: [number, string]): string { + return "name"; +} +test([0, "default"]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_parenthesizedExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..bd003a07a7e168d4e00ed126dd1b2d42c179d661 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_parenthesizedExpression.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +function test(tuple: [number, string]): string { + return "name"; +} +test([0, "default"]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_returnStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..d615aca9b95d574939f76fd15b4eede949bd6681 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add(tuple: [number, string]) { + return tuple; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_selectiveExportDirective.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_selectiveExportDirective.ets new file mode 100644 index 0000000000000000000000000000000000000000..c7112b0c542befc3e15318e76115400f0efd3b9f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_selectiveExportDirective.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 13.9.1 + * selectiveExportDirective: + * 'export' selectiveBindings + * ; + */ + +let tuple: [number, string]; +export { tuple }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_separateModuleDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..78ecb5abb9378e342ff499fa4a92026e2e459961 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +interface test { + doSomething(tuple: [number, string]): void +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_signature.ets new file mode 100644 index 0000000000000000000000000000000000000000..522ab5a799649343b1ed5ef1d99684e0d3cff1a5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_signature.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function test(tuple: [number, string]) {} +test([0, "default"]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_singleExportDirective.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_singleExportDirective.ets new file mode 100644 index 0000000000000000000000000000000000000000..61bb0ea4bb438e5702ea3bbe86d212747addb2ef --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_singleExportDirective.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 13.9.2 + * singleExportDirective: + * 'export' 'default'? identifier + * ; + */ + +export tuple; +let tuple: [number, string]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_spreadExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..a513fc01eb7e1cd885b364dc18d244bb43ef59ce --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_spreadExpression.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let tuple: [number, string] = [0, "default"]; +let tuple1: [number, string] = [0, "default"]; +let test = [...tuple, ...tuple1]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_statement.ets new file mode 100644 index 0000000000000000000000000000000000000000..3d01a7c19034e1c52506648e3efa511ada590afa --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throwStatementt + * | tryStatement + * ; + */ + +let tuple: [number, string] = [0, "default"]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_switchStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_switchStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..78860ce0e2c39032080ed102df7b18cfe8b2184a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_switchStatement.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 8.13 + * switchStatement: + * (identifier ':')? 'switch' '(' expression ')' switchBlock + * ; + */ + +let tuple: [number, string] = [0, "default"]; +switch (1) { + case 1: { + tuple = [0, "default"]; + break; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_thisExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4d78f1c96022d853f32e383c8b79f7eb54b1738 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class test { + tuple: [number, string]; + constructor(tuple: [number, string]) { + this.tuple = tuple; + } +} +let person = new test([0, "default"]); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_topDeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..55619d1051cc41dc361d1d1f2991f8afb1965133 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +export default const tuple: [number, string] = [0, "default"]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_topLevelStatements.ets new file mode 100644 index 0000000000000000000000000000000000000000..056642507edc4272673e1a7ba824b32e57a12c8c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement* + * ; + */ + +type tuple = [number, string]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_trailingLambdaCall.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecdd68a9b45e0688759354d2bacec2749ee42b2c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + test(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.test<[number, string]>([0, "default"]) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_tryStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed4c5c22fb7b0823bdb122f20ce3fbdcdc4eca48 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processTwo(a: number): number { + try { + const tuple: [number, string] = [0, "default"]; + return 0; + } catch (error) { + return -1; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_typeAlias.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_typeAlias.ets new file mode 100644 index 0000000000000000000000000000000000000000..44169708c55eca2bc18b307560100143cc1c5a11 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_typeAlias.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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 4.6.1 + * typeAlias: + * 'type' identifier typeParameters? '=' type + * ; + */ + +type tuple = [number, string]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_typeOfExpression.ets new file mode 100644 index 0000000000000000000000000000000000000000..68ed886727d4d28d2b68f4c8d77f59d39a13d487 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let tuple: [number, string] = [0, "default"]; +typeof tuple; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_unionType.ets new file mode 100644 index 0000000000000000000000000000000000000000..7011d93777a5f12e3502fddc9771b15199026260 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let tuple: [number, string] | [number, string] = [0, "default"]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_variableDeclarations.ets new file mode 100644 index 0000000000000000000000000000000000000000..917805be6591793d8981319c4673c9e192ffd732 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let tuple: [number, string] = [0, "default"]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_whileStatement.ets new file mode 100644 index 0000000000000000000000000000000000000000..06a661149f93436897c07c0d494a820bc44f34d1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_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 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +while(3 < 5) { + let tuple: [number, string] = [0, "default"]; + break; +}