From dc4f149dfb881c7404e3bff40c39f9cf04c026b8 Mon Sep 17 00:00:00 2001 From: liujia178 Date: Wed, 23 Apr 2025 11:29:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=83=A8=E5=88=86literal?= =?UTF-8?q?=E6=AD=A3=E4=BA=A4=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liujia178 --- .../BigIntLiteral_BooleanLiteral.ets | 32 ++++++++++++++ .../BigIntLiteral_MultilineStringLiteral.ets | 33 ++++++++++++++ .../BigIntLiteral_NullLiteral.ets | 32 ++++++++++++++ .../BigIntLiteral_StringLiteral.ets | 33 ++++++++++++++ .../BigIntLiteral_UndefinedLiteral.ets | 32 ++++++++++++++ .../BigIntLiteral_additiveExpression.ets | 30 +++++++++++++ .../BigIntLiteral_arrayLiteral.ets | 29 +++++++++++++ .../BigIntLiteral/BigIntLiteral_arrayType.ets | 29 +++++++++++++ .../BigIntLiteral_assignmentExpression.ets | 29 +++++++++++++ .../BigIntLiteral_awaitExpression.ets | 34 +++++++++++++++ ...IntLiteral_bitwiseAndLogicalExpression.ets | 31 +++++++++++++ .../BigIntLiteral_classInitializer.ets | 36 ++++++++++++++++ ...BigIntLiteral_conditionalAndExpression.ets | 29 +++++++++++++ .../BigIntLiteral_conditionalExpression.ets | 29 +++++++++++++ .../BigIntLiteral_conditionalOrExpression.ets | 29 +++++++++++++ .../BigIntLiteral_constantDeclarations.ets | 29 +++++++++++++ .../BigIntLiteral_constantExpression.ets | 29 +++++++++++++ ...gIntLiteral_ensureNotNullishExpression.ets | 29 +++++++++++++ .../BigIntLiteral_equalityExpression.ets | 29 +++++++++++++ .../BigIntLiteral_expression.ets | 43 +++++++++++++++++++ .../BigIntLiteral_fieldAccessExpression.ets | 34 +++++++++++++++ .../BigIntLiteral_finallyClause.ets | 35 +++++++++++++++ .../BigIntLiteral_forOfStatement.ets | 33 ++++++++++++++ .../BigIntLiteral_forStatement.ets | 34 +++++++++++++++ .../BigIntLiteral_functionCallExpression.ets | 33 ++++++++++++++ .../BigIntLiteral_ifStatement.ets | 32 ++++++++++++++ .../BigIntLiteral_indexingExpression.ets | 30 +++++++++++++ .../BigIntLiteral_initializerBlock.ets | 33 ++++++++++++++ .../BigIntLiteral_instanceOfExpression.ets | 29 +++++++++++++ ...eral_interfaceDefaultMethodDeclaration.ets | 33 ++++++++++++++ .../BigIntLiteral_lambdaExpression.ets | 31 +++++++++++++ ...ntLiteral_lambdaExpressionWithReceiver.ets | 32 ++++++++++++++ .../BigIntLiteral_loopStatement.ets | 35 +++++++++++++++ .../BigIntLiteral_methodCallExpression.ets | 37 ++++++++++++++++ ...BigIntLiteral_multiplicativeExpression.ets | 31 +++++++++++++ .../BigIntLiteral_namespaceDeclaration.ets | 32 ++++++++++++++ .../BigIntLiteral_newArrayInstance.ets | 30 +++++++++++++ .../BigIntLiteral_newExpression.ets | 34 +++++++++++++++ ...IntLiteral_nullishCoalescingExpression.ets | 29 +++++++++++++ .../BigIntLiteral_objectLiteral.ets | 32 ++++++++++++++ .../BigIntLiteral_objectReference.ets | 31 +++++++++++++ .../BigIntLiteral_optionalParameter.ets | 30 +++++++++++++ .../BigIntLiteral_parameterList.ets | 32 ++++++++++++++ .../BigIntLiteral_parenthesizedExpression.ets | 29 +++++++++++++ .../BigIntLiteral_recordLiteral.ets | 32 ++++++++++++++ .../BigIntLiteral_relationalExpression.ets | 32 ++++++++++++++ .../BigIntLiteral_restParameter.ets | 31 +++++++++++++ .../BigIntLiteral_returnStatement.ets | 31 +++++++++++++ ...igIntLiteral_separateModuleDeclaration.ets | 30 +++++++++++++ .../BigIntLiteral_shiftExpression.ets | 31 +++++++++++++ .../BigIntLiteral/BigIntLiteral_signature.ets | 31 +++++++++++++ .../BigIntLiteral_spreadExpression.ets | 32 ++++++++++++++ .../BigIntLiteral/BigIntLiteral_statement.ets | 39 +++++++++++++++++ .../BigIntLiteral_stringInterpolation.ets | 30 +++++++++++++ .../BigIntLiteral_thisExpression.ets | 34 +++++++++++++++ .../BigIntLiteral_throwStatement.ets | 29 +++++++++++++ .../BigIntLiteral_topDeclaration.ets | 38 ++++++++++++++++ .../BigIntLiteral_topLevelStatements.ets | 29 +++++++++++++ .../BigIntLiteral_trailingLambdaCall.ets | 39 +++++++++++++++++ .../BigIntLiteral_tryStatement.ets | 36 ++++++++++++++++ .../BigIntLiteral/BigIntLiteral_tupleType.ets | 29 +++++++++++++ .../BigIntLiteral_typeOfExpression.ets | 30 +++++++++++++ .../BigIntLiteral_typeParameters.ets | 31 +++++++++++++ .../BigIntLiteral_unaryExpression.ets | 36 ++++++++++++++++ .../BigIntLiteral/BigIntLiteral_unionType.ets | 29 +++++++++++++ .../BigIntLiteral_variableDeclarations.ets | 29 +++++++++++++ .../BigIntLiteral_whileStatement.ets | 33 ++++++++++++++ .../BooleanLiteral_MultilineStringLiteral.ets | 32 ++++++++++++++ .../BooleanLiteral_NullLiteral.ets | 31 +++++++++++++ .../BooleanLiteral_StringLiteral.ets | 32 ++++++++++++++ .../BooleanLiteral_UndefinedLiteral.ets | 31 +++++++++++++ .../BooleanLiteral_annotationDeclaration.ets | 30 +++++++++++++ .../BooleanLiteral_annotationUsage.ets | 36 ++++++++++++++++ .../BooleanLiteral_arrayLiteral.ets | 28 ++++++++++++ .../BooleanLiteral_arrayType.ets | 28 ++++++++++++ .../BooleanLiteral_assignmentExpression.ets | 28 ++++++++++++ .../BooleanLiteral_awaitExpression.ets | 33 ++++++++++++++ ...eanLiteral_bitwiseAndLogicalExpression.ets | 30 +++++++++++++ .../BooleanLiteral_classInitializer.ets | 35 +++++++++++++++ ...ooleanLiteral_conditionalAndExpression.ets | 28 ++++++++++++ .../BooleanLiteral_conditionalExpression.ets | 28 ++++++++++++ ...BooleanLiteral_conditionalOrExpression.ets | 28 ++++++++++++ .../BooleanLiteral_constantDeclarations.ets | 28 ++++++++++++ .../BooleanLiteral_constantExpression.ets | 28 ++++++++++++ ...leanLiteral_ensureNotNullishExpression.ets | 28 ++++++++++++ .../BooleanLiteral_equalityExpression.ets | 28 ++++++++++++ .../BooleanLiteral_expression.ets | 42 ++++++++++++++++++ .../BooleanLiteral_fieldAccessExpression.ets | 33 ++++++++++++++ .../BooleanLiteral_finallyClause.ets | 34 +++++++++++++++ .../BooleanLiteral_forOfStatement.ets | 32 ++++++++++++++ .../BooleanLiteral_forStatement.ets | 33 ++++++++++++++ .../BooleanLiteral_functionCallExpression.ets | 32 ++++++++++++++ .../BooleanLiteral_ifStatement.ets | 31 +++++++++++++ .../BooleanLiteral_indexingExpression.ets | 29 +++++++++++++ .../BooleanLiteral_initializerBlock.ets | 32 ++++++++++++++ ...eral_interfaceDefaultMethodDeclaration.ets | 32 ++++++++++++++ .../BooleanLiteral_lambdaExpression.ets | 30 +++++++++++++ ...anLiteral_lambdaExpressionWithReceiver.ets | 31 +++++++++++++ .../BooleanLiteral_loopStatement.ets | 34 +++++++++++++++ .../BooleanLiteral_methodCallExpression.ets | 36 ++++++++++++++++ .../BooleanLiteral_namespaceDeclaration.ets | 31 +++++++++++++ .../BooleanLiteral_newArrayInstance.ets | 29 +++++++++++++ .../BooleanLiteral_newExpression.ets | 33 ++++++++++++++ ...eanLiteral_nullishCoalescingExpression.ets | 28 ++++++++++++ .../BooleanLiteral_objectLiteral.ets | 31 +++++++++++++ .../BooleanLiteral_objectReference.ets | 30 +++++++++++++ .../BooleanLiteral_optionalParameter.ets | 29 +++++++++++++ .../BooleanLiteral_parameterList.ets | 31 +++++++++++++ ...BooleanLiteral_parenthesizedExpression.ets | 28 ++++++++++++ .../BooleanLiteral_recordLiteral.ets | 31 +++++++++++++ .../BooleanLiteral_relationalExpression.ets | 31 +++++++++++++ .../BooleanLiteral_restParameter.ets | 30 +++++++++++++ .../BooleanLiteral_returnStatement.ets | 30 +++++++++++++ ...oleanLiteral_separateModuleDeclaration.ets | 29 +++++++++++++ .../BooleanLiteral_signature.ets | 30 +++++++++++++ .../BooleanLiteral_spreadExpression.ets | 31 +++++++++++++ .../BooleanLiteral_statement.ets | 38 ++++++++++++++++ .../BooleanLiteral_stringInterpolation.ets | 29 +++++++++++++ .../BooleanLiteral_thisExpression.ets | 33 ++++++++++++++ .../BooleanLiteral_throwStatement.ets | 28 ++++++++++++ .../BooleanLiteral_topDeclaration.ets | 37 ++++++++++++++++ .../BooleanLiteral_topLevelStatements.ets | 28 ++++++++++++ .../BooleanLiteral_trailingLambdaCall.ets | 38 ++++++++++++++++ .../BooleanLiteral_tryStatement.ets | 35 +++++++++++++++ .../BooleanLiteral_tupleType.ets | 28 ++++++++++++ .../BooleanLiteral_typeOfExpression.ets | 29 +++++++++++++ .../BooleanLiteral_typeParameters.ets | 30 +++++++++++++ .../BooleanLiteral_unaryExpression.ets | 35 +++++++++++++++ .../BooleanLiteral_unionType.ets | 28 ++++++++++++ .../BooleanLiteral_variableDeclarations.ets | 28 ++++++++++++ .../BooleanLiteral_whileStatement.ets | 31 +++++++++++++ .../MultilineStringLiteral_NullLiteral.ets | 32 ++++++++++++++ ...ultilineStringLiteral_UndefinedLiteral.ets | 32 ++++++++++++++ ...tilineStringLiteral_additiveExpression.ets | 31 +++++++++++++ .../MultilineStringLiteral_arrayLiteral.ets | 29 +++++++++++++ .../MultilineStringLiteral_arrayType.ets | 30 +++++++++++++ ...lineStringLiteral_assignmentExpression.ets | 29 +++++++++++++ ...MultilineStringLiteral_awaitExpression.ets | 34 +++++++++++++++ ...ultilineStringLiteral_classInitializer.ets | 39 +++++++++++++++++ ...StringLiteral_conditionalAndExpression.ets | 30 +++++++++++++ ...ineStringLiteral_conditionalExpression.ets | 29 +++++++++++++ ...eStringLiteral_conditionalOrExpression.ets | 30 +++++++++++++ ...lineStringLiteral_constantDeclarations.ets | 29 +++++++++++++ ...tilineStringLiteral_constantExpression.ets | 29 +++++++++++++ ...ringLiteral_ensureNotNullishExpression.ets | 29 +++++++++++++ ...tilineStringLiteral_equalityExpression.ets | 30 +++++++++++++ .../MultilineStringLiteral_expression.ets | 43 +++++++++++++++++++ ...ineStringLiteral_fieldAccessExpression.ets | 35 +++++++++++++++ .../MultilineStringLiteral_finallyClause.ets | 35 +++++++++++++++ .../MultilineStringLiteral_forOfStatement.ets | 34 +++++++++++++++ .../MultilineStringLiteral_forStatement.ets | 34 +++++++++++++++ ...neStringLiteral_functionCallExpression.ets | 33 ++++++++++++++ .../MultilineStringLiteral_ifStatement.ets | 32 ++++++++++++++ ...tilineStringLiteral_indexingExpression.ets | 30 +++++++++++++ ...lineStringLiteral_instanceOfExpression.ets | 29 +++++++++++++ ...ultilineStringLiteral_lambdaExpression.ets | 32 ++++++++++++++ ...ngLiteral_lambdaExpressionWithReceiver.ets | 32 ++++++++++++++ .../MultilineStringLiteral_loopStatement.ets | 35 +++++++++++++++ ...lineStringLiteral_methodCallExpression.ets | 38 ++++++++++++++++ ...lineStringLiteral_namespaceDeclaration.ets | 32 ++++++++++++++ ...ultilineStringLiteral_newArrayInstance.ets | 30 +++++++++++++ .../MultilineStringLiteral_newExpression.ets | 34 +++++++++++++++ ...ingLiteral_nullishCoalescingExpression.ets | 29 +++++++++++++ .../MultilineStringLiteral_objectLiteral.ets | 32 ++++++++++++++ ...MultilineStringLiteral_objectReference.ets | 31 +++++++++++++ ...ltilineStringLiteral_optionalParameter.ets | 30 +++++++++++++ .../MultilineStringLiteral_parameterList.ets | 32 ++++++++++++++ ...eStringLiteral_parenthesizedExpression.ets | 29 +++++++++++++ ...lineStringLiteral_relationalExpression.ets | 33 ++++++++++++++ .../MultilineStringLiteral_restParameter.ets | 35 +++++++++++++++ ...MultilineStringLiteral_returnStatement.ets | 31 +++++++++++++ ...tringLiteral_separateModuleDeclaration.ets | 29 +++++++++++++ .../MultilineStringLiteral_signature.ets | 31 +++++++++++++ ...ultilineStringLiteral_spreadExpression.ets | 33 ++++++++++++++ .../MultilineStringLiteral_statement.ets | 39 +++++++++++++++++ ...ilineStringLiteral_stringInterpolation.ets | 30 +++++++++++++ ...MultilineStringLiteral_switchStatement.ets | 32 ++++++++++++++ .../MultilineStringLiteral_thisExpression.ets | 34 +++++++++++++++ .../MultilineStringLiteral_throwStatement.ets | 29 +++++++++++++ .../MultilineStringLiteral_topDeclaration.ets | 38 ++++++++++++++++ ...tilineStringLiteral_topLevelStatements.ets | 29 +++++++++++++ ...tilineStringLiteral_trailingLambdaCall.ets | 39 +++++++++++++++++ .../MultilineStringLiteral_tryStatement.ets | 36 ++++++++++++++++ .../MultilineStringLiteral_tupleType.ets | 29 +++++++++++++ ...ultilineStringLiteral_typeOfExpression.ets | 30 +++++++++++++ .../MultilineStringLiteral_typeParameters.ets | 31 +++++++++++++ ...MultilineStringLiteral_unaryExpression.ets | 36 ++++++++++++++++ .../MultilineStringLiteral_unionType.ets | 29 +++++++++++++ ...lineStringLiteral_variableDeclarations.ets | 29 +++++++++++++ .../MultilineStringLiteral_whileStatement.ets | 33 ++++++++++++++ .../UndefinedLiteral_arrayLiteral.ets | 28 ++++++++++++ .../UndefinedLiteral_arrayType.ets | 28 ++++++++++++ .../UndefinedLiteral_assignmentExpression.ets | 28 ++++++++++++ .../UndefinedLiteral_awaitExpression.ets | 33 ++++++++++++++ .../UndefinedLiteral_classInitializer.ets | 35 +++++++++++++++ ...efinedLiteral_conditionalAndExpression.ets | 28 ++++++++++++ ...UndefinedLiteral_conditionalExpression.ets | 28 ++++++++++++ ...definedLiteral_conditionalOrExpression.ets | 28 ++++++++++++ .../UndefinedLiteral_constantDeclarations.ets | 28 ++++++++++++ .../UndefinedLiteral_constantExpression.ets | 28 ++++++++++++ ...inedLiteral_ensureNotNullishExpression.ets | 28 ++++++++++++ .../UndefinedLiteral_equalityExpression.ets | 28 ++++++++++++ .../UndefinedLiteral_expression.ets | 42 ++++++++++++++++++ ...UndefinedLiteral_fieldAccessExpression.ets | 33 ++++++++++++++ .../UndefinedLiteral_finallyClause.ets | 34 +++++++++++++++ .../UndefinedLiteral_forOfStatement.ets | 32 ++++++++++++++ .../UndefinedLiteral_forStatement.ets | 34 +++++++++++++++ ...ndefinedLiteral_functionCallExpression.ets | 32 ++++++++++++++ .../UndefinedLiteral_functionType.ets | 30 +++++++++++++ .../UndefinedLiteral_ifStatement.ets | 31 +++++++++++++ .../UndefinedLiteral_indexingExpression.ets | 29 +++++++++++++ .../UndefinedLiteral_initializerBlock.ets | 32 ++++++++++++++ .../UndefinedLiteral_instanceOfExpression.ets | 28 ++++++++++++ .../UndefinedLiteral_lambdaExpression.ets | 30 +++++++++++++ ...edLiteral_lambdaExpressionWithReceiver.ets | 31 +++++++++++++ .../UndefinedLiteral_loopStatement.ets | 34 +++++++++++++++ .../UndefinedLiteral_methodCallExpression.ets | 36 ++++++++++++++++ .../UndefinedLiteral_namespaceDeclaration.ets | 31 +++++++++++++ .../UndefinedLiteral_newExpression.ets | 33 ++++++++++++++ ...nedLiteral_nullishCoalescingExpression.ets | 28 ++++++++++++ .../UndefinedLiteral_objectLiteral.ets | 31 +++++++++++++ .../UndefinedLiteral_objectReference.ets | 30 +++++++++++++ .../UndefinedLiteral_optionalParameter.ets | 29 +++++++++++++ .../UndefinedLiteral_parameterList.ets | 31 +++++++++++++ ...definedLiteral_parenthesizedExpression.ets | 28 ++++++++++++ .../UndefinedLiteral_restParameter.ets | 30 +++++++++++++ .../UndefinedLiteral_returnStatement.ets | 30 +++++++++++++ ...finedLiteral_separateModuleDeclaration.ets | 28 ++++++++++++ .../UndefinedLiteral_signature.ets | 30 +++++++++++++ .../UndefinedLiteral_spreadExpression.ets | 31 +++++++++++++ .../UndefinedLiteral_statement.ets | 38 ++++++++++++++++ .../UndefinedLiteral_stringInterpolation.ets | 29 +++++++++++++ .../UndefinedLiteral_thisExpression.ets | 33 ++++++++++++++ .../UndefinedLiteral_throwStatement.ets | 29 +++++++++++++ .../UndefinedLiteral_topDeclaration.ets | 37 ++++++++++++++++ .../UndefinedLiteral_topLevelStatements.ets | 28 ++++++++++++ .../UndefinedLiteral_trailingLambdaCall.ets | 38 ++++++++++++++++ .../UndefinedLiteral_tryStatement.ets | 35 +++++++++++++++ .../UndefinedLiteral_tupleType.ets | 28 ++++++++++++ .../UndefinedLiteral_typeArguments.ets | 28 ++++++++++++ .../UndefinedLiteral_typeOfExpression.ets | 29 +++++++++++++ .../UndefinedLiteral_typeParameters.ets | 30 +++++++++++++ .../UndefinedLiteral_unaryExpression.ets | 35 +++++++++++++++ .../UndefinedLiteral_unionType.ets | 28 ++++++++++++ .../UndefinedLiteral_variableDeclarations.ets | 28 ++++++++++++ .../UndefinedLiteral_whileStatement.ets | 32 ++++++++++++++ 246 files changed, 7755 insertions(+) create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_BooleanLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_MultilineStringLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_NullLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_StringLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_UndefinedLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_additiveExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_assignmentExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_awaitExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_bitwiseAndLogicalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_classInitializer.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalAndExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalOrExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ensureNotNullishExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_equalityExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_expression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_fieldAccessExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_finallyClause.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forOfStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_functionCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ifStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_indexingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_initializerBlock.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_instanceOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_interfaceDefaultMethodDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpressionWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_loopStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_methodCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_multiplicativeExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_namespaceDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newArrayInstance.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_nullishCoalescingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectReference.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_optionalParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parameterList.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parenthesizedExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_recordLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_relationalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_restParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_returnStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_separateModuleDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_shiftExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_signature.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_spreadExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_statement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_stringInterpolation.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_thisExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_throwStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topLevelStatements.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_trailingLambdaCall.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tryStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tupleType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeParameters.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unaryExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_variableDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_whileStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_MultilineStringLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_NullLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_StringLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_UndefinedLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationUsage.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_assignmentExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_awaitExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_bitwiseAndLogicalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_classInitializer.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalAndExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalOrExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ensureNotNullishExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_equalityExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_expression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_fieldAccessExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_finallyClause.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forOfStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_functionCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ifStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_indexingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_initializerBlock.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_interfaceDefaultMethodDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpressionWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_loopStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_methodCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_namespaceDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newArrayInstance.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_nullishCoalescingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectReference.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_optionalParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parameterList.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parenthesizedExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_recordLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_relationalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_restParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_returnStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_separateModuleDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_signature.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_spreadExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_statement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_stringInterpolation.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_thisExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_throwStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topLevelStatements.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_trailingLambdaCall.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tryStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tupleType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeParameters.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unaryExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_variableDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_whileStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_NullLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_UndefinedLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_additiveExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_assignmentExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_awaitExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_classInitializer.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalAndExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalOrExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ensureNotNullishExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_equalityExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_expression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_fieldAccessExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_finallyClause.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forOfStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_functionCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ifStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_indexingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_instanceOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpressionWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_loopStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_methodCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_namespaceDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newArrayInstance.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_nullishCoalescingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectReference.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_optionalParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parameterList.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parenthesizedExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_relationalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_restParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_returnStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_separateModuleDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_signature.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_spreadExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_statement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_stringInterpolation.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_switchStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_thisExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_throwStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topLevelStatements.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_trailingLambdaCall.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tryStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tupleType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeParameters.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unaryExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_variableDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_whileStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_assignmentExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_awaitExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_classInitializer.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalAndExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalOrExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ensureNotNullishExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_equalityExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_expression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_fieldAccessExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_finallyClause.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forOfStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ifStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_indexingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_initializerBlock.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_instanceOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpressionWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_loopStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_methodCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_namespaceDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_newExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_nullishCoalescingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectReference.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_optionalParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parameterList.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parenthesizedExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_restParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_returnStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_separateModuleDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_signature.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_spreadExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_statement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_stringInterpolation.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_thisExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_throwStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topLevelStatements.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_trailingLambdaCall.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tryStatement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tupleType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeArguments.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeOfExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeParameters.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unaryExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unionType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_variableDeclarations.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_whileStatement.ets diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_BooleanLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_BooleanLiteral.ets new file mode 100644 index 0000000000..095245879e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_BooleanLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + */ + +let num = 153n; +let bool = false; + +console.info('bool: ' + bool + ' num: ' + num); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_MultilineStringLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_MultilineStringLiteral.ets new file mode 100644 index 0000000000..27c209ee3c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_MultilineStringLiteral.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + */ + +let mulStr = `This is a +multi-line string literal.`; +let num = 153n; + +let result = num + mulStr; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_NullLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_NullLiteral.ets new file mode 100644 index 0000000000..eeede2c59f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_NullLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + */ + +let n = null; +let num = 135n; + +console.info('n: ' + n + ' num: ' + num) diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_StringLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_StringLiteral.ets new file mode 100644 index 0000000000..c026906e5f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_StringLiteral.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter * '\'' + * ; + */ + +let num = 153n; +let str = "abc"; + +let result = num + str; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_UndefinedLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_UndefinedLiteral.ets new file mode 100644 index 0000000000..4d6fab1fbf --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_UndefinedLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + */ + +let und = undefined; +let num = 153n; + +console.info('und: ' + und + ' num: ' + num) diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_additiveExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_additiveExpression.ets new file mode 100644 index 0000000000..8c370e0ea2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_additiveExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.22 + * additiveExpression: + * expression '+' expression + * | expression '-' expression + * ; + */ + +153n + 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayLiteral.ets new file mode 100644 index 0000000000..a60c1aeba4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayLiteral.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let x5 = [153n, 2, 1_153n]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayType.ets new file mode 100644 index 0000000000..f4f88b31a7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_arrayType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 3.17.1 + * arrayType: + * type '[' ']' + * ; + */ + +let arr: bigint[] = [153n, 1_153n]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_assignmentExpression.ets new file mode 100644 index 0000000000..cd4699cd27 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_assignmentExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + */ + +let a = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_awaitExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_awaitExpression.ets new file mode 100644 index 0000000000..905b641ab0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_awaitExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 17.16.2 + * awaitExpression: + * 'await' expression + * ; + */ + +function foo(): Promise { + return new Promise((resolve, reject) => { + resolve(152n); + }); +} +const res = await foo(); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_bitwiseAndLogicalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_bitwiseAndLogicalExpression.ets new file mode 100644 index 0000000000..425f1beed0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_bitwiseAndLogicalExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.26 + * bitwiseAndLogicalExpression: + * expression '&' expression + * | expression '^' expression + * | expression '|' expression + * ; + */ + +153n & 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_classInitializer.ets new file mode 100644 index 0000000000..ec9e5bd2d3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_classInitializer.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class ExampleClass1 { + static initialized = 153n; + static initializerBlock() { + if (ExampleClass1.initialized == 153n) { + ExampleClass1.initialized = 1_153n; + } + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalAndExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalAndExpression.ets new file mode 100644 index 0000000000..14e359bd71 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalAndExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.27 + * conditionalAndExpression: + * expression '&&' expression + * ; + */ + +153n && 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalExpression.ets new file mode 100644 index 0000000000..bbf42e0bef --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.30 + * conditionalExpression: + * expression '?' expression ':' expression + * ; + */ + +(153n > 1_153n) ? 153n : 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalOrExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalOrExpression.ets new file mode 100644 index 0000000000..8cfa9ae23a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_conditionalOrExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.28 + * conditionalOrExpression: + * expression '||' expression + * ; + */ + +153n || 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantDeclarations.ets new file mode 100644 index 0000000000..afc91b2902 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantDeclarations.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const c: bigint = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantExpression.ets new file mode 100644 index 0000000000..cbaea8d452 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_constantExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const a = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ensureNotNullishExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ensureNotNullishExpression.ets new file mode 100644 index 0000000000..2354acb951 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ensureNotNullishExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.18 + * ensureNotNullishExpression: + * expression '!' + * ; + */ + +153n!; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_equalityExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_equalityExpression.ets new file mode 100644 index 0000000000..258aec4ebb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_equalityExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.25 + * equalityExpression: + * expression ('==' | '===' | '!=' | '!==') expression + * ; + */ + +153n == 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_expression.ets new file mode 100644 index 0000000000..36a092d715 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_expression.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +const PI = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_fieldAccessExpression.ets new file mode 100644 index 0000000000..d8a6112f3a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_fieldAccessExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person1 { + name: bigint = 153n; +} + +let person = new Person1(); +person.name = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_finallyClause.ets new file mode 100644 index 0000000000..a089e8b6ac --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_finallyClause.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +function processOne() { + try { + } catch (error) { + } finally { + const res = 153n; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forOfStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forOfStatement.ets new file mode 100644 index 0000000000..57dab166e3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forOfStatement.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.9 + * forOfStatement: + * 'for' '(' forVariable 'of' expression ')' statement + * ; + */ + +let arr = [150n, 151n, 153n]; +let item: bigint = 153n; +for (item of arr) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forStatement.ets new file mode 100644 index 0000000000..d44119feac --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_forStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +let i: bigint = 153n; +for (; i < 155n; i++) { + if (true) { + break; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_functionCallExpression.ets new file mode 100644 index 0000000000..feab7ed5db --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_functionCallExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ('?.' | typeArguments)? arguments block? + * ; + */ + +function func1(x: bigint): number { + return 0; +} + +func1(153n); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ifStatement.ets new file mode 100644 index 0000000000..83556b87d6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_ifStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if (153n) { + console.log(153n); +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_indexingExpression.ets new file mode 100644 index 0000000000..57aa2ea897 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_indexingExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +let numbers = [153n, 2, 1_153n, 4, 5]; +numbers[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_initializerBlock.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_initializerBlock.ets new file mode 100644 index 0000000000..86933629d7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_initializerBlock.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 15.10 + * initializerBlock: + * 'static' block + * ; + */ + +class Test { + static initializerBlock() { + let sum = 153n + 1_153n ; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_instanceOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_instanceOfExpression.ets new file mode 100644 index 0000000000..77418ac85f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_instanceOfExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.16 + * instanceOfExpression: + * expression 'instanceof' type + * ; + */ + +153n instanceof bigint; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_interfaceDefaultMethodDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_interfaceDefaultMethodDeclaration.ets new file mode 100644 index 0000000000..6b7c619e15 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_interfaceDefaultMethodDeclaration.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 17.11 + * interfaceDefaultMethodDeclaration: + * 'private'? identifier signature block + * ; + */ + +interface DefaultInterface { + defaultMethod(): bigint { + return 153n; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpression.ets new file mode 100644 index 0000000000..443a5fc85c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +let result = async (x: bigint, y: number, z?: number): Promise => { + return 153n; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000..3d7ea5906d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_lambdaExpressionWithReceiver.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result4 = (this: A): bigint => { return 153n; }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_loopStatement.ets new file mode 100644 index 0000000000..dfcd4b2ac9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_loopStatement.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while(153n) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_methodCallExpression.ets new file mode 100644 index 0000000000..af2a7dfc3a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_methodCallExpression.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class Person2 { + name: bigint = 153n; + setName(name: bigint): void { + this.name = name; + } +} + +let person = new Person2(); +person.setName(153n); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_multiplicativeExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_multiplicativeExpression.ets new file mode 100644 index 0000000000..4f8f340c1e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_multiplicativeExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.21 + * multiplicativeExpression: + * expression '*' expression + * | expression '/' expression + * | expression '%' expressionc + * ; + */ + +153n * 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_namespaceDeclaration.ets new file mode 100644 index 0000000000..55137a3b1d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_namespaceDeclaration.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace NS1 { + let a: bigint = 135n; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newArrayInstance.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newArrayInstance.ets new file mode 100644 index 0000000000..964f3b384b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newArrayInstance.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 17.3 + * newArrayInstance: + * 'new' arrayElementType dimensionExpression+ (arrayElement)? + * ; + */ + +let a = new bigint[1]; +a[0] = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newExpression.ets new file mode 100644 index 0000000000..0b79e7e90a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_newExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class D { + constructor(p: bigint) {} +} + +new D(153n); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_nullishCoalescingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_nullishCoalescingExpression.ets new file mode 100644 index 0000000000..a040ddc1f2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_nullishCoalescingExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.19 + * nullishCoalescingExpression: + * expression '??' expression + * ; + */ + +153n ?? 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectLiteral.ets new file mode 100644 index 0000000000..8a56cfe09f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + name: string = "NAME"; + age: bigint = 153n; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectReference.ets new file mode 100644 index 0000000000..db938c363a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_objectReference.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +let a: bigint = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_optionalParameter.ets new file mode 100644 index 0000000000..18b8f28edf --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_optionalParameter.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier '?' ':' type + * ; + */ + +function pair(x: number, y: bigint = 153n) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parameterList.ets new file mode 100644 index 0000000000..98fc7892cc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parameterList.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function func1(y: string, x: bigint = 153n): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parenthesizedExpression.ets new file mode 100644 index 0000000000..c46e462f68 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_parenthesizedExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +let y6 = (153n); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_recordLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_recordLiteral.ets new file mode 100644 index 0000000000..05582cc678 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_recordLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.5.3 + * recordLiteral: + * '{' keyValueSequence? '}' + * ; + */ + +let map: Record = { + "John": 153n, + "Mary": 153n, +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_relationalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_relationalExpression.ets new file mode 100644 index 0000000000..d41288877a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_relationalExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.24 + * relationalExpression: + * expression '<' expression + * | expression '>' expression + * | expression '<=' expression + * | expression '>=' expression + * ; + */ + +153n < 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_restParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_restParameter.ets new file mode 100644 index 0000000000..1d3081be67 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_restParameter.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 4.8.5 + * restParameter: + * annotationUsage? '...' identifier ':' type + * ; + */ + +function sum(...bigints: bigint[]): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_returnStatement.ets new file mode 100644 index 0000000000..10446fa22e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_returnStatement.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add() { + return 135n + 134n; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_separateModuleDeclaration.ets new file mode 100644 index 0000000000..10d9107b67 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_separateModuleDeclaration.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +let a: bigint = 165n; +console.info('a: ' + a); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_shiftExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_shiftExpression.ets new file mode 100644 index 0000000000..51585d09f9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_shiftExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.23 + * shiftExpression: + * expression '<<' expression + * | expression '>>' expression + * | expression '>>>' expression + * ; + */ + +153n << 1_153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_signature.ets new file mode 100644 index 0000000000..77748b7e40 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_signature.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function func1(x: bigint = 153n): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_spreadExpression.ets new file mode 100644 index 0000000000..7ea5b61ead --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_spreadExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + *Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let array1 = [1, 2, 1_153n]; +let array2 = [153n, 5]; +let array3 = [...array1, ...array2]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_statement.ets new file mode 100644 index 0000000000..a21e3bc408 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_statement.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throw Statement + * | tryStatement + * ; + */ + +let x = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_stringInterpolation.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_stringInterpolation.ets new file mode 100644 index 0000000000..59631d72b4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_stringInterpolation.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.31 + * stringInterpolation: + * ' ` ' (BacktickCharacter | embeddedExpression)* ' ` ' + * ; + */ + +let name = 153n; +`Hello, my name is ${name}.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_thisExpression.ets new file mode 100644 index 0000000000..5c1d209efc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_thisExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class ThisExample { + public field: bigint; + constructor() { + this.field = 153n; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_throwStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_throwStatement.ets new file mode 100644 index 0000000000..a6f16f20d5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_throwStatement.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.14 + * throwStatement: + * 'throw' expression + * ; + */ + +throw new Error("error" + 153n); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topDeclaration.ets new file mode 100644 index 0000000000..209a94d462 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topDeclaration.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +export let x: bigint = 153n, y: bigint = 154n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topLevelStatements.ets new file mode 100644 index 0000000000..db01b271e3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_topLevelStatements.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement * + * ; + */ + +let a: bigint = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_trailingLambdaCall.ets new file mode 100644 index 0000000000..cc7d4c4643 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_trailingLambdaCall.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + methodTwo(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.methodTwo(153n) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tryStatement.ets new file mode 100644 index 0000000000..748798e1c8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tryStatement.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processOne(): bigint { + try { + const res = 153n; + return res; + } catch (error) { + return -1n; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tupleType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tupleType.ets new file mode 100644 index 0000000000..e8a46773ef --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_tupleType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + */ + +let tup: [bigint, number, boolean, number] = [153n, 1, true, 10]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeOfExpression.ets new file mode 100644 index 0000000000..69f77080b5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeOfExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let s: bigint = 153n; +typeof s; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeParameters.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeParameters.ets new file mode 100644 index 0000000000..23b7db2986 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_typeParameters.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 5.1 + * typeParameters: + * '<' typeParameterList '>' + * ; + */ + +class C1 { + public a: bigint = 153n; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unaryExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unaryExpression.ets new file mode 100644 index 0000000000..1afcb3bb27 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unaryExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 7.20 + * unaryExpression: + * expression '++' + * | expression '--' + * | '++' expression + * | '--' expression + * | '+' expression + * | '-' expression + * | '~' expression + * | '!' expression + * ; + */ + +!153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unionType.ets new file mode 100644 index 0000000000..1d349fe8c5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_unionType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let u: string | bigint = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_variableDeclarations.ets new file mode 100644 index 0000000000..2b580a8911 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_variableDeclarations.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let v: bigint = 153n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_whileStatement.ets new file mode 100644 index 0000000000..221dce6e0c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BigIntLiteral/BigIntLiteral_whileStatement.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.4 + * BigIntLiteral: + * '0n' + * | [1-9] ('_'? [0-9])* 'n' + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +let m = 153n; +let n = 155n; +while(m < n) { + m--; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_MultilineStringLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_MultilineStringLiteral.ets new file mode 100644 index 0000000000..7bf73f0829 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_MultilineStringLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + */ + +let mulStr = `This is a +multi-line string literal.`; +let bool = true; + +let result = bool + mulStr; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_NullLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_NullLiteral.ets new file mode 100644 index 0000000000..244395103c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_NullLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + */ + +let n = null; +let bool = true; + +console.info('n: ' + n + ' bool: ' + bool); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_StringLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_StringLiteral.ets new file mode 100644 index 0000000000..48b4863f33 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_StringLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 2.9.6 + * StringLiteral: + * '"' DoubleQuoteCharacter* '"' + * | '\'' SingleQuoteCharacter * '\'' + * ; + */ + +let bool = true; +let str = "abc"; + +let result = bool + str; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_UndefinedLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_UndefinedLiteral.ets new file mode 100644 index 0000000000..6d834f4c8f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_UndefinedLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + */ + +let und = undefined; +let bool = true; + +console.info('und: ' + und + ' bool: ' + bool); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationDeclaration.ets new file mode 100644 index 0000000000..8f0895c87e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationDeclaration.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 18.1 + * annotationDeclaration: + * '@interface' identifier '{' annotationField* '}' + * ; + */ + +@interface A { + value: boolean = true; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationUsage.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationUsage.ets new file mode 100644 index 0000000000..577f3b40a9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_annotationUsage.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 18.2 + * annotationUsage: + * 'at' qualifiedName annotationValues? + * ; + */ + +@interface DetailedAnnotation { + authorName: boolean; + creationDate: string; +} +@DetailedAnnotation({ + authorName: true, + creationDate: "2025-03-19" +}) +class DocumentedClass {}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayLiteral.ets new file mode 100644 index 0000000000..29204f2951 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayLiteral.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let x5 = [true, false, true]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayType.ets new file mode 100644 index 0000000000..9ad0a735e2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_arrayType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 3.17.1 + * arrayType: + * type '[' ']' + * ; + */ + +let arr: boolean[] = [true, false]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_assignmentExpression.ets new file mode 100644 index 0000000000..a511c6f844 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_assignmentExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + */ + +let a = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_awaitExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_awaitExpression.ets new file mode 100644 index 0000000000..d3156019ee --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_awaitExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 17.16.2 + * awaitExpression: + * 'await' expression + * ; + */ + +function foo(): Promise { + return new Promise((resolve, reject) => { + resolve(true); + }); +} +const res = await foo(); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_bitwiseAndLogicalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_bitwiseAndLogicalExpression.ets new file mode 100644 index 0000000000..8dbcaf2427 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_bitwiseAndLogicalExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.26 + * bitwiseAndLogicalExpression: + * expression '&' expression + * | expression '^' expression + * | expression '|' expression + * ; + */ + +true & true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_classInitializer.ets new file mode 100644 index 0000000000..75a282632b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_classInitializer.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class ExampleClass1 { + static initialized = false; + static initializerBlock() { + if (!ExampleClass1.initialized) { + ExampleClass1.initialized = true; + } + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalAndExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalAndExpression.ets new file mode 100644 index 0000000000..e3f3a28540 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalAndExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.27 + * conditionalAndExpression: + * expression '&&' expression + * ; + */ + +true && true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalExpression.ets new file mode 100644 index 0000000000..7419cee8b7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.30 + * conditionalExpression: + * expression '?' expression ':' expression + * ; + */ + +true ? false : true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalOrExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalOrExpression.ets new file mode 100644 index 0000000000..fe2b76b838 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_conditionalOrExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.28 + * conditionalOrExpression: + * expression '||' expression + * ; + */ + +true || false; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantDeclarations.ets new file mode 100644 index 0000000000..0ae2f514dd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantDeclarations.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const c: boolean = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantExpression.ets new file mode 100644 index 0000000000..97fd925d89 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_constantExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const a = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ensureNotNullishExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ensureNotNullishExpression.ets new file mode 100644 index 0000000000..7af9008c1e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ensureNotNullishExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.18 + * ensureNotNullishExpression: + * expression '!' + * ; + */ + +true!; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_equalityExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_equalityExpression.ets new file mode 100644 index 0000000000..93affe9d9b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_equalityExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.25 + * equalityExpression: + * expression ('==' | '===' | '!=' | '!==') expression + * ; + */ + +true == true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_expression.ets new file mode 100644 index 0000000000..6ecffed9c4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_expression.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +const a = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_fieldAccessExpression.ets new file mode 100644 index 0000000000..bcd925ef5b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_fieldAccessExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person1 { + name: boolean = true; +} + +let person = new Person1(); +person.name = false; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_finallyClause.ets new file mode 100644 index 0000000000..9979996f3d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_finallyClause.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +function processOne() { + try { + } catch (error) { + } finally { + const res = true; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forOfStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forOfStatement.ets new file mode 100644 index 0000000000..a3daf4f7ce --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forOfStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.9 + * forOfStatement: + * 'for' '(' forVariable 'of' expression ')' statement + * ; + */ + +let arr = [true, false, true]; +let item: boolean = true; +for (item of arr) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forStatement.ets new file mode 100644 index 0000000000..5e2493f41d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_forStatement.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +let a: boolean = true; +for (let i = 1; (i < 10 && a); i++) { + if (true) { + break; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_functionCallExpression.ets new file mode 100644 index 0000000000..98ec9289dc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_functionCallExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ('?.' | typeArguments)? arguments block? + * ; + */ + +function func1(x: boolean): number { + return 0; +} + +func1(true); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ifStatement.ets new file mode 100644 index 0000000000..fcb5694885 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_ifStatement.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if (true) { + console.log(true); +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_indexingExpression.ets new file mode 100644 index 0000000000..6e85ac62c1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_indexingExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +let s = [true, 2, true, 4, false]; +s[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_initializerBlock.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_initializerBlock.ets new file mode 100644 index 0000000000..3cceb2eb46 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_initializerBlock.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 15.10 + * initializerBlock: + * 'static' block + * ; + */ + +class Test { + static initializerBlock() { + let a = true ; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_interfaceDefaultMethodDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_interfaceDefaultMethodDeclaration.ets new file mode 100644 index 0000000000..d338e21ab8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_interfaceDefaultMethodDeclaration.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 17.11 + * interfaceDefaultMethodDeclaration: + * 'private'? identifier signature block + * ; + */ + +interface DefaultInterface { + defaultMethod(): boolean { + return true; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpression.ets new file mode 100644 index 0000000000..57c79a6e13 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +let result = async (x: boolean, y: number, z?: number): Promise => { + return true; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000..859663f517 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_lambdaExpressionWithReceiver.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result4 = (this: A): boolean => { return true; }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_loopStatement.ets new file mode 100644 index 0000000000..20f551a161 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_loopStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while(true) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_methodCallExpression.ets new file mode 100644 index 0000000000..b42732ac06 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_methodCallExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class Person2 { + name: boolean = true; + setName(name: boolean): void { + this.name = name; + } +} + +let person = new Person2(); +person.setName(true); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_namespaceDeclaration.ets new file mode 100644 index 0000000000..8f08fff601 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_namespaceDeclaration.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace NS1 { + let a: boolean = true; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newArrayInstance.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newArrayInstance.ets new file mode 100644 index 0000000000..022a24b1b8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newArrayInstance.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 17.3 + * newArrayInstance: + * 'new' arrayElementType dimensionExpression+ (arrayElement)? + * ; + */ + +let a = new boolean[1]; +a[0] = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newExpression.ets new file mode 100644 index 0000000000..22c621fff0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_newExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class D { + constructor(p: boolean) {} +} + +new D(false); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_nullishCoalescingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_nullishCoalescingExpression.ets new file mode 100644 index 0000000000..ad1e3c1ed0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_nullishCoalescingExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.19 + * nullishCoalescingExpression: + * expression '??' expression + * ; + */ + +null ?? true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectLiteral.ets new file mode 100644 index 0000000000..9fc2057b24 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + name: string = "NAME"; + age: boolean = true; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectReference.ets new file mode 100644 index 0000000000..af14535ff0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_objectReference.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +let a: boolean = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_optionalParameter.ets new file mode 100644 index 0000000000..6651cc43e3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_optionalParameter.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier '?' ':' type + * ; + */ + +function pair(x: number, y: boolean = true) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parameterList.ets new file mode 100644 index 0000000000..2ce92f07c8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parameterList.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function func1(y: string, x: boolean = true): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parenthesizedExpression.ets new file mode 100644 index 0000000000..f3891a1b28 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_parenthesizedExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +let y6 = (true); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_recordLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_recordLiteral.ets new file mode 100644 index 0000000000..7940ca33e7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_recordLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.5.3 + * recordLiteral: + * '{' keyValueSequence? '}' + * ; + */ + +let map: Record = { + "John": true, + "Mary": true, +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_relationalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_relationalExpression.ets new file mode 100644 index 0000000000..c6c421bb67 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_relationalExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.24 + * relationalExpression: + * expression '<' expression + * | expression '>' expression + * | expression '<=' expression + * | expression '>=' expression + * ; + */ + +true < true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_restParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_restParameter.ets new file mode 100644 index 0000000000..bd3e59076f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_restParameter.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 4.8.5 + * restParameter: + * annotationUsage? '...' identifier ':' type + * ; + */ + +function sum(...booleans: boolean[]): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_returnStatement.ets new file mode 100644 index 0000000000..021f63897a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_returnStatement.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add(boolean1: boolean) { + return boolean1; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_separateModuleDeclaration.ets new file mode 100644 index 0000000000..158856ca29 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_separateModuleDeclaration.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +let a: boolean = true; +console.info('a: ' + a); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_signature.ets new file mode 100644 index 0000000000..7447a5def6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_signature.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function func1(x: number): boolean { + return true; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_spreadExpression.ets new file mode 100644 index 0000000000..81739226a6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_spreadExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + *Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let array1 = [false, 2, true]; +let array2 = [4, true]; +let array3 = [...array1, ...array2]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_statement.ets new file mode 100644 index 0000000000..028c263cf7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_statement.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throw Statement + * | tryStatement + * ; + */ + +let x = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_stringInterpolation.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_stringInterpolation.ets new file mode 100644 index 0000000000..7cb52f4685 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_stringInterpolation.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.31 + * stringInterpolation: + * ' ` ' (BacktickCharacter | embeddedExpression)* ' ` ' + * ; + */ + +let name = true; +`Hello, my name is ${name}.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_thisExpression.ets new file mode 100644 index 0000000000..6e0e7605e6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_thisExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class ThisExample { + public field: boolean; + constructor() { + this.field = true; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_throwStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_throwStatement.ets new file mode 100644 index 0000000000..f61895e130 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_throwStatement.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.14 + * throwStatement: + * 'throw' expression + * ; + */ + +throw new Error("boolean: " + true); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topDeclaration.ets new file mode 100644 index 0000000000..c9e41d1945 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topDeclaration.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +export let x: boolean = true, y: boolean = false; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topLevelStatements.ets new file mode 100644 index 0000000000..da22ffcd1d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_topLevelStatements.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement * + * ; + */ + +let a: boolean = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_trailingLambdaCall.ets new file mode 100644 index 0000000000..501b2f7f63 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_trailingLambdaCall.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + methodTwo(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.methodTwo(true) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tryStatement.ets new file mode 100644 index 0000000000..6d00cbab89 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tryStatement.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processOne(): boolean { + try { + const res = true; + return res; + } catch (error) { + return false; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tupleType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tupleType.ets new file mode 100644 index 0000000000..ae1f2ea471 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_tupleType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + */ + +let tup: [boolean, number, boolean, number] = [false, 1, true, 10]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeOfExpression.ets new file mode 100644 index 0000000000..0ddd5ce38a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeOfExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let s: boolean = true; +typeof s; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeParameters.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeParameters.ets new file mode 100644 index 0000000000..22d578c0c7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_typeParameters.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 5.1 + * typeParameters: + * '<' typeParameterList '>' + * ; + */ + +class C1 { + public a: boolean = true; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unaryExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unaryExpression.ets new file mode 100644 index 0000000000..e4b48d70fd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unaryExpression.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 7.20 + * unaryExpression: + * expression '++' + * | expression '--' + * | '++' expression + * | '--' expression + * | '+' expression + * | '-' expression + * | '~' expression + * | '!' expression + * ; + */ + +!true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unionType.ets new file mode 100644 index 0000000000..de9d71f44f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_unionType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let u: string | boolean = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_variableDeclarations.ets new file mode 100644 index 0000000000..ddfec5d01b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_variableDeclarations.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let v: boolean = true; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_whileStatement.ets new file mode 100644 index 0000000000..bc2f7a402c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/BooleanLiteral/BooleanLiteral_whileStatement.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.5 + * BooleanLiteral: + * 'true' | 'false' + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +let m = true; +while(m) { + m = false; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_NullLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_NullLiteral.ets new file mode 100644 index 0000000000..7c93b8fd38 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_NullLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 2.9.8 + * NullLiteral: + * 'null' + * ; + */ + +let n = null; +let mulStr = `This is a + multi-line string literal.`; + +let result = mulStr + n; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_UndefinedLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_UndefinedLiteral.ets new file mode 100644 index 0000000000..6e3d77039d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_UndefinedLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + */ + +let und = undefined; +let mulStr = `This is a + multi-line string literal.`; + +let result = mulStr + und; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_additiveExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_additiveExpression.ets new file mode 100644 index 0000000000..49438e40f1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_additiveExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.22 + * additiveExpression: + * expression '+' expression + * | expression '-' expression + * ; + */ + +`This is a + multi-line string literal.` + `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayLiteral.ets new file mode 100644 index 0000000000..26e1013f9d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayLiteral.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let x5 = [1, 2, `This is a + multi-line string literal.`]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayType.ets new file mode 100644 index 0000000000..73401f96ab --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_arrayType.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 3.17.1 + * arrayType: + * type '[' ']' + * ; + */ + +let arr: string[] = [`This is a + multi-line string literal.`, `This is a + multi-line string literal.`]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_assignmentExpression.ets new file mode 100644 index 0000000000..63c53003db --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_assignmentExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + */ + +let a = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_awaitExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_awaitExpression.ets new file mode 100644 index 0000000000..1490afe254 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_awaitExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 17.16.2 + * awaitExpression: + * 'await' expression + * ; + */ + +function foo(): Promise { + return new Promise((resolve, reject) => { + resolve(`This is a + multi-line string literal.`); + }); +} +const res = await foo(); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_classInitializer.ets new file mode 100644 index 0000000000..627d294ead --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_classInitializer.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class ExampleClass1 { + static initialized = `This is a + multi-line string literal.`; + static initializerBlock() { + if (ExampleClass1.initialized == `This is a + multi-line string literal.`) { + ExampleClass1.initialized = `This is a + multi-line string literal.`; + } + } +} + diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalAndExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalAndExpression.ets new file mode 100644 index 0000000000..c954407f2a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalAndExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.27 + * conditionalAndExpression: + * expression '&&' expression + * ; + */ + +`This is a + multi-line string literal.` && `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalExpression.ets new file mode 100644 index 0000000000..b7de23c8f8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.30 + * conditionalExpression: + * expression '?' expression ':' expression + * ; + */ + +(7 > 5) ? `This is a + multi-line string literal.` : 5; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalOrExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalOrExpression.ets new file mode 100644 index 0000000000..343a37deb0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_conditionalOrExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.28 + * conditionalOrExpression: + * expression '||' expression + * ; + */ + +`This is a + multi-line string literal.` || `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantDeclarations.ets new file mode 100644 index 0000000000..06fd410223 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantDeclarations.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const c: string = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantExpression.ets new file mode 100644 index 0000000000..868ffd1f72 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_constantExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const a = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ensureNotNullishExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ensureNotNullishExpression.ets new file mode 100644 index 0000000000..128576b562 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ensureNotNullishExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.18 + * ensureNotNullishExpression: + * expression '!' + * ; + */ + +`This is a + multi-line string literal.`!; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_equalityExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_equalityExpression.ets new file mode 100644 index 0000000000..b30315c39b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_equalityExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.25 + * equalityExpression: + * expression ('==' | '===' | '!=' | '!==') expression + * ; + */ + +`This is a + multi-line string literal.` == `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_expression.ets new file mode 100644 index 0000000000..41358d0a9c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_expression.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +const a = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_fieldAccessExpression.ets new file mode 100644 index 0000000000..b2ddbf1111 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_fieldAccessExpression.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person1 { + name: string = `This is a + multi-line string literal.`; +} + +let person = new Person1(); +person.name = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_finallyClause.ets new file mode 100644 index 0000000000..6c853bf808 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_finallyClause.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +function processOne() { + try { + } catch (error) { + } finally { + const res = `This is a + multi-line string literal.`; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forOfStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forOfStatement.ets new file mode 100644 index 0000000000..0828fbe7af --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forOfStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.9 + * forOfStatement: + * 'for' '(' forVariable 'of' expression ')' statement + * ; + */ + +let arr = ['1', '2', `This is a + multi-line string literal.`]; +let item: string = `This is a + multi-line string literal.`; +for (item of arr) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forStatement.ets new file mode 100644 index 0000000000..61ce32a3e2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_forStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +let a = `This is a + multi-line string literal.`; +for (let i = 0; i < a.length; i++) { + if (true) { + break; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_functionCallExpression.ets new file mode 100644 index 0000000000..cb13c774bd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_functionCallExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ('?.' | typeArguments)? arguments block? + * ; + */ + +function func1(x: string): number { + return 0; +} + +func1(`This is a + multi-line string literal.`); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ifStatement.ets new file mode 100644 index 0000000000..c64d70691f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_ifStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if (true) { + console.log(`This is a + multi-line string literal.`); +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_indexingExpression.ets new file mode 100644 index 0000000000..461d95f3b0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_indexingExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +let strings = [`This is a + multi-line string literal.`, '2', '3', '4', '5']; +strings[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_instanceOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_instanceOfExpression.ets new file mode 100644 index 0000000000..035c336e42 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_instanceOfExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.16 + * instanceOfExpression: + * expression 'instanceof' type + * ; + */ + +`This is a + multi-line string literal.` instanceof string; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpression.ets new file mode 100644 index 0000000000..e83231daec --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +let result = async (): Promise => { + let a = `This is a + multi-line string literal.` + return a; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000..0f9d2b1cc3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_lambdaExpressionWithReceiver.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result4 = (this: A): string => { return `This is a + multi-line string literal.`; }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_loopStatement.ets new file mode 100644 index 0000000000..45df1e2c31 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_loopStatement.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while(`This is a + multi-line string literal.`) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_methodCallExpression.ets new file mode 100644 index 0000000000..ba9f674305 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_methodCallExpression.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class Person2 { + name: string = `This is a + multi-line string literal.`; + setName(name: string): void { + this.name = name; + } +} + +let person = new Person2(); +person.setName(`This is a + multi-line string literal.`); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_namespaceDeclaration.ets new file mode 100644 index 0000000000..19bc85478c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_namespaceDeclaration.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace NS1 { + let a: string = `This is a + multi-line string literal.`; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newArrayInstance.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newArrayInstance.ets new file mode 100644 index 0000000000..f141d90beb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newArrayInstance.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 17.3 + * newArrayInstance: + * 'new' arrayElementType dimensionExpression+ (arrayElement)? + * ; + */ + +let a = new string[1]; +a[0] = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newExpression.ets new file mode 100644 index 0000000000..8c15140da3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_newExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class D { + constructor(p: string) {} +} + +new D(`This is a + multi-line string literal.`); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_nullishCoalescingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_nullishCoalescingExpression.ets new file mode 100644 index 0000000000..dc6b4b33d3 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_nullishCoalescingExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.19 + * nullishCoalescingExpression: + * expression '??' expression + * ; + */ + +`This is a + multi-line string literal.` ?? 42; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectLiteral.ets new file mode 100644 index 0000000000..d552333995 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectLiteral.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + name: string = `This is a + multi-line string literal.`; + age: number = 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectReference.ets new file mode 100644 index 0000000000..42d50a6bb2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_objectReference.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +let a: string = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_optionalParameter.ets new file mode 100644 index 0000000000..6057ba6ee8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_optionalParameter.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier '?' ':' type + * ; + */ + +function pair(x: number, y: string = `This is a + multi-line string literal.`) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parameterList.ets new file mode 100644 index 0000000000..e91f4aeacb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parameterList.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function func1(x: number, y: string = `This is a + multi-line string literal.`): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parenthesizedExpression.ets new file mode 100644 index 0000000000..d244f32122 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_parenthesizedExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +let y6 = (`This is a + multi-line string literal.`); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_relationalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_relationalExpression.ets new file mode 100644 index 0000000000..f825a5dbf0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_relationalExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.24 + * relationalExpression: + * expression '<' expression + * | expression '>' expression + * | expression '<=' expression + * | expression '>=' expression + * ; + */ + +`This is a + multi-line string literal.` < `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_restParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_restParameter.ets new file mode 100644 index 0000000000..fb01657f07 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_restParameter.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 4.8.5 + * restParameter: + * annotationUsage? '...' identifier ':' type + * ; + */ + +function sum(...string: string[]): number { + return 0; +} + +let x: string[] = [`This is a + multi-line string literal.`, `This is a + multi-line string literal.`] +sum(...x); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_returnStatement.ets new file mode 100644 index 0000000000..a99a278349 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_returnStatement.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add(string2: string, string1: string = `This is a + multi-line string literal.`) { + return string1 + string2; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_separateModuleDeclaration.ets new file mode 100644 index 0000000000..33b7db0970 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_separateModuleDeclaration.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +console.log(`This is a + multi-line string literal.`); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_signature.ets new file mode 100644 index 0000000000..cb37f6b01c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_signature.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function func1(x: string): string { + return `This is a + multi-line string literal.`; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_spreadExpression.ets new file mode 100644 index 0000000000..52af425dbc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_spreadExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + *Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let array1 = [1, 2, `This is a + multi-line string literal.`]; +let array2 = [4, `This is a + multi-line string literal.`]; +let array3 = [...array1, ...array2]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_statement.ets new file mode 100644 index 0000000000..b8699c0ffa --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_statement.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throw Statement + * | tryStatement + * ; + */ + +let x = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_stringInterpolation.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_stringInterpolation.ets new file mode 100644 index 0000000000..ddf5708661 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_stringInterpolation.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.31 + * stringInterpolation: + * ' ` ' (BacktickCharacter | embeddedExpression)* ' ` ' + * ; + */ + +let name = `This is a + multi-line string literal.`; +`Hello, my name is ${name}.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_switchStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_switchStatement.ets new file mode 100644 index 0000000000..cbc4466c24 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_switchStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.13 + * switchStatement: + * (identifier ':')? 'switch' '(' expression ')' switchBlock + * ; + */ + +let name = `This is a + multi-line string literal.`; +switch (name) { + case '1': break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_thisExpression.ets new file mode 100644 index 0000000000..3386720143 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_thisExpression.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class ThisExample { + public field: string; + constructor() { + this.field = `This is a + multi-line string literal.`; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_throwStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_throwStatement.ets new file mode 100644 index 0000000000..87a8505994 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_throwStatement.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.14 + * throwStatement: + * 'throw' expression + * ; + */ + +throw new Error(`This is a + multi-line string literal.`); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topDeclaration.ets new file mode 100644 index 0000000000..3f24e9531a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topDeclaration.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +export const x: string = `This is a + multi-line string literal.` diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topLevelStatements.ets new file mode 100644 index 0000000000..35e3f602db --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_topLevelStatements.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement * + * ; + */ + +let a: string = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_trailingLambdaCall.ets new file mode 100644 index 0000000000..faa9bc1b0d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_trailingLambdaCall.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + methodTwo(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.methodTwo(`This is a + multi-line string literal.`) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tryStatement.ets new file mode 100644 index 0000000000..0a7282096e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tryStatement.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processOne(): string { + try { + const res = `This is a + multi-line string literal.`; + return res; + } catch (error) { + return '-1'; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tupleType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tupleType.ets new file mode 100644 index 0000000000..9552322415 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_tupleType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + */ + +let tup: [string, number] = [`This is a + multi-line string literal.`, 1]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeOfExpression.ets new file mode 100644 index 0000000000..04907644f1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeOfExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let s: string = `This is a + multi-line string literal.`; +typeof s; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeParameters.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeParameters.ets new file mode 100644 index 0000000000..c90d316029 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_typeParameters.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 5.1 + * typeParameters: + * '<' typeParameterList '>' + * ; + */ + +class C1 { + public a: string = `This is a + multi-line string literal.`; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unaryExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unaryExpression.ets new file mode 100644 index 0000000000..901461ddee --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unaryExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 7.20 + * unaryExpression: + * expression '++' + * | expression '--' + * | '++' expression + * | '--' expression + * | '+' expression + * | '-' expression + * | '~' expression + * | '!' expression + * ; + */ + +!`This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unionType.ets new file mode 100644 index 0000000000..5cc61857c2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_unionType.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let u: string | number = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_variableDeclarations.ets new file mode 100644 index 0000000000..5a09d38e73 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_variableDeclarations.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let v: string = `This is a + multi-line string literal.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_whileStatement.ets new file mode 100644 index 0000000000..a2f0094414 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/MultilineStringLiteral/MultilineStringLiteral_whileStatement.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.7 + * MultilineStringLiteral: + * ' ` ' (BacktickCharacter)* ' ` ' + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +let m = `This is a + multi-line string literal.`; +while(m) { + m = `This is a + multi-line string literal.`; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayLiteral.ets new file mode 100644 index 0000000000..e9964b9551 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayLiteral.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let x5 = [undefined, 2, 3]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayType.ets new file mode 100644 index 0000000000..8010c34c70 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_arrayType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 3.17.1 + * arrayType: + * type '[' ']' + * ; + */ + +let arr: undefined[] = [undefined, undefined]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_assignmentExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_assignmentExpression.ets new file mode 100644 index 0000000000..7300bf530b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_assignmentExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.29 + * assignmentExpression: + * lhsExpression assignmentOperator rhsExpression + * ; + */ + +let a = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_awaitExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_awaitExpression.ets new file mode 100644 index 0000000000..2d013ae930 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_awaitExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 17.16.2 + * awaitExpression: + * 'await' expression + * ; + */ + +function foo(): Promise { + return new Promise((resolve, reject) => { + resolve(undefined); + }); +} +const res = await foo(); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_classInitializer.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_classInitializer.ets new file mode 100644 index 0000000000..ad8a4b17e2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_classInitializer.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 9.8 + * classInitializer: + * initializerBlock + * ; + */ + +class ExampleClass1 { + static initialized = undefined; + static initializerBlock() { + if (ExampleClass1.initialized === undefined) { + ExampleClass1.initialized = undefined; + } + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalAndExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalAndExpression.ets new file mode 100644 index 0000000000..e884d02766 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalAndExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.27 + * conditionalAndExpression: + * expression '&&' expression + * ; + */ + +undefined && undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalExpression.ets new file mode 100644 index 0000000000..b41eefc677 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.30 + * conditionalExpression: + * expression '?' expression ':' expression + * ; + */ + +(7 > 5) ? undefined : 5; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalOrExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalOrExpression.ets new file mode 100644 index 0000000000..93a4e5e991 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_conditionalOrExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.28 + * conditionalOrExpression: + * expression '||' expression + * ; + */ + +undefined || undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantDeclarations.ets new file mode 100644 index 0000000000..1d9d3c0909 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantDeclarations.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 4.7.2 + * constantDeclarations: + * 'const' constantDeclarationList + * ; + */ + +const c: undefined = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantExpression.ets new file mode 100644 index 0000000000..7609a15447 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_constantExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.33 + * constantExpression: + * expression + * ; + */ + +const s = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ensureNotNullishExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ensureNotNullishExpression.ets new file mode 100644 index 0000000000..4ee492284e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ensureNotNullishExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.18 + * ensureNotNullishExpression: + * expression '!' + * ; + */ + +!undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_equalityExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_equalityExpression.ets new file mode 100644 index 0000000000..b2f62e113b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_equalityExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.25 + * equalityExpression: + * expression ('==' | '===' | '!=' | '!==') expression + * ; + */ + +undefined == undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_expression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_expression.ets new file mode 100644 index 0000000000..32abe8181e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_expression.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7 + * expression: + * primaryExpression + * | castExpression + * | instanceOfExpression + * | typeOfExpression + * | nullishCoalescingExpression + * | spreadExpression + * | unaryExpression + * | binaryExpression + * | assignmentExpression + * | conditionalExpression + * | stringInterpolation + * | lambdaExpression + * | lambdaExpressionWithReceiver + * | launchExpression + * | awaitExpression + * ; + */ + +const a = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_fieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_fieldAccessExpression.ets new file mode 100644 index 0000000000..fc344a0fcb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_fieldAccessExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person1 { + name: undefined = undefined; +} + +let person = new Person1(); +person.name = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_finallyClause.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_finallyClause.ets new file mode 100644 index 0000000000..12bde76599 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_finallyClause.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.15.2 + * finallyClause: + * 'finally' block + * ; + */ + +function processOne() { + try { + } catch (error) { + } finally { + const res = undefined; + } +} \ No newline at end of file diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forOfStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forOfStatement.ets new file mode 100644 index 0000000000..701db37356 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forOfStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.9 + * forOfStatement: + * 'for' '(' forVariable 'of' expression ')' statement + * ; + */ + +let arr = [undefined]; +let item: undefined = undefined; +for (item of arr) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forStatement.ets new file mode 100644 index 0000000000..82ad097582 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_forStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.8 + * forStatement: + * 'for' '(' forInit? ';' forContinue? ';' forUpdate? ')' statement + * ; + */ + +let i: undefined = undefined; +for (; i != undefined; i = undefined) { + if (true) { + break; + } +} + diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionCallExpression.ets new file mode 100644 index 0000000000..507fcc307f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionCallExpression.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.11 + * functionCallExpression: + * expression ('?.' | typeArguments)? arguments block? + * ; + */ + +function func1(x: undefined): undefined { + return undefined; +} + +func1(undefined); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionType.ets new file mode 100644 index 0000000000..2c2905e8fd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_functionType.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 3.19 + * functionType: + * '(' ftParameterList? ')' ftReturnType + * ; + */ + +type t = undefined; + +type aaa = (action: t) => undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ifStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ifStatement.ets new file mode 100644 index 0000000000..0c4108d6dc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_ifStatement.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.5 + * ifStatement: + * 'if' '(' expression ')' thenStatement + * ('else' elseStatement)? + * ; + */ + +if (true) { + console.log("undefined " + undefined); +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_indexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_indexingExpression.ets new file mode 100644 index 0000000000..e6edd75535 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_indexingExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +let undef = [undefined, 2, undefined, 4, undefined]; +undef[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_initializerBlock.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_initializerBlock.ets new file mode 100644 index 0000000000..6c0a176f99 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_initializerBlock.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 15.10 + * initializerBlock: + * 'static' block + * ; + */ + +class Test { + static initializerBlock() { + let undef = undefined; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_instanceOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_instanceOfExpression.ets new file mode 100644 index 0000000000..b7ed7b775c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_instanceOfExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.16 + * instanceOfExpression: + * expression 'instanceof' type + * ; + */ + +undefined instanceof undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpression.ets new file mode 100644 index 0000000000..2e1eabb0de --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpression.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.32 + * lambdaExpression: + * annotationUsage? ('async'|typeParameters)? lambdaSignature '=>' lambdaBody + * ; + */ + +let result = async (x: undefined): Promise => { + return x; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000..8eca9b8da0 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_lambdaExpressionWithReceiver.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter (',' lambdaParameterList)? ')' + * returnType? throwMark? '=>' lambdaBody + * ; + */ + +class A {} +let result4 = (this: A): undefined => { return undefined; }; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_loopStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_loopStatement.ets new file mode 100644 index 0000000000..1cea29d06d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_loopStatement.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.6 + * loopStatement: + * (identifier ':')? + * whileStatement + * | doStatement + * | forStatement + * | forOfStatement + * ; + */ + +while(undefined) { + break; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_methodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_methodCallExpression.ets new file mode 100644 index 0000000000..9b70db7d94 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_methodCallExpression.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class Person2 { + name: undefined = undefined; + setName(name: undefined): void { + this.name = name; + } +} + +let person = new Person2(); +person.setName(undefined); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_namespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_namespaceDeclaration.ets new file mode 100644 index 0000000000..04b7990f79 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_namespaceDeclaration.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 13.8 + * namespaceDeclaration: + * 'namespace' qualifiedName + * '{' topDeclaration* initializerBlock? topDeclaration* '}' + * ; + */ + +namespace NS1 { + let a: undefined = undefined; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_newExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_newExpression.ets new file mode 100644 index 0000000000..c8bfb036dd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_newExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class D { + constructor(p: undefined) {} +} + +new D(undefined); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_nullishCoalescingExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_nullishCoalescingExpression.ets new file mode 100644 index 0000000000..0a15f639ae --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_nullishCoalescingExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.19 + * nullishCoalescingExpression: + * expression '??' expression + * ; + */ + +undefined ?? 42; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectLiteral.ets new file mode 100644 index 0000000000..0cacf2ef4c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectLiteral.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + name: undefined = undefined; + age: undefined = undefined; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectReference.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectReference.ets new file mode 100644 index 0000000000..79e637202f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_objectReference.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + */ + +let a: undefined = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_optionalParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_optionalParameter.ets new file mode 100644 index 0000000000..4b9edced37 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_optionalParameter.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 4.8.4 + * optionalParameter: + * identifier ':' type '=' expression + * | identifier '?' ':' type + * ; + */ + +function pair(x: undefined, y: undefined = undefined) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parameterList.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parameterList.ets new file mode 100644 index 0000000000..2d20e9d26b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parameterList.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 4.8.2 + * parameterList: + * parameter (',' parameter)* (',' restParameter)? ','? + * | restParameter ','? + * ; + */ + +function func1(x: undefined, y: undefined): number { + return 0; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parenthesizedExpression.ets new file mode 100644 index 0000000000..6db569893f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_parenthesizedExpression.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +let y6 = (undefined); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_restParameter.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_restParameter.ets new file mode 100644 index 0000000000..3517e0b2e6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_restParameter.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 4.8.5 + * restParameter: + * annotationUsage? '...' identifier ':' type + * ; + */ + +function sum(...undefineds: undefined[]): undefined { + return undefined; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_returnStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_returnStatement.ets new file mode 100644 index 0000000000..ca859e7c41 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_returnStatement.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.12 + * returnStatement: + * 'return' expression? + * ; + */ + +function add(undef: undefined) { + return undef; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_separateModuleDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_separateModuleDeclaration.ets new file mode 100644 index 0000000000..663ba94d8c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_separateModuleDeclaration.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 13.1 + * separateModuleDeclaration: + * importDirective* (topDeclaration | topLevelStatements | exportDirective)* + * ; + */ + +console.log('undefined: ' + undefined) diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_signature.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_signature.ets new file mode 100644 index 0000000000..7f62fae1b7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_signature.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 4.8.1 + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +function func1(x: undefined): undefined { + return undefined; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_spreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_spreadExpression.ets new file mode 100644 index 0000000000..9d93daf3e7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_spreadExpression.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + *Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let array1 = [undefined, 2, 3]; +let array2 = [4, undefined]; +let array3 = [...array1, ...array2]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_statement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_statement.ets new file mode 100644 index 0000000000..a22d5208ff --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_statement.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8 + * statement: + * expressionStatement + * | block + * | localDeclaration + * | ifStatement + * | loopStatement + * | breakStatement + * | continueStatement + * | returnStatement + * | switchStatement + * | throw Statement + * | tryStatement + * ; + */ + +let x = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_stringInterpolation.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_stringInterpolation.ets new file mode 100644 index 0000000000..cd9ab19e40 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_stringInterpolation.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.31 + * stringInterpolation: + * ' ` ' (BacktickCharacter | embeddedExpression)* ' ` ' + * ; + */ + +let name = undefined; +`Hello, my name is ${name}.`; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_thisExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_thisExpression.ets new file mode 100644 index 0000000000..75cbc1a149 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_thisExpression.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.8 + * thisExpression: + * 'this' + * ; + */ + +class ThisExample { + public field: undefined; + constructor() { + this.field = undefined; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_throwStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_throwStatement.ets new file mode 100644 index 0000000000..85bfeee3f1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_throwStatement.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.14 + * throwStatement: + * 'throw' expression + * ; + */ + +let a = undefined; +throw new Error(`error ${a} ` + undefined); diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topDeclaration.ets new file mode 100644 index 0000000000..1768c3b87b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topDeclaration.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 13.7 + * topDeclaration: + * ('export' 'default'?)? + * annotationUsage? + * ( typeDeclaration + * | variableDeclarations + * | constantDeclarations + * | functionDeclaration + * | functionWithReceiverDeclaration + * | accessorWithReceiverDeclaration + * | namespaceDeclaration + * ) + * ; + */ + +export let x: undefined[], y: undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topLevelStatements.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topLevelStatements.ets new file mode 100644 index 0000000000..5f848144bb --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_topLevelStatements.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 13.10 + * topLevelStatements: + * statement * + * ; + */ + +let a: undefined = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_trailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_trailingLambdaCall.ets new file mode 100644 index 0000000000..c80dce42dd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_trailingLambdaCall.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + */ + +class A { + methodTwo(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} +let a = new A(); +a.methodTwo(undefined) {} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tryStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tryStatement.ets new file mode 100644 index 0000000000..9808b40fbd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tryStatement.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.15 + * tryStatement: + * 'try' block catchClauses finallyClause? + * ; + */ + +function processOne(a: undefined): undefined { + try { + const res = undefined; + return res; + } catch (error) { + return a; + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tupleType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tupleType.ets new file mode 100644 index 0000000000..c1da1fef04 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_tupleType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 3.18 + * tupleType: + * '[' (type (',' type)* ','?)? ']' + * ; + */ + +let tup: [undefined, boolean, number] = [undefined, true, 10]; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeArguments.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeArguments.ets new file mode 100644 index 0000000000..9413288e89 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeArguments.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 5.2.1 + * typeArguments: + * '<' type(','type)* '>' + * ; + */ + +let a: Array<[number, null, undefined]>; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeOfExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeOfExpression.ets new file mode 100644 index 0000000000..82cefef45e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeOfExpression.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.17 + * typeOfExpression: + * 'typeof' expression + * ; + */ + +let s: undefined = undefined; +typeof s; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeParameters.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeParameters.ets new file mode 100644 index 0000000000..d2c775c3cf --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_typeParameters.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 5.1 + * typeParameters: + * '<' typeParameterList '>' + * ; + */ + +class C1 { + public a: undefined = undefined; +} diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unaryExpression.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unaryExpression.ets new file mode 100644 index 0000000000..b4c6236bed --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unaryExpression.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 7.20 + * unaryExpression: + * expression '++' + * | expression '--' + * | '++' expression + * | '--' expression + * | '+' expression + * | '-' expression + * | '~' expression + * | '!' expression + * ; + */ + +!undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unionType.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unionType.ets new file mode 100644 index 0000000000..521aa72fe1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_unionType.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 3.20 + * unionType: + * type ('|' type)* + * ; + */ + +let u: undefined | number = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_variableDeclarations.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_variableDeclarations.ets new file mode 100644 index 0000000000..9dbffd7eb1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_variableDeclarations.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 4.7.1 + * variableDeclarations: + * 'let' variableDeclarationList + * ; + */ + +let v: undefined = undefined; diff --git a/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_whileStatement.ets b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_whileStatement.ets new file mode 100644 index 0000000000..52e873cf05 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec_orthogonality/2_lexical_elements/UndefinedLiteral/UndefinedLiteral_whileStatement.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.9 + * UndefinedLiteral: + * 'undefined' + * ; + * + * CHAPTER 8.7 + * whileStatement: + * 'while' '(' expression ')' statement + * ; + */ + +let m = 5; +let n = 3; +while(undefined) { + m--; +} -- Gitee