From 7878d402411bac0752b454bf1fd1ebb090112fe5 Mon Sep 17 00:00:00 2001 From: liujia178 Date: Mon, 12 May 2025 10:31:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0IntegerLiteral&NullLiteral&St?= =?UTF-8?q?ringLiteral=E6=AD=A3=E4=BA=A4=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liujia178 --- .../IntegerLiteral_BooleanLiteral.ets | 31 +++++++++++++ .../IntegerLiteral_FloatLiteral.ets | 33 ++++++++++++++ .../IntegerLiteral_MultilineStringLiteral.ets | 35 +++++++++++++++ .../IntegerLiteral_StringLiteral.ets | 35 +++++++++++++++ .../IntegerLiteral_UndefinedLiteral.ets | 34 ++++++++++++++ .../IntegerLiteral_additiveExpression.ets | 32 +++++++++++++ .../IntegerLiteral_annotationDeclaration.ets | 33 ++++++++++++++ .../IntegerLiteral_annotationUsage.ets | 37 +++++++++++++++ .../IntegerLiteral_arrayLiteral.ets | 31 +++++++++++++ .../IntegerLiteral_arrayType.ets | 31 +++++++++++++ .../IntegerLiteral_assignmentExpression.ets | 31 +++++++++++++ .../IntegerLiteral_awaitExpression.ets | 35 +++++++++++++++ ...gerLiteral_bitwiseAndLogicalExpression.ets | 33 ++++++++++++++ .../IntegerLiteral_classInitializer.ets | 38 ++++++++++++++++ ...ntegerLiteral_conditionalAndExpression.ets | 31 +++++++++++++ .../IntegerLiteral_conditionalExpression.ets | 31 +++++++++++++ ...IntegerLiteral_conditionalOrExpression.ets | 31 +++++++++++++ .../IntegerLiteral_constantDeclarations.ets | 31 +++++++++++++ .../IntegerLiteral_constantExpression.ets | 31 +++++++++++++ ...egerLiteral_ensureNotNullishExpression.ets | 31 +++++++++++++ .../IntegerLiteral_equalityExpression.ets | 31 +++++++++++++ .../IntegerLiteral_expression.ets | 45 +++++++++++++++++++ .../IntegerLiteral_fieldAccessExpression.ets | 36 +++++++++++++++ .../IntegerLiteral_finallyClause.ets | 40 +++++++++++++++++ .../IntegerLiteral_forOfStatement.ets | 35 +++++++++++++++ .../IntegerLiteral_forStatement.ets | 36 +++++++++++++++ .../IntegerLiteral_functionCallExpression.ets | 35 +++++++++++++++ .../IntegerLiteral_ifStatement.ets | 34 ++++++++++++++ .../IntegerLiteral_indexingExpression.ets | 32 +++++++++++++ .../IntegerLiteral_initializerBlock.ets | 35 +++++++++++++++ .../IntegerLiteral_lambdaExpression.ets | 33 ++++++++++++++ ...erLiteral_lambdaExpressionWithReceiver.ets | 34 ++++++++++++++ .../IntegerLiteral_loopStatement.ets | 37 +++++++++++++++ .../IntegerLiteral_methodCallExpression.ets | 39 ++++++++++++++++ ...ntegerLiteral_multiplicativeExpression.ets | 33 ++++++++++++++ .../IntegerLiteral_namespaceDeclaration.ets | 34 ++++++++++++++ .../IntegerLiteral_newArrayInstance.ets | 32 +++++++++++++ .../IntegerLiteral_newExpression.ets | 36 +++++++++++++++ ...gerLiteral_nullishCoalescingExpression.ets | 31 +++++++++++++ .../IntegerLiteral_objectLiteral.ets | 34 ++++++++++++++ .../IntegerLiteral_objectReference.ets | 33 ++++++++++++++ .../IntegerLiteral_optionalParameter.ets | 32 +++++++++++++ .../IntegerLiteral_parameterList.ets | 34 ++++++++++++++ ...IntegerLiteral_parenthesizedExpression.ets | 31 +++++++++++++ .../IntegerLiteral_recordLiteral.ets | 34 ++++++++++++++ .../IntegerLiteral_relationalExpression.ets | 34 ++++++++++++++ .../IntegerLiteral_restParameter.ets | 33 ++++++++++++++ .../IntegerLiteral_returnStatement.ets | 33 ++++++++++++++ ...tegerLiteral_separateModuleDeclaration.ets | 31 +++++++++++++ .../IntegerLiteral_shiftExpression.ets | 33 ++++++++++++++ .../IntegerLiteral_signature.ets | 33 ++++++++++++++ .../IntegerLiteral_spreadExpression.ets | 34 ++++++++++++++ .../IntegerLiteral_statement.ets | 41 +++++++++++++++++ .../IntegerLiteral_switchStatement.ets | 34 ++++++++++++++ .../IntegerLiteral_thisExpression.ets | 36 +++++++++++++++ .../IntegerLiteral_topDeclaration.ets | 40 +++++++++++++++++ .../IntegerLiteral_topLevelStatements.ets | 31 +++++++++++++ .../IntegerLiteral_trailingLambdaCall.ets | 41 +++++++++++++++++ .../IntegerLiteral_tryStatement.ets | 38 ++++++++++++++++ .../IntegerLiteral_tupleType.ets | 31 +++++++++++++ .../IntegerLiteral_typeOfExpression.ets | 32 +++++++++++++ .../IntegerLiteral_typeParameters.ets | 33 ++++++++++++++ .../IntegerLiteral_unaryExpression.ets | 38 ++++++++++++++++ .../IntegerLiteral_unionType.ets | 31 +++++++++++++ .../IntegerLiteral_variableDeclarations.ets | 31 +++++++++++++ .../IntegerLiteral_whileStatement.ets | 35 +++++++++++++++ .../NullLiteral_UndefinedLiteral.ets | 31 +++++++++++++ .../NullLiteral/NullLiteral_arrayLiteral.ets | 28 ++++++++++++ .../NullLiteral/NullLiteral_arrayType.ets | 28 ++++++++++++ .../NullLiteral_assignmentExpression.ets | 28 ++++++++++++ .../NullLiteral_awaitExpression.ets | 32 +++++++++++++ .../NullLiteral_classInitializer.ets | 35 +++++++++++++++ .../NullLiteral_conditionalAndExpression.ets | 28 ++++++++++++ .../NullLiteral_conditionalExpression.ets | 28 ++++++++++++ .../NullLiteral_conditionalOrExpression.ets | 28 ++++++++++++ .../NullLiteral_constantDeclarations.ets | 28 ++++++++++++ .../NullLiteral_constantExpression.ets | 28 ++++++++++++ ...NullLiteral_ensureNotNullishExpression.ets | 29 ++++++++++++ .../NullLiteral_equalityExpression.ets | 28 ++++++++++++ .../NullLiteral/NullLiteral_expression.ets | 42 +++++++++++++++++ .../NullLiteral_fieldAccessExpression.ets | 33 ++++++++++++++ .../NullLiteral/NullLiteral_finallyClause.ets | 42 +++++++++++++++++ .../NullLiteral_forOfStatement.ets | 32 +++++++++++++ .../NullLiteral/NullLiteral_forStatement.ets | 33 ++++++++++++++ .../NullLiteral_functionCallExpression.ets | 32 +++++++++++++ .../NullLiteral/NullLiteral_functionType.ets | 28 ++++++++++++ .../NullLiteral/NullLiteral_ifStatement.ets | 31 +++++++++++++ .../NullLiteral_indexingExpression.ets | 29 ++++++++++++ .../NullLiteral_initializerBlock.ets | 32 +++++++++++++ .../NullLiteral_instanceOfExpression.ets | 28 ++++++++++++ .../NullLiteral_lambdaExpression.ets | 30 +++++++++++++ ...llLiteral_lambdaExpressionWithReceiver.ets | 31 +++++++++++++ .../NullLiteral/NullLiteral_loopStatement.ets | 34 ++++++++++++++ .../NullLiteral_methodCallExpression.ets | 36 +++++++++++++++ .../NullLiteral_namespaceDeclaration.ets | 31 +++++++++++++ .../NullLiteral_newArrayInstance.ets | 28 ++++++++++++ .../NullLiteral/NullLiteral_newExpression.ets | 33 ++++++++++++++ ...ullLiteral_nullishCoalescingExpression.ets | 28 ++++++++++++ .../NullLiteral/NullLiteral_objectLiteral.ets | 31 +++++++++++++ .../NullLiteral_objectReference.ets | 30 +++++++++++++ .../NullLiteral_optionalParameter.ets | 29 ++++++++++++ .../NullLiteral/NullLiteral_parameterList.ets | 31 +++++++++++++ .../NullLiteral_parenthesizedExpression.ets | 28 ++++++++++++ .../NullLiteral/NullLiteral_restParameter.ets | 30 +++++++++++++ .../NullLiteral_returnStatement.ets | 30 +++++++++++++ .../NullLiteral_separateModuleDeclaration.ets | 30 +++++++++++++ .../NullLiteral/NullLiteral_signature.ets | 30 +++++++++++++ .../NullLiteral_spreadExpression.ets | 31 +++++++++++++ .../NullLiteral/NullLiteral_statement.ets | 38 ++++++++++++++++ .../NullLiteral_stringInterpolation.ets | 29 ++++++++++++ .../NullLiteral_thisExpression.ets | 33 ++++++++++++++ .../NullLiteral_throwStatement.ets | 28 ++++++++++++ .../NullLiteral_topDeclaration.ets | 37 +++++++++++++++ .../NullLiteral_topLevelStatements.ets | 28 ++++++++++++ .../NullLiteral_trailingLambdaCall.ets | 38 ++++++++++++++++ .../NullLiteral/NullLiteral_tryStatement.ets | 35 +++++++++++++++ .../NullLiteral/NullLiteral_tupleType.ets | 28 ++++++++++++ .../NullLiteral/NullLiteral_typeAlias.ets | 28 ++++++++++++ .../NullLiteral/NullLiteral_typeArguments.ets | 28 ++++++++++++ .../NullLiteral_typeOfExpression.ets | 29 ++++++++++++ .../NullLiteral_typeParameters.ets | 31 +++++++++++++ .../NullLiteral_unaryExpression.ets | 35 +++++++++++++++ .../NullLiteral/NullLiteral_unionType.ets | 28 ++++++++++++ .../NullLiteral_variableDeclarations.ets | 28 ++++++++++++ .../NullLiteral_whileStatement.ets | 32 +++++++++++++ .../StringLiteral_MultilineStringLiteral.ets | 33 ++++++++++++++ .../StringLiteral_NullLiteral.ets | 32 +++++++++++++ .../StringLiteral_UndefinedLiteral.ets | 32 +++++++++++++ .../StringLiteral_additiveExpression.ets | 30 +++++++++++++ .../StringLiteral_annotationDeclaration.ets | 31 +++++++++++++ .../StringLiteral_arrayLiteral.ets | 29 ++++++++++++ .../StringLiteral/StringLiteral_arrayType.ets | 29 ++++++++++++ .../StringLiteral_assignmentExpression.ets | 29 ++++++++++++ .../StringLiteral_awaitExpression.ets | 33 ++++++++++++++ .../StringLiteral_classInitializer.ets | 36 +++++++++++++++ ...StringLiteral_conditionalAndExpression.ets | 29 ++++++++++++ .../StringLiteral_conditionalExpression.ets | 29 ++++++++++++ .../StringLiteral_conditionalOrExpression.ets | 29 ++++++++++++ .../StringLiteral_constantDeclarations.ets | 29 ++++++++++++ .../StringLiteral_constantExpression.ets | 29 ++++++++++++ ...ringLiteral_ensureNotNullishExpression.ets | 30 +++++++++++++ .../StringLiteral_equalityExpression.ets | 29 ++++++++++++ .../StringLiteral_expression.ets | 43 ++++++++++++++++++ .../StringLiteral_fieldAccessExpression.ets | 34 ++++++++++++++ .../StringLiteral_finallyClause.ets | 43 ++++++++++++++++++ .../StringLiteral_forOfStatement.ets | 33 ++++++++++++++ .../StringLiteral_forStatement.ets | 34 ++++++++++++++ .../StringLiteral_functionCallExpression.ets | 33 ++++++++++++++ .../StringLiteral_functionType.ets | 31 +++++++++++++ .../StringLiteral_ifStatement.ets | 32 +++++++++++++ .../StringLiteral_indexingExpression.ets | 30 +++++++++++++ .../StringLiteral_initializerBlock.ets | 33 ++++++++++++++ .../StringLiteral_instanceOfExpression.ets | 29 ++++++++++++ .../StringLiteral_lambdaExpression.ets | 31 +++++++++++++ ...ngLiteral_lambdaExpressionWithReceiver.ets | 32 +++++++++++++ .../StringLiteral_loopStatement.ets | 35 +++++++++++++++ .../StringLiteral_methodCallExpression.ets | 37 +++++++++++++++ .../StringLiteral_namespaceDeclaration.ets | 32 +++++++++++++ .../StringLiteral_newArrayInstance.ets | 30 +++++++++++++ .../StringLiteral_newExpression.ets | 34 ++++++++++++++ ...ingLiteral_nullishCoalescingExpression.ets | 29 ++++++++++++ .../StringLiteral_objectLiteral.ets | 32 +++++++++++++ .../StringLiteral_objectReference.ets | 31 +++++++++++++ .../StringLiteral_optionalParameter.ets | 30 +++++++++++++ .../StringLiteral_parameterList.ets | 32 +++++++++++++ .../StringLiteral_parenthesizedExpression.ets | 29 ++++++++++++ .../StringLiteral_recordLiteral.ets | 32 +++++++++++++ .../StringLiteral_relationalExpression.ets | 32 +++++++++++++ .../StringLiteral_restParameter.ets | 31 +++++++++++++ .../StringLiteral_returnStatement.ets | 31 +++++++++++++ ...tringLiteral_separateModuleDeclaration.ets | 31 +++++++++++++ .../StringLiteral/StringLiteral_signature.ets | 31 +++++++++++++ .../StringLiteral_spreadExpression.ets | 32 +++++++++++++ .../StringLiteral/StringLiteral_statement.ets | 39 ++++++++++++++++ .../StringLiteral_stringInterpolation.ets | 30 +++++++++++++ .../StringLiteral_switchStatement.ets | 32 +++++++++++++ .../StringLiteral_thisExpression.ets | 34 ++++++++++++++ .../StringLiteral_throwStatement.ets | 29 ++++++++++++ .../StringLiteral_topDeclaration.ets | 38 ++++++++++++++++ .../StringLiteral_topLevelStatements.ets | 29 ++++++++++++ .../StringLiteral_trailingLambdaCall.ets | 40 +++++++++++++++++ .../StringLiteral_tryStatement.ets | 36 +++++++++++++++ .../StringLiteral/StringLiteral_tupleType.ets | 29 ++++++++++++ .../StringLiteral/StringLiteral_typeAlias.ets | 29 ++++++++++++ .../StringLiteral_typeArguments.ets | 29 ++++++++++++ .../StringLiteral_typeOfExpression.ets | 30 +++++++++++++ .../StringLiteral_typeParameters.ets | 32 +++++++++++++ .../StringLiteral_unaryExpression.ets | 36 +++++++++++++++ .../StringLiteral/StringLiteral_unionType.ets | 29 ++++++++++++ .../StringLiteral_variableDeclarations.ets | 29 ++++++++++++ .../StringLiteral_whileStatement.ets | 34 ++++++++++++++ 191 files changed, 6180 insertions(+) create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_BooleanLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_FloatLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_MultilineStringLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_StringLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_UndefinedLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_additiveExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_annotationDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_annotationUsage.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_arrayLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_arrayType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_assignmentExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_awaitExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_bitwiseAndLogicalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_classInitializer.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_conditionalAndExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_conditionalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_conditionalOrExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_constantDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_constantExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_ensureNotNullishExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_equalityExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_expression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_fieldAccessExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_finallyClause.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_forOfStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_forStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_functionCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_ifStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_indexingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_initializerBlock.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_lambdaExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_lambdaExpressionWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_loopStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_methodCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_multiplicativeExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_namespaceDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_newArrayInstance.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_newExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_nullishCoalescingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_objectLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_objectReference.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_optionalParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_parameterList.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_parenthesizedExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_recordLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_relationalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_restParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_returnStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_separateModuleDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_shiftExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_signature.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_spreadExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_statement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_switchStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_thisExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_topDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_topLevelStatements.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_trailingLambdaCall.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_tryStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_tupleType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_typeOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_typeParameters.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_unaryExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_unionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_variableDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_whileStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_UndefinedLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_arrayLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_arrayType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_assignmentExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_awaitExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_classInitializer.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_conditionalAndExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_conditionalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_conditionalOrExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_constantDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_constantExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_ensureNotNullishExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_equalityExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_expression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_fieldAccessExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_finallyClause.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_forOfStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_forStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_functionCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_functionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_ifStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_indexingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_initializerBlock.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_instanceOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_lambdaExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_lambdaExpressionWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_loopStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_methodCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_namespaceDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_newArrayInstance.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_newExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_nullishCoalescingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_objectLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_objectReference.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_optionalParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_parameterList.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_parenthesizedExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_restParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_returnStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_separateModuleDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_signature.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_spreadExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_statement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_stringInterpolation.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_thisExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_throwStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_topDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_topLevelStatements.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_trailingLambdaCall.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_tryStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_tupleType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeAlias.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeArguments.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeParameters.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_unaryExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_unionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_variableDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_whileStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_MultilineStringLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_NullLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_UndefinedLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_additiveExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_annotationDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_arrayLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_arrayType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_assignmentExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_awaitExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_classInitializer.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_conditionalAndExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_conditionalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_conditionalOrExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_constantDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_constantExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_ensureNotNullishExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_equalityExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_expression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_fieldAccessExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_finallyClause.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_forOfStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_forStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_functionCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_functionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_ifStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_indexingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_initializerBlock.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_instanceOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_lambdaExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_lambdaExpressionWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_loopStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_methodCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_namespaceDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_newArrayInstance.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_newExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_nullishCoalescingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_objectLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_objectReference.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_optionalParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_parameterList.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_parenthesizedExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_recordLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_relationalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_restParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_returnStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_separateModuleDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_signature.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_spreadExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_statement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_stringInterpolation.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_switchStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_thisExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_throwStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_topDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_topLevelStatements.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_trailingLambdaCall.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_tryStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_tupleType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeAlias.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeArguments.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeParameters.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_unaryExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_unionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_variableDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_whileStatement.ets diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_BooleanLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_BooleanLiteral.ets new file mode 100644 index 0000000000..f231a75cdb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_BooleanLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + */ + +1 && false; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_FloatLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_FloatLiteral.ets new file mode 100644 index 0000000000..e0f65736da --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_FloatLiteral.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 2.9.3 + * FloatLiteral: + * DecimalIntegerLiteral'.' FractionalPart? ExponentPart?FloatTypeSuffix? + * |'.'FractionalPart ExponentPart? FloatTypeSuffix? + * | DecimalIntegerLiteral ExponentPart FloatTypeSuffix? + * ; + */ + +2 + 3.14; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_MultilineStringLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_MultilineStringLiteral.ets new file mode 100644 index 0000000000..20837920cb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_MultilineStringLiteral.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + */ + +let mulStr = `This is a +multi-line string literal.`; +let f = 1; + +let result = 1 + mulStr; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_StringLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_StringLiteral.ets new file mode 100644 index 0000000000..3982f43d2f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_StringLiteral.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter * '\'' + * ; + */ + +let num = 1; +let str = "abc"; + +let result = num + str; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_UndefinedLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_UndefinedLiteral.ets new file mode 100644 index 0000000000..c8dfc15d69 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_UndefinedLiteral.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + */ + +let und = undefined; +let flo = 20; + +let result = flo && und; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_additiveExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_additiveExpression.ets new file mode 100644 index 0000000000..94e9bc6d9c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_additiveExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.22 + * additiveExpression: + * expression '+' expression + * | expression '-' expression + * ; + */ + +3 + 2; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_annotationDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_annotationDeclaration.ets new file mode 100644 index 0000000000..e96467cbb3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_annotationDeclaration.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 18.1 + * annotationDeclaration: + * '@interface' identifier '{' annotationField* '}' + * ; + */ + +@interface test { + value: number = 10; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_annotationUsage.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_annotationUsage.ets new file mode 100644 index 0000000000..185a2b9971 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_annotationUsage.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 18.2 + * annotationUsage: + * 'at' qualifiedName annotationValues? + * ; + */ + +@interface DetailedAnnotation { + authorAge: number; +} +@DetailedAnnotation({ + authorAge: 22, +}) +class DocumentedClass {}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_arrayLiteral.ets new file mode 100644 index 0000000000..1742ebb08d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_arrayLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let x5 = [1, 2, 3]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_arrayType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_arrayType.ets new file mode 100644 index 0000000000..06fb4351e0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_arrayType.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 3.17.1 + * arrayType: + * type '[' ']' + * ; + */ + +let arr: number[] = [10, 11]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_assignmentExpression.ets new file mode 100644 index 0000000000..6b8292c55f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_assignmentExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + */ + +let a = 5; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_awaitExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_awaitExpression.ets new file mode 100644 index 0000000000..818883189e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_awaitExpression.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 17.16.2 + * awaitExpression: + * 'await' expression + * ; + */ + +async function foo(name: number): Promise { + return Promise.resolve(2); +} + +await foo(2); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_bitwiseAndLogicalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_bitwiseAndLogicalExpression.ets new file mode 100644 index 0000000000..0947e31348 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_bitwiseAndLogicalExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.26 + * bitwiseAndLogicalExpression: + * expression '&' expression + * | expression '^' expression + * | expression '|' expression + * ; + */ + +5 & 3; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_classInitializer.ets new file mode 100644 index 0000000000..e6c60c16aa --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_classInitializer.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class ExampleClass1 { + static initialized = 1; + static initializerBlock() { + if (!ExampleClass1.initialized) { + ExampleClass1.initialized = 1; + } + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_conditionalAndExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_conditionalAndExpression.ets new file mode 100644 index 0000000000..84baeb6b1c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_conditionalAndExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.27 + * conditionalAndExpression: + * expression '&&' expression + * ; + */ + +1 && 1; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_conditionalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_conditionalExpression.ets new file mode 100644 index 0000000000..203461e214 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_conditionalExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.30 + * conditionalExpression: + * expression '?' expression ':' expression + * ; + */ + +(7 > 5) ? 7 : 5; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_conditionalOrExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_conditionalOrExpression.ets new file mode 100644 index 0000000000..17dc34f1a2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_conditionalOrExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.28 + * conditionalOrExpression: + * expression '||' expression + * ; + */ + +1 || 1; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_constantDeclarations.ets new file mode 100644 index 0000000000..dffafaebc2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_constantDeclarations.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const c: number = 1; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_constantExpression.ets new file mode 100644 index 0000000000..5f35050a55 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_constantExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const PI = 3; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_ensureNotNullishExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_ensureNotNullishExpression.ets new file mode 100644 index 0000000000..ca2234f561 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_ensureNotNullishExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.18 + * ensureNotNullishExpression: + * expression '!' + * ; + */ + +1!; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_equalityExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_equalityExpression.ets new file mode 100644 index 0000000000..e9e015b6b2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_equalityExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.25 + * equalityExpression: + * expression ('==' | '===' | '!=' | '!==') expression + * ; + */ + +5 == 5; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_expression.ets new file mode 100644 index 0000000000..023d33b6c6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_expression.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +const PI = 3; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_fieldAccessExpression.ets new file mode 100644 index 0000000000..3e37d1b077 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_fieldAccessExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person1 { + age: number = 1; +} + +let person = new Person1(); +person.age = 1; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_finallyClause.ets new file mode 100644 index 0000000000..e84ef1a2a2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_finallyClause.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +function processOne(a: number): number { + try { + const res = 1; + return res; + } catch (error) { + return -1; + } finally { + let res1 = 1; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_forOfStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_forOfStatement.ets new file mode 100644 index 0000000000..271edae982 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_forOfStatement.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 8.9 + * forOfStatement: + * 'for' '(' forVariable 'of' expression ')' statement + * ; + */ + +let arr = [1, 2, 3]; +let item: number = 1; +for (item of arr) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_forStatement.ets new file mode 100644 index 0000000000..8bbbf3ad55 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_forStatement.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +let i: number = 1; +for (; i < 10; i++) { + if (true) { + break; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_functionCallExpression.ets new file mode 100644 index 0000000000..7a7c3a6da7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_functionCallExpression.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ('?.' | typeArguments)? arguments block? + * ; + */ + +function func1(x: number): number { + return 0; +} + +func1(1); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_ifStatement.ets new file mode 100644 index 0000000000..6d7d2d74fe --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_ifStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if (3 < 5) { + console.log("true"); +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_indexingExpression.ets new file mode 100644 index 0000000000..f368d062b1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_indexingExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.12 + * indexingExpression : + * expression ('?.')? '[' expression ']' + * ; + */ + +let numbers = [1, 2, 3, 4, 5]; +numbers[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_initializerBlock.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_initializerBlock.ets new file mode 100644 index 0000000000..d6d68ea52a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_initializerBlock.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 15.10 + * initializerBlock: + * 'static' block + * ; + */ + +class Test { + static initializerBlock() { + let sum = 1 + 2 ; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_lambdaExpression.ets new file mode 100644 index 0000000000..61e91cf982 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_lambdaExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +let result = async (x: int): Promise => { + return 0; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000..3644737e2a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_lambdaExpressionWithReceiver.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result4 = (this: A): number => { return 0; }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_loopStatement.ets new file mode 100644 index 0000000000..5ced19f12c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_loopStatement.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while(3 < 5) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_methodCallExpression.ets new file mode 100644 index 0000000000..9a51ebb54f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_methodCallExpression.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class Person2 { + age: number = 1; + setName(age: number): void { + this.age = age; + } +} + +let person = new Person2(); +person.setName(2); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_multiplicativeExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_multiplicativeExpression.ets new file mode 100644 index 0000000000..03570bf3f4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_multiplicativeExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.21 + * multiplicativeExpression: + * expression '*' expression + * | expression '/' expression + * | expression '%' expressionc + * ; + */ + +3 * 4; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_namespaceDeclaration.ets new file mode 100644 index 0000000000..fd1ea03f83 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_namespaceDeclaration.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace NS1 { + export let variable = 1234; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_newArrayInstance.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_newArrayInstance.ets new file mode 100644 index 0000000000..2ce99a5e24 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_newArrayInstance.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 17.3 + * newArrayInstance: + * 'new' arrayElementType dimensionExpression+ (arrayElement)? + * ; + */ + +let a = new string[1]; +a[0] = "a"; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_newExpression.ets new file mode 100644 index 0000000000..3538a72168 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_newExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class D { + constructor(p: number) {} +} + +new D(5); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_nullishCoalescingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_nullishCoalescingExpression.ets new file mode 100644 index 0000000000..f3818dc52a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_nullishCoalescingExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.19 + * nullishCoalescingExpression: + * expression '??' expression + * ; + */ + +null ?? 42; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_objectLiteral.ets new file mode 100644 index 0000000000..9bd094c09b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_objectLiteral.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + name: string = "NAME"; + age: number = 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_objectReference.ets new file mode 100644 index 0000000000..175c7b56c7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_objectReference.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +let a: number = 1; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_optionalParameter.ets new file mode 100644 index 0000000000..a31608d277 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_optionalParameter.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier '?' ':' type + * ; + */ + +function pair(x: number, y: number = 7) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_parameterList.ets new file mode 100644 index 0000000000..e6835d32e8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_parameterList.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function func1(x: number, y: string): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_parenthesizedExpression.ets new file mode 100644 index 0000000000..9fe63fae9d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_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 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +let y6 = (5 + 3); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_recordLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_recordLiteral.ets new file mode 100644 index 0000000000..022e56f629 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_recordLiteral.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.5.3 + * recordLiteral: + * '{' keyValueSequence? '}' + * ; + */ + +let map: Record = { + "John": 25, + "Mary": 21, +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_relationalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_relationalExpression.ets new file mode 100644 index 0000000000..8f60e168e0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_relationalExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.24 + * relationalExpression: + * expression '<' expression + * | expression '>' expression + * | expression '<=' expression + * | expression '>=' expression + * ; + */ + +5 < 10; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_restParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_restParameter.ets new file mode 100644 index 0000000000..0a0f152f18 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_restParameter.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 4.8.5 + * restParameter: + * annotationUsage? '...' identifier ':' type + * ; + */ + +function sum(...numbers: number[]): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_returnStatement.ets new file mode 100644 index 0000000000..adf5823fd6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_returnStatement.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add(number1: number, number2: number) { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_separateModuleDeclaration.ets new file mode 100644 index 0000000000..f3d2b629b7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_separateModuleDeclaration.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +let v2 = 2 + 3 * 4; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_shiftExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_shiftExpression.ets new file mode 100644 index 0000000000..deefb39507 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_shiftExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.23 + * shiftExpression: + * expression '<<' expression + * | expression '>>' expression + * | expression '>>>' expression + * ; + */ + +5 << 10; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_signature.ets new file mode 100644 index 0000000000..f9083c1850 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_signature.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function func1(x: number): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_spreadExpression.ets new file mode 100644 index 0000000000..85e5c7e697 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_spreadExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + *Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let array1 = [1, 2, 3]; +let array2 = [4, 5]; +let array3 = [...array1, ...array2]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_statement.ets new file mode 100644 index 0000000000..8c589ca7f4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_statement.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throw Statement + * | tryStatement + * ; + */ + +let x = 10; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_switchStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_switchStatement.ets new file mode 100644 index 0000000000..258ffd0277 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_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 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 8.13 + * switchStatement: + * (identifier ':')? 'switch' '(' expression ')' switchBlock + * ; + */ + +let x = 10; +switch (x) { + case 1: break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_thisExpression.ets new file mode 100644 index 0000000000..12922125a6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_thisExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class ThisExample { + public field: number; + constructor() { + this.field = 1; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_topDeclaration.ets new file mode 100644 index 0000000000..74866464f9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_topDeclaration.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +let v2 = 2 + 3 * 4; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_topLevelStatements.ets new file mode 100644 index 0000000000..55acebe35e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_topLevelStatements.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement * + * ; + */ + +let a: number = 56; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_trailingLambdaCall.ets new file mode 100644 index 0000000000..25473c74e3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_trailingLambdaCall.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + methodTwo(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.methodTwo(1) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_tryStatement.ets new file mode 100644 index 0000000000..fd5afa666c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_tryStatement.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processOne(a: number): number { + try { + const res = 1; + return res; + } catch (error) { + return -1; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_tupleType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_tupleType.ets new file mode 100644 index 0000000000..1ced1036cf --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_tupleType.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + */ + +let tup: [string, number, boolean, number] = ['s', 1, true, 10]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_typeOfExpression.ets new file mode 100644 index 0000000000..0c9e12c22e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_typeOfExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let s: number = 1; +typeof s; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_typeParameters.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_typeParameters.ets new file mode 100644 index 0000000000..640d1e4b2f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_typeParameters.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 5.1 + * typeParameters: + * '<' typeParameterList '>' + * ; + */ + +class C1 { + public a: number = 1; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_unaryExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_unaryExpression.ets new file mode 100644 index 0000000000..525ce12e10 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_unaryExpression.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 7.20 + * unaryExpression: + * expression '++' + * | expression '--' + * | '++' expression + * | '--' expression + * | '+' expression + * | '-' expression + * | '~' expression + * | '!' expression + * ; + */ + +!3; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_unionType.ets new file mode 100644 index 0000000000..fa93b7b40a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_unionType.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let u: string | number = 1; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_variableDeclarations.ets new file mode 100644 index 0000000000..1bd12409a2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_variableDeclarations.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let v: number = 1; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_whileStatement.ets new file mode 100644 index 0000000000..dc1bb48536 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/IntegerLiteral/IntegerLiteral_whileStatement.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.2 + * IntegerLiteral: + * DecimalIntegerLiteral + * | HexIntegerLiteral + * | OctalIntegerLiteral + * | BinaryIntegerLiteral + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +let m = 5; +let n = 3; +while(m < n) { + m--; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_UndefinedLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_UndefinedLiteral.ets new file mode 100644 index 0000000000..b7b05d2a43 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_UndefinedLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + */ + +let und = undefined; +let nul = null; + +console.info('und '+ und + ' null '+ nul) diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_arrayLiteral.ets new file mode 100644 index 0000000000..dfc950b065 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_arrayLiteral.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let x5 = ['1', null, null]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_arrayType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_arrayType.ets new file mode 100644 index 0000000000..b62eda7bb4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_arrayType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 3.17.1 + * arrayType: + * type '[' ']' + * ; + */ + +let arr: null[] = [null, null]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_assignmentExpression.ets new file mode 100644 index 0000000000..8cae0a1d68 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_assignmentExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + */ + +let a = null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_awaitExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_awaitExpression.ets new file mode 100644 index 0000000000..e13fd3cf92 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_awaitExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 17.16.2 + * awaitExpression: + * 'await' expression + * ; + */ + +async function foo(name: null): Promise { + return Promise.resolve(2.1); +} + +await foo(null); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_classInitializer.ets new file mode 100644 index 0000000000..12773e3567 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_classInitializer.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class ExampleClass1 { + static initialized = null; + static initializerBlock() { + if (ExampleClass1.initialized == null) { + ExampleClass1.initialized = null; + } + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_conditionalAndExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_conditionalAndExpression.ets new file mode 100644 index 0000000000..b1f8edb7a4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_conditionalAndExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.27 + * conditionalAndExpression: + * expression '&&' expression + * ; + */ + +null && null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_conditionalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_conditionalExpression.ets new file mode 100644 index 0000000000..d741159310 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_conditionalExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.30 + * conditionalExpression: + * expression '?' expression ':' expression + * ; + */ + +('7' > '5') ? null : '5'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_conditionalOrExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_conditionalOrExpression.ets new file mode 100644 index 0000000000..9d9310a334 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_conditionalOrExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.28 + * conditionalOrExpression: + * expression '||' expression + * ; + */ + +null || null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_constantDeclarations.ets new file mode 100644 index 0000000000..755d9af733 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_constantDeclarations.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const c: null = null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_constantExpression.ets new file mode 100644 index 0000000000..43dab1e39f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_constantExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const str = null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_ensureNotNullishExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_ensureNotNullishExpression.ets new file mode 100644 index 0000000000..59a994cb7f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_ensureNotNullishExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.18 + * ensureNotNullishExpression: + * expression '!' + * ; + */ + +let value: null[] = [null]; +value!.length; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_equalityExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_equalityExpression.ets new file mode 100644 index 0000000000..aef0034f3e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_equalityExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.25 + * equalityExpression: + * expression ('==' | '===' | '!=' | '!==') expression + * ; + */ + +null == null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_expression.ets new file mode 100644 index 0000000000..d598d292a2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_expression.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +const cat: null = null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_fieldAccessExpression.ets new file mode 100644 index 0000000000..47a2c07277 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_fieldAccessExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person1 { + name: null = null; +} + +let person = new Person1(); +person.name = null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_finallyClause.ets new file mode 100644 index 0000000000..4ac307d2ab --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_finallyClause.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +class A { + close() {} +} + +function processOne(): null { + let r = new A(); + try { + const res = null; + return res; + } catch (error) { + return null; + } finally { + r.close() + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_forOfStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_forOfStatement.ets new file mode 100644 index 0000000000..6b973f710d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_forOfStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 8.9 + * forOfStatement: + * 'for' '(' forVariable 'of' expression ')' statement + * ; + */ + +let arr = [null, null]; +let item: null = null; +for (item of arr) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_forStatement.ets new file mode 100644 index 0000000000..4cda9b492a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_forStatement.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +let i: null = null; +for (; i != null; i = null) { + if (true) { + break; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_functionCallExpression.ets new file mode 100644 index 0000000000..e8ed755ccf --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_functionCallExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ('?.' | typeArguments)? arguments block? + * ; + */ + +function func1(x: null): number { + return 0; +} + +func1(null); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_functionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_functionType.ets new file mode 100644 index 0000000000..f159933626 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_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 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 3.19 + * functionType: + * '(' ftParameterList? ')' ftReturnType + * ; + */ + +type t = () => null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_ifStatement.ets new file mode 100644 index 0000000000..dae78f2d86 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_ifStatement.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if (null) { + console.log("null"); +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_indexingExpression.ets new file mode 100644 index 0000000000..fda8d7b0ac --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_indexingExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +let strings = [null, '2', '3', null, '5']; +strings[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_initializerBlock.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_initializerBlock.ets new file mode 100644 index 0000000000..d62762a5cb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_initializerBlock.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 15.10 + * initializerBlock: + * 'static' block + * ; + */ + +class Test { + static initializerBlock() { + let sum = null ; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_instanceOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_instanceOfExpression.ets new file mode 100644 index 0000000000..a4f4ea6f83 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_instanceOfExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.16 + * instanceOfExpression: + * expression 'instanceof' type + * ; + */ + +null instanceof null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_lambdaExpression.ets new file mode 100644 index 0000000000..fdbfbec9ff --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_lambdaExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +let result = async (x: null): Promise => { + return x; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000..42f04ecc9b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_lambdaExpressionWithReceiver.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result4 = (this: A): null => { return null; }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_loopStatement.ets new file mode 100644 index 0000000000..c0e031af32 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_loopStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while(null) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_methodCallExpression.ets new file mode 100644 index 0000000000..a46eaac301 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_methodCallExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class Person2 { + name: null = null; + setName(name: null): void { + this.name = name; + } +} + +let person = new Person2(); +person.setName(null); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_namespaceDeclaration.ets new file mode 100644 index 0000000000..b36fbd02c4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_namespaceDeclaration.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace NS1 { + let a: null; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_newArrayInstance.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_newArrayInstance.ets new file mode 100644 index 0000000000..fdba607e1f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_newArrayInstance.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 17.3 + * newArrayInstance: + * 'new' arrayElementType dimensionExpression+ (arrayElement)? + * ; + */ + +const arr: null[] = []; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_newExpression.ets new file mode 100644 index 0000000000..c0100c8fcf --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_newExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class D { + constructor(p: null) {} +} + +new D(null); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_nullishCoalescingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_nullishCoalescingExpression.ets new file mode 100644 index 0000000000..e81762817e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_nullishCoalescingExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.19 + * nullishCoalescingExpression: + * expression '??' expression + * ; + */ + +null ?? 42; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_objectLiteral.ets new file mode 100644 index 0000000000..2254b5fab1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_objectLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + name: null = null; + age: null = null; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_objectReference.ets new file mode 100644 index 0000000000..dd8ed0a2c0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_objectReference.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +let a: null = null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_optionalParameter.ets new file mode 100644 index 0000000000..8345ef730f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_optionalParameter.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier '?' ':' type + * ; + */ + +function pair(x: null, y: null = null) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_parameterList.ets new file mode 100644 index 0000000000..fce9f01217 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_parameterList.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function func1(x: null, y: null): null { + return null; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_parenthesizedExpression.ets new file mode 100644 index 0000000000..8c238b77dd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_parenthesizedExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +let y6 = (null); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_restParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_restParameter.ets new file mode 100644 index 0000000000..e912371272 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_restParameter.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 4.8.5 + * restParameter: + * annotationUsage? '...' identifier ':' type + * ; + */ + +function sum(...aaa: null[]): null { + return null; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_returnStatement.ets new file mode 100644 index 0000000000..922428f687 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_returnStatement.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add(null1: null, null2: null) { + return null1; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_separateModuleDeclaration.ets new file mode 100644 index 0000000000..5cafb72093 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_separateModuleDeclaration.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +interface MyInterface { + doSomething(): null +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_signature.ets new file mode 100644 index 0000000000..d68c0aa582 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_signature.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function func1(x: null): null { + return null; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_spreadExpression.ets new file mode 100644 index 0000000000..2a2271900e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_spreadExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + *Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let array1 = [null, '2', '3']; +let array2 = ['4', null]; +let array3 = [...array1, ...array2]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_statement.ets new file mode 100644 index 0000000000..0d96002da3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_statement.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throw Statement + * | tryStatement + * ; + */ + +let x = null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_stringInterpolation.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_stringInterpolation.ets new file mode 100644 index 0000000000..9d3ac563f5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_stringInterpolation.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.31 + * stringInterpolation: + * ' ` ' (BacktickCharacter | embeddedExpression)* ' ` ' + * ; + */ + +let name = null; +`Hello, my name is ${name}.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_thisExpression.ets new file mode 100644 index 0000000000..37cd748d2f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_thisExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class ThisExample { + public field: null; + constructor() { + this.field = null; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_throwStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_throwStatement.ets new file mode 100644 index 0000000000..cb7ea82f69 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_throwStatement.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 8.14 + * throwStatement: + * 'throw' expression + * ; + */ + +throw new Error("null " + null); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_topDeclaration.ets new file mode 100644 index 0000000000..fe5d1dae4f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_topDeclaration.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +export let x: null[], y: null diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_topLevelStatements.ets new file mode 100644 index 0000000000..26b92edde6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_topLevelStatements.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement * + * ; + */ + +let a: null = null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_trailingLambdaCall.ets new file mode 100644 index 0000000000..6659c48ca2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_trailingLambdaCall.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + methodTwo(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.methodTwo(null) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_tryStatement.ets new file mode 100644 index 0000000000..3b361c6110 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_tryStatement.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processOne(): null { + try { + const res = null; + return res; + } catch (error) { + return null; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_tupleType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_tupleType.ets new file mode 100644 index 0000000000..c5bc3ac2b6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_tupleType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + */ + +let tup: [null, number, boolean, string] = [null, 1, true, '10']; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeAlias.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeAlias.ets new file mode 100644 index 0000000000..718886eb59 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_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 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 4.6.1 + * typeAlias: + * 'type' identifier typeParameters? '=' type + * ; + */ + +let a: null | number = null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeArguments.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeArguments.ets new file mode 100644 index 0000000000..10d6a6b82a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeArguments.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 5.2.1 + * typeArguments: + * '<' type(','type)* '>' + * ; + */ + +let a: Array<[number, null, boolean]>; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeOfExpression.ets new file mode 100644 index 0000000000..aa3d71fcb0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeOfExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let s: null = null; +typeof null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeParameters.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeParameters.ets new file mode 100644 index 0000000000..d4300cb4e9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_typeParameters.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 5.1 + * typeParameters: + * '<' typeParameterList '>' + * ; + */ + +type nul = null | 'warn' | 'error'; +class C1 { + public a: null = null; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_unaryExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_unaryExpression.ets new file mode 100644 index 0000000000..1c3ba5516a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_unaryExpression.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 7.20 + * unaryExpression: + * expression '++' + * | expression '--' + * | '++' expression + * | '--' expression + * | '+' expression + * | '-' expression + * | '~' expression + * | '!' expression + * ; + */ + +!null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_unionType.ets new file mode 100644 index 0000000000..0b65fe417f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_unionType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let u: null | number = null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_variableDeclarations.ets new file mode 100644 index 0000000000..1f5678fca8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_variableDeclarations.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let v: null = null; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_whileStatement.ets new file mode 100644 index 0000000000..3beb6526a1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/NullLiteral/NullLiteral_whileStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +let m = null; +let n = null; +while(m) { + m = n; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_MultilineStringLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_MultilineStringLiteral.ets new file mode 100644 index 0000000000..aaa2da7d6b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_MultilineStringLiteral.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + */ + +let mulStr = `This is a +multi-line string literal.`; +let str = "This is a string literal."; + +let result = str + mulStr; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_NullLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_NullLiteral.ets new file mode 100644 index 0000000000..1de4b89733 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_NullLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + */ + +let n = null; +let str = "This is a string literal."; + +let result = str + n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_UndefinedLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_UndefinedLiteral.ets new file mode 100644 index 0000000000..50061a92e7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_UndefinedLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + */ + +let und = undefined; +let str = "This is a string literal."; + +let result = str + und; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_additiveExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_additiveExpression.ets new file mode 100644 index 0000000000..9da9fe00f0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_additiveExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.22 + * additiveExpression: + * expression '+' expression + * | expression '-' expression + * ; + */ + +'string1' + 'string2'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_annotationDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_annotationDeclaration.ets new file mode 100644 index 0000000000..a9fa8e9eaf --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_annotationDeclaration.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 18.1 + * annotationDeclaration: + * '@interface' identifier '{' annotationField* '}' + * ; + */ + +@interface str { + value: string = '10'; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_arrayLiteral.ets new file mode 100644 index 0000000000..3d9cb42d69 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_arrayLiteral.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let x5 = ['1', '2', '3']; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_arrayType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_arrayType.ets new file mode 100644 index 0000000000..d86944bed2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_arrayType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 3.17.1 + * arrayType: + * type '[' ']' + * ; + */ + +let arr: string[] = ['10', '11']; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_assignmentExpression.ets new file mode 100644 index 0000000000..56bcf310f1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_assignmentExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + */ + +let a = '5'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_awaitExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_awaitExpression.ets new file mode 100644 index 0000000000..6541a477d4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_awaitExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 17.16.2 + * awaitExpression: + * 'await' expression + * ; + */ + +async function foo(name: string): Promise { + return Promise.resolve(2); +} + +await foo("ggb"); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_classInitializer.ets new file mode 100644 index 0000000000..40d2951ace --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_classInitializer.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class ExampleClass1 { + static initialized = 'false'; + static initializerBlock() { + if (ExampleClass1.initialized == 'false') { + ExampleClass1.initialized = 'true'; + } + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_conditionalAndExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_conditionalAndExpression.ets new file mode 100644 index 0000000000..75a6c3a02d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_conditionalAndExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.27 + * conditionalAndExpression: + * expression '&&' expression + * ; + */ + +'true' && 'true'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_conditionalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_conditionalExpression.ets new file mode 100644 index 0000000000..99c91142a8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_conditionalExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.30 + * conditionalExpression: + * expression '?' expression ':' expression + * ; + */ + +('7' > '5') ? '7' : '5'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_conditionalOrExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_conditionalOrExpression.ets new file mode 100644 index 0000000000..2109da13b0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_conditionalOrExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.28 + * conditionalOrExpression: + * expression '||' expression + * ; + */ + +'true' || 'false'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_constantDeclarations.ets new file mode 100644 index 0000000000..a13955b601 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_constantDeclarations.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const c: string = '1'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_constantExpression.ets new file mode 100644 index 0000000000..c6874ca749 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_constantExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const str = 'string'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_ensureNotNullishExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_ensureNotNullishExpression.ets new file mode 100644 index 0000000000..c0574f2d53 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_ensureNotNullishExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.18 + * ensureNotNullishExpression: + * expression '!' + * ; + */ + +let name: string = 'Alice'; +name!; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_equalityExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_equalityExpression.ets new file mode 100644 index 0000000000..ac37da5cdf --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_equalityExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.25 + * equalityExpression: + * expression ('==' | '===' | '!=' | '!==') expression + * ; + */ + +'5' == '5'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_expression.ets new file mode 100644 index 0000000000..8b368b9835 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_expression.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +const cat: string = 'cat'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_fieldAccessExpression.ets new file mode 100644 index 0000000000..f9285dc0a1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_fieldAccessExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person1 { + name: string = 'Alice'; +} + +let person = new Person1(); +person.name = 'Bob'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_finallyClause.ets new file mode 100644 index 0000000000..6b7b2247a0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_finallyClause.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +class A { + close() {} +} + +function processOne(): string { + let r = new A(); + try { + const res = '1'; + return res; + } catch (error) { + return '-1'; + } finally { + r.close(); + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_forOfStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_forOfStatement.ets new file mode 100644 index 0000000000..671f95dfcf --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_forOfStatement.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 8.9 + * forOfStatement: + * 'for' '(' forVariable 'of' expression ')' statement + * ; + */ + +let arr = ['1', '2', '3']; +let item: string = '1'; +for (item of arr) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_forStatement.ets new file mode 100644 index 0000000000..87d7b59edc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_forStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +let a = 'Hello123World'; +for (let i = 0; i < a.length; i++) { + if (true) { + break; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_functionCallExpression.ets new file mode 100644 index 0000000000..1ae83768b6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_functionCallExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ('?.' | typeArguments)? arguments block? + * ; + */ + +function func1(x: string): number { + return 0; +} + +func1('1'); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_functionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_functionType.ets new file mode 100644 index 0000000000..da65bd02a5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_functionType.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 3.19 + * functionType: + * '(' ftParameterList? ')' ftReturnType + * ; + */ + +type AllowedAction = "uppercase" | "lowercase" | "reverse"; + +type StringProcessor = (input: string, action: AllowedAction) => string; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_ifStatement.ets new file mode 100644 index 0000000000..9149f4e540 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_ifStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if ('true') { + console.log("true"); +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_indexingExpression.ets new file mode 100644 index 0000000000..dc543f2bbe --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_indexingExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +let strings = ['1', '2', '3', '4', '5']; +strings[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_initializerBlock.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_initializerBlock.ets new file mode 100644 index 0000000000..ab9d08f4b1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_initializerBlock.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 15.10 + * initializerBlock: + * 'static' block + * ; + */ + +class Test { + static initializerBlock() { + let sum = '1' + '2' ; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_instanceOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_instanceOfExpression.ets new file mode 100644 index 0000000000..caaf741340 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_instanceOfExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.16 + * instanceOfExpression: + * expression 'instanceof' type + * ; + */ + +"string" instanceof string; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_lambdaExpression.ets new file mode 100644 index 0000000000..07bafdd26e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_lambdaExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +let result = async (x: string, y: string, z?: string): Promise => { + return x + y + z; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000..1a78d05290 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_lambdaExpressionWithReceiver.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result4 = (this: A): string => { return 'string'; }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_loopStatement.ets new file mode 100644 index 0000000000..1728c9c663 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_loopStatement.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while('true') { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_methodCallExpression.ets new file mode 100644 index 0000000000..ff0628c3de --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_methodCallExpression.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class Person2 { + name: string = 'Alice'; + setName(name: string): void { + this.name = name; + } +} + +let person = new Person2(); +person.setName('Bob'); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_namespaceDeclaration.ets new file mode 100644 index 0000000000..9ea98ce8d9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_namespaceDeclaration.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace NS1 { + let a: string; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_newArrayInstance.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_newArrayInstance.ets new file mode 100644 index 0000000000..fe3700cd72 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_newArrayInstance.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 17.3 + * newArrayInstance: + * 'new' arrayElementType dimensionExpression+ (arrayElement)? + * ; + */ + +let a = new string[1]; +a[0] = "a"; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_newExpression.ets new file mode 100644 index 0000000000..f61a303850 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_newExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class D { + constructor(p: string) {} +} + +new D('5'); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_nullishCoalescingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_nullishCoalescingExpression.ets new file mode 100644 index 0000000000..6ba99d6d29 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_nullishCoalescingExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.19 + * nullishCoalescingExpression: + * expression '??' expression + * ; + */ + +'string' ?? 42; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_objectLiteral.ets new file mode 100644 index 0000000000..92be7db6af --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_objectLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + name: string = "NAME"; + age: number = 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_objectReference.ets new file mode 100644 index 0000000000..6fc07603d6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_objectReference.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +let a: string = '1'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_optionalParameter.ets new file mode 100644 index 0000000000..a2e008f2b5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_optionalParameter.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier '?' ':' type + * ; + */ + +function pair(x: string, y: string = '7') {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_parameterList.ets new file mode 100644 index 0000000000..5b12baad0b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_parameterList.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function func1(x: string, y: string): string { + return x + y; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_parenthesizedExpression.ets new file mode 100644 index 0000000000..7c43bac5f9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_parenthesizedExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +let y6 = ('5' + '3'); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_recordLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_recordLiteral.ets new file mode 100644 index 0000000000..b561f6b5f0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_recordLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.5.3 + * recordLiteral: + * '{' keyValueSequence? '}' + * ; + */ + +let map: Record = { + "John": 25, + "Mary": 21, +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_relationalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_relationalExpression.ets new file mode 100644 index 0000000000..d108090696 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_relationalExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.24 + * relationalExpression: + * expression '<' expression + * | expression '>' expression + * | expression '<=' expression + * | expression '>=' expression + * ; + */ + +'i' > '10'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_restParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_restParameter.ets new file mode 100644 index 0000000000..0e5bf3613e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_restParameter.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 4.8.5 + * restParameter: + * annotationUsage? '...' identifier ':' type + * ; + */ + +function sum(...string: string[]): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_returnStatement.ets new file mode 100644 index 0000000000..598b213d3f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_returnStatement.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add(str1: string, str2: string) { + return str1 + str2; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_separateModuleDeclaration.ets new file mode 100644 index 0000000000..98a03ea5c4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_separateModuleDeclaration.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +interface MyInterface { + doSomething(): string; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_signature.ets new file mode 100644 index 0000000000..07097c06ae --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_signature.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function func1(x: string): string { + return '0'; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_spreadExpression.ets new file mode 100644 index 0000000000..95ec8225e8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_spreadExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + *Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let array1 = ['1', '2', '3']; +let array2 = ['4', '5']; +let array3 = [...array1, ...array2]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_statement.ets new file mode 100644 index 0000000000..fb3fd09256 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_statement.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throw Statement + * | tryStatement + * ; + */ + +let x = 'string'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_stringInterpolation.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_stringInterpolation.ets new file mode 100644 index 0000000000..ea0a06ada5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_stringInterpolation.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.31 + * stringInterpolation: + * ' ` ' (BacktickCharacter | embeddedExpression)* ' ` ' + * ; + */ + +let name = 'Alice'; +`Hello, my name is ${name}.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_switchStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_switchStatement.ets new file mode 100644 index 0000000000..55e52740cb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_switchStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 8.13 + * switchStatement: + * (identifier ':')? 'switch' '(' expression ')' switchBlock + * ; + */ + +let x = '10'; +switch (x) { + case '1': break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_thisExpression.ets new file mode 100644 index 0000000000..fc92a2a31c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_thisExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class ThisExample { + public field: string; + constructor() { + this.field = '1'; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_throwStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_throwStatement.ets new file mode 100644 index 0000000000..d80a3ce4cc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_throwStatement.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 8.14 + * throwStatement: + * 'throw' expression + * ; + */ + +throw new Error("error"); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_topDeclaration.ets new file mode 100644 index 0000000000..39077cac66 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_topDeclaration.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +export let x: string[], y: string; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_topLevelStatements.ets new file mode 100644 index 0000000000..e32b5067c2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_topLevelStatements.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement * + * ; + */ + +let a: string = '56'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_trailingLambdaCall.ets new file mode 100644 index 0000000000..22594f0c71 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_trailingLambdaCall.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + methodTwo(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.methodTwo("Hi") {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_tryStatement.ets new file mode 100644 index 0000000000..e6f2ed854a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_tryStatement.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processOne(): string { + try { + const res = '1'; + return res; + } catch (error) { + return '-1'; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_tupleType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_tupleType.ets new file mode 100644 index 0000000000..788f50c097 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_tupleType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + */ + +let tup: [string, number, boolean, string] = ['s', 1, true, '10']; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeAlias.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeAlias.ets new file mode 100644 index 0000000000..b03d5d316c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeAlias.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 4.6.1 + * typeAlias: + * 'type' identifier typeParameters? '=' type + * ; + */ + +let a: string | number = '100'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeArguments.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeArguments.ets new file mode 100644 index 0000000000..31ab3405bc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeArguments.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 5.2.1 + * typeArguments: + * '<' type(','type)* '>' + * ; + */ + +let a: Array<[number, string, boolean]>; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeOfExpression.ets new file mode 100644 index 0000000000..ba06c6d5fa --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeOfExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let s: string = 'a'; +typeof s; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeParameters.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeParameters.ets new file mode 100644 index 0000000000..81e3837971 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_typeParameters.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 5.1 + * typeParameters: + * '<' typeParameterList '>' + * ; + */ + +type str = 'debug' | 'info' | 'warn' | 'error'; +class C1 { + public a: string = "StringLiteral"; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_unaryExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_unaryExpression.ets new file mode 100644 index 0000000000..f44ff802d6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_unaryExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 7.20 + * unaryExpression: + * expression '++' + * | expression '--' + * | '++' expression + * | '--' expression + * | '+' expression + * | '-' expression + * | '~' expression + * | '!' expression + * ; + */ + +'string1' + 'string2'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_unionType.ets new file mode 100644 index 0000000000..d6bdaeb5b8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_unionType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let u: string | number = '1'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_variableDeclarations.ets new file mode 100644 index 0000000000..0a3bfca2c2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_variableDeclarations.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let v: string = '1'; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_whileStatement.ets new file mode 100644 index 0000000000..24edd351d5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/StringLiteral/StringLiteral_whileStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter* '\'' + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +let m = '5'; +let n = '3'; +while(m < n) { + m = n; + break; +} -- Gitee