From cb4a3de48254da4f16a2e27352cbe1ca9c704279 Mon Sep 17 00:00:00 2001 From: liujia178 Date: Mon, 14 Apr 2025 19:34:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0type&typeReference&tupleType&?= =?UTF-8?q?arrayType=E7=89=B9=E6=80=A7=20=E6=AD=A3=E4=BA=A4=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liujia178 --- .../arrayType_annotationDeclaration.ets | 30 +++++++++++++ .../arrayType/arrayType_annotationUsage.ets | 32 ++++++++++++++ .../arrayType/arrayType_arrayLiteral.ets | 28 ++++++++++++ .../arrayType_assignmentExpression.ets | 29 +++++++++++++ .../arrayType/arrayType_castExpression.ets | 28 ++++++++++++ .../arrayType/arrayType_classInitializer.ets | 35 +++++++++++++++ .../arrayType_constantDeclarations.ets | 28 ++++++++++++ .../arrayType_constantExpression.ets | 28 ++++++++++++ .../arrayType_ensureNotNullishExpression.ets | 29 +++++++++++++ .../arrayType_equalityExpression.ets | 30 +++++++++++++ .../arrayType/arrayType_exportDirective.ets | 32 ++++++++++++++ .../arrayType_exportTypeDirective.ets | 31 +++++++++++++ .../arrayType/arrayType_expression.ets | 43 +++++++++++++++++++ .../arrayType_fieldAccessExpression.ets | 32 ++++++++++++++ .../arrayType/arrayType_finallyClause.ets | 33 ++++++++++++++ .../arrayType/arrayType_forStatement.ets | 28 ++++++++++++ .../arrayType_functionCallExpression.ets | 32 ++++++++++++++ .../arrayType/arrayType_functionType.ets | 28 ++++++++++++ .../arrayType_functionTypeWithReceiver.ets | 28 ++++++++++++ .../arrayType/arrayType_ifStatement.ets | 31 +++++++++++++ .../arrayType_indexingExpression.ets | 29 +++++++++++++ .../arrayType/arrayType_initializerBlock.ets | 32 ++++++++++++++ .../arrayType_instanceOfExpression.ets | 29 +++++++++++++ .../arrayType/arrayType_lambdaExpression.ets | 29 +++++++++++++ ...arrayType_lambdaExpressionWithReceiver.ets | 31 +++++++++++++ .../arrayType/arrayType_loopStatement.ets | 35 +++++++++++++++ .../arrayType_methodCallExpression.ets | 32 ++++++++++++++ .../arrayType_namespaceDeclaration.ets | 31 +++++++++++++ .../arrayType/arrayType_newExpression.ets | 32 ++++++++++++++ .../arrayType_nullishCoalescingExpression.ets | 29 +++++++++++++ .../arrayType/arrayType_objectLiteral.ets | 31 +++++++++++++ .../arrayType/arrayType_objectReference.ets | 38 ++++++++++++++++ .../arrayType/arrayType_optionalParameter.ets | 29 +++++++++++++ .../arrayType/arrayType_parameterList.ets | 32 ++++++++++++++ .../arrayType_parenthesizedExpression.ets | 31 +++++++++++++ .../arrayType/arrayType_restParameter.ets | 30 +++++++++++++ .../arrayType/arrayType_returnStatement.ets | 30 +++++++++++++ .../arrayType_selectiveExportDirective.ets | 29 +++++++++++++ .../arrayType_separateModuleDeclaration.ets | 30 +++++++++++++ .../3_types/arrayType/arrayType_signature.ets | 29 +++++++++++++ .../arrayType_singleExportDirective.ets | 29 +++++++++++++ .../arrayType/arrayType_spreadExpression.ets | 30 +++++++++++++ .../3_types/arrayType/arrayType_statement.ets | 38 ++++++++++++++++ .../arrayType/arrayType_switchStatement.ets | 34 +++++++++++++++ .../arrayType/arrayType_thisExpression.ets | 34 +++++++++++++++ .../arrayType/arrayType_topDeclaration.ets | 37 ++++++++++++++++ .../arrayType_topLevelStatements.ets | 28 ++++++++++++ .../arrayType_trailingLambdaCall.ets | 38 ++++++++++++++++ .../arrayType/arrayType_tryStatement.ets | 35 +++++++++++++++ .../3_types/arrayType/arrayType_tupleType.ets | 28 ++++++++++++ .../3_types/arrayType/arrayType_typeAlias.ets | 28 ++++++++++++ .../arrayType/arrayType_typeOfExpression.ets | 29 +++++++++++++ .../3_types/arrayType/arrayType_unionType.ets | 28 ++++++++++++ .../arrayType_variableDeclarations.ets | 28 ++++++++++++ .../arrayType/arrayType_whileStatement.ets | 31 +++++++++++++ .../tupleType/tupleType_annotationUsage.ets | 32 ++++++++++++++ .../tupleType/tupleType_arrayLiteral.ets | 28 ++++++++++++ .../tupleType_assignmentExpression.ets | 29 +++++++++++++ .../tupleType/tupleType_castExpression.ets | 28 ++++++++++++ .../tupleType/tupleType_classInitializer.ets | 35 +++++++++++++++ .../tupleType_constantDeclarations.ets | 28 ++++++++++++ .../tupleType_constantExpression.ets | 28 ++++++++++++ .../tupleType/tupleType_exportDirective.ets | 32 ++++++++++++++ .../tupleType_exportTypeDirective.ets | 31 +++++++++++++ .../tupleType/tupleType_expression.ets | 43 +++++++++++++++++++ .../tupleType_fieldAccessExpression.ets | 32 ++++++++++++++ .../tupleType/tupleType_finallyClause.ets | 33 ++++++++++++++ .../tupleType/tupleType_forStatement.ets | 28 ++++++++++++ .../tupleType_functionCallExpression.ets | 32 ++++++++++++++ .../tupleType/tupleType_functionType.ets | 28 ++++++++++++ .../tupleType_functionTypeWithReceiver.ets | 28 ++++++++++++ .../tupleType/tupleType_ifStatement.ets | 31 +++++++++++++ .../tupleType_indexingExpression.ets | 29 +++++++++++++ .../tupleType/tupleType_initializerBlock.ets | 32 ++++++++++++++ .../tupleType_instanceOfExpression.ets | 29 +++++++++++++ .../tupleType/tupleType_lambdaExpression.ets | 29 +++++++++++++ ...tupleType_lambdaExpressionWithReceiver.ets | 31 +++++++++++++ .../tupleType/tupleType_loopStatement.ets | 35 +++++++++++++++ .../tupleType_methodCallExpression.ets | 32 ++++++++++++++ .../tupleType_namespaceDeclaration.ets | 31 +++++++++++++ .../tupleType/tupleType_newExpression.ets | 32 ++++++++++++++ .../tupleType/tupleType_objectLiteral.ets | 31 +++++++++++++ .../tupleType/tupleType_objectReference.ets | 38 ++++++++++++++++ .../tupleType/tupleType_optionalParameter.ets | 29 +++++++++++++ .../tupleType/tupleType_parameterList.ets | 32 ++++++++++++++ .../tupleType_parenthesizedExpression.ets | 31 +++++++++++++ .../tupleType/tupleType_returnStatement.ets | 30 +++++++++++++ .../tupleType_selectiveExportDirective.ets | 29 +++++++++++++ .../tupleType_separateModuleDeclaration.ets | 30 +++++++++++++ .../3_types/tupleType/tupleType_signature.ets | 29 +++++++++++++ .../tupleType_singleExportDirective.ets | 29 +++++++++++++ .../tupleType/tupleType_spreadExpression.ets | 30 +++++++++++++ .../3_types/tupleType/tupleType_statement.ets | 38 ++++++++++++++++ .../tupleType/tupleType_switchStatement.ets | 34 +++++++++++++++ .../tupleType/tupleType_thisExpression.ets | 34 +++++++++++++++ .../tupleType/tupleType_topDeclaration.ets | 37 ++++++++++++++++ .../tupleType_topLevelStatements.ets | 28 ++++++++++++ .../tupleType_trailingLambdaCall.ets | 38 ++++++++++++++++ .../tupleType/tupleType_tryStatement.ets | 35 +++++++++++++++ .../3_types/tupleType/tupleType_typeAlias.ets | 28 ++++++++++++ .../tupleType/tupleType_typeOfExpression.ets | 29 +++++++++++++ .../3_types/tupleType/tupleType_unionType.ets | 28 ++++++++++++ .../tupleType_variableDeclarations.ets | 28 ++++++++++++ .../tupleType/tupleType_whileStatement.ets | 31 +++++++++++++ 104 files changed, 3240 insertions(+) create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_annotationDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_annotationUsage.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_arrayLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_assignmentExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_castExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_classInitializer.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_constantDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_constantExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_ensureNotNullishExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_equalityExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_exportDirective.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_exportTypeDirective.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_expression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_fieldAccessExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_finallyClause.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_forStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_functionCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_functionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_functionTypeWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_ifStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_indexingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_initializerBlock.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_instanceOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_lambdaExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_lambdaExpressionWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_loopStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_methodCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_namespaceDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_newExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_nullishCoalescingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_objectLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_objectReference.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_optionalParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_parameterList.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_parenthesizedExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_restParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_returnStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_selectiveExportDirective.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_separateModuleDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_signature.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_singleExportDirective.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_spreadExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_statement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_switchStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_thisExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_topDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_topLevelStatements.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_trailingLambdaCall.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_tryStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_tupleType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_typeAlias.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_typeOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_unionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_variableDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/arrayType/arrayType_whileStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_annotationUsage.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_arrayLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_assignmentExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_castExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_classInitializer.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_constantDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_constantExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_exportDirective.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_exportTypeDirective.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_expression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_fieldAccessExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_finallyClause.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_forStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_functionCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_functionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_functionTypeWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_ifStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_indexingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_initializerBlock.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_instanceOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_lambdaExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_lambdaExpressionWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_loopStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_methodCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_namespaceDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_newExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_objectLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_objectReference.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_optionalParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_parameterList.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_parenthesizedExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_returnStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_selectiveExportDirective.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_separateModuleDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_signature.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_singleExportDirective.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_spreadExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_statement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_switchStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_thisExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_topDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_topLevelStatements.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_trailingLambdaCall.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_tryStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_typeAlias.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_typeOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_unionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_variableDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/3_types/tupleType/tupleType_whileStatement.ets 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 0000000000..ab0021cd30 --- /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 0000000000..469b08acf8 --- /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 0000000000..8fdc6f4175 --- /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 0000000000..2340864b2b --- /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 0000000000..1dfa70262a --- /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 0000000000..42605d1a2d --- /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 0000000000..62cdc2eae2 --- /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 0000000000..d50663c10c --- /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 0000000000..f02076ab55 --- /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 0000000000..70b146a5ac --- /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 0000000000..c3d6fe336b --- /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 0000000000..2ebb759095 --- /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 0000000000..6916e4ea07 --- /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 0000000000..d0caa92ff3 --- /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 0000000000..019a27e31e --- /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 0000000000..d399e96669 --- /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 0000000000..7dcf283359 --- /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 0000000000..a774af4612 --- /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 0000000000..4f81240cc1 --- /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 0000000000..541f5d20d3 --- /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 0000000000..f77c512ca1 --- /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 0000000000..4a47905da5 --- /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 0000000000..1ddacc074f --- /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 0000000000..c662150ce2 --- /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 0000000000..1546af2feb --- /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 0000000000..f8054a4aff --- /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 0000000000..33bf86c09b --- /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 0000000000..094f152011 --- /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 0000000000..1b693698a9 --- /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 0000000000..11796a6033 --- /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 0000000000..dce29fdab3 --- /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 0000000000..524e35f133 --- /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 0000000000..69a964ce69 --- /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 0000000000..44ce9688aa --- /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 0000000000..c02fa6cde4 --- /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 0000000000..47107154ac --- /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 0000000000..7ff190abb8 --- /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 0000000000..67eb2d5b1b --- /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 0000000000..799fca6558 --- /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 0000000000..e0545e04c5 --- /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 0000000000..d0cb66afe6 --- /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 0000000000..d44ab7d29f --- /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 0000000000..c1b2b10baf --- /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 0000000000..c2a8c8062c --- /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 0000000000..5f3fa785e1 --- /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 0000000000..063c150779 --- /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 0000000000..95839a4806 --- /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 0000000000..88f4515870 --- /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 0000000000..ae8228ec8a --- /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 0000000000..2dbde98441 --- /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 0000000000..15d3370e75 --- /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 0000000000..0632b29767 --- /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 0000000000..c393711639 --- /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 0000000000..17dbabd5f2 --- /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 0000000000..26520f7dfd --- /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 0000000000..d381fee335 --- /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 0000000000..3c4fbdde57 --- /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 0000000000..67a839927d --- /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 0000000000..f910e37f61 --- /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 0000000000..a4ce73c24b --- /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 0000000000..998ad1de45 --- /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 0000000000..ee1475d3a9 --- /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 0000000000..69bbf930b9 --- /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 0000000000..679621d7e4 --- /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 0000000000..b9f32e88d0 --- /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 0000000000..69c9cb6e86 --- /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 0000000000..f9885c43d3 --- /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 0000000000..ea232188d1 --- /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 0000000000..c2a1df0066 --- /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 0000000000..1285995439 --- /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 0000000000..986294cd5a --- /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 0000000000..f4a45b2f02 --- /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 0000000000..0914a178f1 --- /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 0000000000..74328f19a7 --- /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 0000000000..6f292b931e --- /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 0000000000..173c7a4d19 --- /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 0000000000..1cb2b220a9 --- /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 0000000000..707f4afcda --- /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 0000000000..f3ba799ed7 --- /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 0000000000..683e7e0424 --- /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 0000000000..635921cf11 --- /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 0000000000..7d4dc5ece5 --- /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 0000000000..a3b4dedd7c --- /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 0000000000..2e5e5ee220 --- /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 0000000000..80c8162e84 --- /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 0000000000..bd003a07a7 --- /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 0000000000..d615aca9b9 --- /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 0000000000..c7112b0c54 --- /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 0000000000..78ecb5abb9 --- /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 0000000000..522ab5a799 --- /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 0000000000..61bb0ea4bb --- /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 0000000000..a513fc01eb --- /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 0000000000..3d01a7c190 --- /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 0000000000..78860ce0e2 --- /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 0000000000..f4d78f1c96 --- /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 0000000000..55619d1051 --- /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 0000000000..056642507e --- /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 0000000000..ecdd68a9b4 --- /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 0000000000..ed4c5c22fb --- /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 0000000000..44169708c5 --- /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 0000000000..68ed886727 --- /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 0000000000..7011d93777 --- /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 0000000000..917805be65 --- /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 0000000000..06a661149f --- /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; +} -- Gitee