From e53b9ce2bff4fca21ab3f067deed1febfb5af5e6 Mon Sep 17 00:00:00 2001 From: liujia178 Date: Fri, 13 Jun 2025 06:55:48 +0800 Subject: [PATCH] test: Add specification test cases Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/IBWNGZ?from=project-issue Signed-off-by: liujia178 --- .../ambientAccessModifier.ets | 26 ++++ .../ambientAccessorDeclaration.ets | 41 +++++++ .../ambientClassBodyDeclaration.ets | 105 ++++++++++++++++ .../ambientClassDeclaration.ets | 115 ++++++++++++++++++ .../ambientConstructorDeclaration.ets | 26 ++++ .../ambientFieldDeclaration.ets | 51 ++++++++ .../ambientIndexerDeclaration.ets | 37 ++++++ .../ambientInterfaceDeclaration.ets | 67 ++++++++++ .../ambientInterfaceMember.ets | 56 +++++++++ .../ambientMethodDeclaration.ets | 36 ++++++ .../ambientNamespaceDeclaration.ets | 35 ++++++ .../ambientNamespaceElement.ets | 43 +++++++ .../ambientNamespaceElementDeclaration.ets | 82 +++++++++++++ .../AwaitExpression.ets | 25 ++++ .../FunctionTypeWithReceiver.ets | 38 ++++++ .../FunctionWithReceiverDeclaration.ets | 35 ++++++ .../LambdaExpressionWithReceiver.ets | 75 ++++++++++++ .../ImportDirective.ets | 35 ++++++ .../ImportDirectivePackageTopDeclaration.ets | 39 ++++++ .../PackageTopDeclaration.ets | 36 ++++++ .../PackageTopDeclaration.ets | 38 ++++++ .../PrepareForImportDirective.ets | 34 ++++++ .../ReceiverParameter.ets | 39 ++++++ .../SignatureWithReceiver.ets | 47 +++++++ .../SingleQuoteCharacterError.ets | 32 +++++ .../TrailingLambdaCall.ets | 69 +++++++++++ .../arrayElementType.ets | 27 ++++ .../characterLiterals.ets | 29 +++++ .../interfaceDefaultMethodDeclaration.ets | 27 ++++ .../newArrayInstance.ets | 44 +++++++ .../AmbientAnnotationDeclaration.ets | 23 ++++ .../18_annotations/AnnotationDeclaration.ets | 28 +++++ .../spec/18_annotations/AnnotationField.ets | 33 +++++ .../spec/18_annotations/AnnotationUsage.ets | 35 ++++++ .../spec/18_annotations/AnnotationValues.ets | 41 +++++++ .../BacktickCharacterError.ets | 30 +++++ .../DoubleQuoteCharacterError.ets | 26 ++++ .../EscapeSequenceError.ets | 73 +++++++++++ .../SingleQuoteCharacterError.ets | 26 ++++ .../ets/spec/7_expressions/ArrayLiteral.ets | 25 ++++ .../spec/7_expressions/ExpressionSequence.ets | 29 +++++ .../7_expressions/FieldAccessExpression.ets | 30 +++++ .../7_expressions/FunctionCallExpression.ets | 63 ++++++++++ .../spec/7_expressions/IndexingExpression.ets | 27 ++++ .../spec/7_expressions/KeyValueSequence.ets | 43 +++++++ .../7_expressions/MethodCallExpression.ets | 45 +++++++ .../ets/spec/7_expressions/NamedReference.ets | 27 ++++ .../spec/7_expressions/NewClassInstance.ets | 37 ++++++ .../ets/spec/7_expressions/NewExpression.ets | 29 +++++ .../ets/spec/7_expressions/ObjectLiteral.ets | 29 +++++ .../7_expressions/ParenthesizedExpression.ets | 23 ++++ .../ets/spec/7_expressions/RecordLiteral.ets | 28 +++++ .../spec/7_expressions/SpreadExpression.ets | 25 ++++ .../ets/spec/7_expressions/ThisExpression.ets | 29 +++++ .../ets/spec/7_expressions/ValueSequence.ets | 37 ++++++ .../astchecker/astchecker-ets-ignored.txt | 7 ++ .../srcdumper/srcdumper-ets-ignored.txt | 17 +++ 57 files changed, 2254 insertions(+) create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientAccessModifier.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientAccessorDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientClassBodyDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientClassDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientConstructorDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientFieldDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientIndexerDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientInterfaceDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientInterfaceMember.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientMethodDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceElement.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceElementDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/AwaitExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/FunctionTypeWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/FunctionWithReceiverDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/LambdaExpressionWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/ImportDirective.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/ImportDirectivePackageTopDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/PackageTopDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageTopDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PrepareForImportDirective.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/ReceiverParameter.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/SignatureWithReceiver.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/SingleQuoteCharacterError.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/TrailingLambdaCall.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/arrayElementType.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/characterLiterals.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/interfaceDefaultMethodDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/17_experimental_features/newArrayInstance.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/18_annotations/AmbientAnnotationDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationDeclaration.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationField.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationUsage.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationValues.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/BacktickCharacterError.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/DoubleQuoteCharacterError.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/EscapeSequenceError.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/SingleQuoteCharacterError.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/ArrayLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/ExpressionSequence.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/FieldAccessExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/FunctionCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/IndexingExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/KeyValueSequence.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/MethodCallExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/NamedReference.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/NewClassInstance.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/NewExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/ObjectLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/ParenthesizedExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/RecordLiteral.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/SpreadExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/ThisExpression.ets create mode 100644 ets2panda/test/ast/compiler/ets/spec/7_expressions/ValueSequence.ets diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientAccessModifier.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientAccessModifier.ets new file mode 100644 index 0000000000..03414fe4fc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientAccessModifier.ets @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 14.3 + * ambientAccessModifier: + * 'public'|'protected' + * ; + */ + +declare class AmbientClass { + public static name: string; + protected static age: number; +} diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientAccessorDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientAccessorDeclaration.ets new file mode 100644 index 0000000000..9068467598 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientAccessorDeclaration.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 14.3 + * ambientAccessorDeclaration: + * ambientMethodModifier* + * ('get' identifier'('')'returnType + * |'set' identifier'('parameter')' + * ) + * ; + * + * ambientMethodModifier: + * 'static' + * ; + * + * identifier: Identifier; + * + * returnType: + * ':' type + * ; + */ + +declare class AmbientClass { + get name(): string; + set name(name: string); + static get age(): number; + static set age(age: number); +} diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientClassBodyDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientClassBodyDeclaration.ets new file mode 100644 index 0000000000..2b65dd3cea --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientClassBodyDeclaration.ets @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 14.3 + * ambientClassBodyDeclaration: + * ambientAccessModifier? + * ( ambientFieldDeclaration + * | ambientConstructorDeclaration + * | ambientMethodDeclaration + * | ambientAccessorDeclaration + * | ambientIndexerDeclaration + * | ambientCallSignatureDeclaration + * | ambientIterableDeclaration + * ) + * ; + * + * ambientAccessModifier: + * 'public'|'protected' + * ; + * + * ambientFieldDeclaration: + * ambientFieldModifier* identifier':' type + * ; + * + * ambientConstructorDeclaration: + * 'constructor' parameters throwMark? + * ; + * + * ambientMethodDeclaration: + * ambientMethodModifier* identifier signature + * ; + * + * ambientAccessorDeclaration: + * ambientMethodModifier* + * ('get' identifier'('')'returnType + * |'set' identifier'('parameter')' + * ) + * ; + * + * ambientIndexerDeclaration: + * 'readonly'? '[' identifier ':' indexType ']' returnType + * ; + * + * ambientCallSignatureDeclaration: + * signature + * ; + * + * ambientIterableDeclaration: + * '[Symbol.iterator]' '(' ')' returnType + * ; + */ + +class CIterator implements Iterator { + index = 0 + base: AmbientClass1 + constructor(base: AmbientClass1) { + this.base = base + } + next(): IteratorResult { + return { + done: true, + value: undefined + } + } +} + +declare class AmbientClass1 { + public static name: string; + public constructor(); + public getName(): string; + public get name(): string; + public [index: number]: number; + public $_invoke(a: number): number; + public $_iterator(): CIterator; + + static age: number; + constructor(age: number); + getAge(): number; + get age(): number; +} + +declare class AmbientClass2 { + [index: number]: number; +} + +declare class AmbientClass3 { + $_invoke(a: number): number; +} + +declare class AmbientClass4 { + $_iterator(): CIterator; +} diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientClassDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientClassDeclaration.ets new file mode 100644 index 0000000000..4a44be54af --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientClassDeclaration.ets @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 14.3 + * ambientClassDeclaration: + * 'class' identifier typeParameters? + * classExtendsClause? implementsClause? + * '{' ambientClassBodyDeclaration* '}' + * ; + * + * identifier: Identifier; + * + * typeParameters: + * '<' typeParameterList '>' + * ; + * + * classExtendsClause: + * 'extends' typeReference + * ; + * + * implementsClause: + * 'implements' interfaceTypeList + * ; + * + * ambientClassBodyDeclaration: + * ambientAccessModifier? + * ( ambientFieldDeclaration + * | ambientConstructorDeclaration + * | ambientMethodDeclaration + * | ambientAccessorDeclaration + * | ambientIndexerDeclaration + * | ambientCallSignatureDeclaration + * | ambientIterableDeclaration + * ) + * ; + */ + +interface I1 { foo() {} } + +declare class AmbientClass1 { + static name: string; + readonly age: number; + static gender: string; +} + +declare class AmbientClass2 implements I1 { + static name: string; + readonly age: number; + static gender: string; +} + +declare class AmbientClass3 extends AmbientClass1 { + static name: string; + readonly age: number; + static gender: string; +} + +declare class AmbientClass4 extends AmbientClass2 implements I1 { + static name: string; + readonly age: number; + static gender: string; +} + +declare class AmbientClass5 { + static name: string; + readonly age: number; + static gender: T; +} + +declare class AmbientClass6 implements I1 { + static name: string; + readonly age: number; + static gender: T; +} + +declare class AmbientClass7 extends AmbientClass3 { + static name: string; + readonly age: number; + static gender: T; +} + +declare class AmbientClass8 extends AmbientClass1 implements I1 { + static name: string; + readonly age: number; + static gender: string; +} + +declare class AmbientClass9 {} + +declare class AmbientClass10 implements I1 {} + +declare class AmbientClass11 extends AmbientClass9 {} + +declare class AmbientClass12 extends AmbientClass10 implements I1 {} + +declare class AmbientClass13 {} + +declare class AmbientClass14 implements I1 {} + +declare class AmbientClass15 extends AmbientClass11 {} + +declare class AmbientClass16 extends AmbientClass9 implements I1 {} diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientConstructorDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientConstructorDeclaration.ets new file mode 100644 index 0000000000..ff461526c8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientConstructorDeclaration.ets @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 14.3 + * ambientConstructorDeclaration: + * 'constructor' parameters throwMark? + * ; + */ + +declare class AmbientClass1 { + constructor(name: string); + constructor() throws; +} diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientFieldDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientFieldDeclaration.ets new file mode 100644 index 0000000000..408345505a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientFieldDeclaration.ets @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 14.3 + * ambientFieldDeclaration: + * ambientFieldModifier* identifier':' type + * ; + * + * ambientFieldModifier: + * 'static'|'readonly' + * ; + * + * ambientMethodDeclaration: + * ambientMethodModifier* identifier signature + * ; + * + * identifier: Identifier; + * + * type: + * annotationUsage? + * ( typeReference + * |'readonly'? arrayType + * |'readonly'? tupleType + * | functionType + * | functionTypeWithReceiver + * | unionType + * | StringLiteral + * ) + * |'('type')' + * ; + */ + +declare class AmbientClass { + static name: string; + readonly age: number; + gender: string; + static readonly home: string; +} diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientIndexerDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientIndexerDeclaration.ets new file mode 100644 index 0000000000..e88e5e8595 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientIndexerDeclaration.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 14.3.1 + * ambientIndexerDeclaration: + * 'readonly'? '[' identifier ':' indexType ']' returnType + * ; + * + * identifier: Identifier; + * + * indexType:'number'; + * + * returnType: + * ':' type + * ; + */ + +declare class AmbientClass1 { + [index: number]: number; +} + +declare class AmbientClass2 { + readonly [index: number]: number; +} diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientInterfaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientInterfaceDeclaration.ets new file mode 100644 index 0000000000..a79c99a669 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientInterfaceDeclaration.ets @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 14.4 + * ambientInterfaceDeclaration: + * 'interface' identifier typeParameters? + * interfaceExtendsClause? + * '{' ambientInterfaceMember* '}' + * ; + * + * identifier: Identifier; + * + * typeParameters: + * '<' typeParameterList '>' + * ; + * + * interfaceExtendsClause: + * 'extends' interfaceTypeList + * ; + * + * ambientInterfaceMember + * : interfaceProperty + * | interfaceMethodDeclaration + * | ambientIndexerDeclaration + * | ambientCallSignatureDeclaration + * | ambientIterableDeclaration + * ; + */ + +interface InterfaceExample { foo() {} } + +declare interface AmbientInterface1 extends InterfaceExample { + method(param: T): void; +} + +declare interface AmbientInterface2 extends InterfaceExample { + method(param: string): void; +} + +declare interface AmbientInterface3 { + method(param: T): void; +} + +declare interface AmbientInterface4 { + method(param: string): void; +} + +declare interface AmbientInterface5 extends InterfaceExample {} + +declare interface AmbientInterface6 extends InterfaceExample {} + +declare interface AmbientInterface7 {} + +declare interface AmbientInterface8 {} diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientInterfaceMember.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientInterfaceMember.ets new file mode 100644 index 0000000000..ad44729532 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientInterfaceMember.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 14.4 + * ambientInterfaceMember + * : interfaceProperty + * | interfaceMethodDeclaration + * | ambientIndexerDeclaration + * | ambientCallSignatureDeclaration + * | ambientIterableDeclaration + * ; + * + * interfaceProperty: + * 'readonly'? identifier '?'? ':' type + * | 'get' identifier '(' ')' returnType + * | 'set' identifier '(' parameter ')' + * ; + * + * interfaceMethodDeclaration: + * identifier signature + * | interfaceDefaultMethodDeclaration + * ; + * + * ambientIndexerDeclaration: + * 'readonly'? '[' identifier ':' indexType ']' returnType + * ; + * + * ambientCallSignatureDeclaration: + * signature + * ; + * + * ambientIterableDeclaration: + * '[Symbol.iterator]' '(' ')' returnType + * ; + */ + +interface CIterator { foo() {} } + +declare interface AmbientInterface { + name: string; + getName(): string; + $_invoke(a: number): number; +} diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientMethodDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientMethodDeclaration.ets new file mode 100644 index 0000000000..acfa1ba86d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientMethodDeclaration.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 14.3 + * ambientMethodDeclaration: + * ambientMethodModifier* identifier signature + * ; + * + * ambientMethodModifier: + * 'static' + * ; + * + * identifier: Identifier; + * + * signature: + * '(' parameterList? ')' returnType? + * ; + */ + +declare class AmbientClass { + getName(): number; + static getAge(): number; +} diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceDeclaration.ets new file mode 100644 index 0000000000..dbe171bf94 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceDeclaration.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 14.5 + * ambientNamespaceDeclaration: + * 'namespace' identifier'{'ambientNamespaceElement* '}' + * ; + * + * identifier: Identifier; + * + * ambientNamespaceElement: + * ambientNamespaceElementDeclaration | selectiveExportDirective + * ; + */ + +declare namespace MyNamespace1 {} + +declare namespace MyNamespace2 { + const namespaceElem1: number; + function namespaceElem2(x:number): void; + class namespaceElem3 {} +} diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceElement.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceElement.ets new file mode 100644 index 0000000000..30ca45b093 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceElement.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 14.5 + * ambientNamespaceElement: + * ambientNamespaceElementDeclaration | selectiveExportDirective + * ; + * + * ambientNamespaceElementDeclaration: + * 'export'? + * ( ambientConstantDeclaration + * | ambientFunctionDeclaration + * | ambientClassDeclaration + * | ambientInterfaceDeclaration + * | ambientNamespaceDeclaration + * |'const'?enumDeclaration + * | typeAlias + * ) + * ; + * + * selectiveExportDirective: + * 'export' selectiveBindings + * ; + */ + +declare namespace MyNamespace { + interface namespaceElem1 {} + namespace namespaceElem2 {} + export {namespaceElem1, namespaceElem2} +} diff --git a/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceElementDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceElementDeclaration.ets new file mode 100644 index 0000000000..c3fd83b53d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceElementDeclaration.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 14.5 + * ambientNamespaceElementDeclaration: + * 'export'? + * ( ambientConstantDeclaration + * | ambientFunctionDeclaration + * | ambientClassDeclaration + * | ambientInterfaceDeclaration + * | ambientNamespaceDeclaration + * |'const'?enumDeclaration + * | typeAlias + * ) + * ; + * + * ambientConstantDeclaration: + * 'const' ambientConstList';' + * ; + * + * ambientFunctionDeclaration: + * 'function'identifier + * typeParameters?signature + * ; + * + * ambientClassDeclaration: + * 'class' identifier typeParameters? + * classExtendsClause? implementsClause? + * '{' ambientClassBodyDeclaration* '}' + * ; + * + * ambientInterfaceDeclaration: + * 'interface' identifier typeParameters? + * interfaceExtendsClause? + * '{' ambientInterfaceMember* '}' + * ; + * + * ambientNamespaceDeclaration: + * 'namespace' identifier'{'ambientNamespaceElement* '}' + * ; + * + * enumDeclaration: + * 'const'? 'enum' identifier '{' enumConstantList '}' + * ; + * + * typeAlias: + * 'type' identifier typeParameters?'='type + * ; + */ + +declare namespace MyNamespace { + const namespaceElem1: number; + function namespaceElem2(x:number): void; + class namespaceElem3 {} + interface namespaceElem4 {} + namespace namespaceElem5 {} + enum namespaceElem6 { Red, Green, Blue } + const enum namespaceElem7 { Mon, Tue, Wed } + type namespaceElem8 = number; + + export const namespaceElem9: number; + export function namespaceElem10(x:number): void; + export class namespaceElem11 {} + export interface namespaceElem12 {} + export namespace namespaceElem13 {} + export enum namespaceElem14 { Red, Green, Blue } + export const enum namespaceElem15 { Mon, Tue, Wed } + export type namespaceElem16 = number; +} diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/AwaitExpression.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/AwaitExpression.ets new file mode 100644 index 0000000000..abc89d7dd7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/AwaitExpression.ets @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 17.16.2 + * awaitExpression: + * 'await' expression + * ; + */ + +function foo() {} +let promise = launch foo(); +await promise; diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/FunctionTypeWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/FunctionTypeWithReceiver.ets new file mode 100644 index 0000000000..b22fb7252c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/FunctionTypeWithReceiver.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 17.12.4 + * functionTypeWithReceiver: + * '(' receiverParameter(','ftParameterList)?')'ftReturnType + * ; + * + * CHAPTER 3.19 + * ftParameterList: + * ftParameter (',' ftParameter)* (',' ftRestParameter)? + * | ftRestParameter + * ; + * + * CHAPTER 3.19 + * ftReturnType: + * '=>'type + * ; + */ + +class A {} + +type FA = (this: A) => boolean; + +type FN = (this: A, max: number) => number; diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/FunctionWithReceiverDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/FunctionWithReceiverDeclaration.ets new file mode 100644 index 0000000000..27a7ccc15e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/FunctionWithReceiverDeclaration.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 17.12.1 + * functionWithReceiverDeclaration: + * 'function' identifier typeParameters? signatureWithReceiver block + * ; + * + * signatureWithReceiver: + * '(' receiverParameter (', ' parameterList)? ')' returnType? throwMark? + * ; + * + * receiverParameter: + * annotationUsage? 'this' ':' type + * ; + */ + +class A {} + +function fooOne(this: A) {} + +function fooTwo(this: A) {} diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/LambdaExpressionWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/LambdaExpressionWithReceiver.ets new file mode 100644 index 0000000000..264e17464a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/LambdaExpressionWithReceiver.ets @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 17.12.5 + * lambdaExpressionWithReceiver: + * annotationUsage? typeParameters? + * '(' receiverParameter(','lambdaParameterList)?')' + * returnType? throwMark?'=>' lambdaBody + * ; + * + * CHAPTER 17.12.1 + * receiverParameter: + * annotationUsage? 'this' ':' type + * ; + * + * CHAPTER 7.32 + * lambdaParameterList: + * lambdaParameter(','lambdaParameter)* (','restParameter)?','? + * | restParameter','? + * ; + * + * lambdaBody: + * expression | block + * ; + */ + +class A {} + +@Retention("SOURCE") +@interface MyAnnotation {} + +let result1 = (this: A) => {}; + +let result2 = @MyAnnotation (this: A) => {}; + +let result3 = (this: A, x: number) => {}; + +let result4 = (this: A): number => { return 0; }; + +let result5 = (this: A) throws => {}; + +let result6 = @MyAnnotation (this: A, x: number) => {}; + +let result7 = @MyAnnotation (this: A): number => { return 0; }; + +let result8 = @MyAnnotation (this: A) throws => {}; + +let result9 = (this: A, x: number): number => { return 0; }; + +let result10 = (this: A, x: number) throws => {}; + +let result11 = (this: A): number throws => { return 0; }; + +let result12 = @MyAnnotation (this: A, x: number): number => { return 0; }; + +let result13 = @MyAnnotation (this: A, x: number) throws => {}; + +let result14 = @MyAnnotation (this: A): number throws => { return 0; }; + +let result15 = (this: A, x: number): number throws => { return 0; }; + +let result16 = @MyAnnotation (this: A, x: number): number throws => { return 0; }; diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/ImportDirective.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/ImportDirective.ets new file mode 100644 index 0000000000..d5c0c667dd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/ImportDirective.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 17.19 + * packageModuleDeclaration: + * importDirective* packageTopDeclaration* + * ; + * + * packageTopDeclaration: + * topDeclaration | initializerBlock + * ; + * + * packageModule: + * packageHeader packageModuleDeclaration + * ; + */ + +package myPackage; + +import { A } from "../PrepareForImportDirective"; +import { B } from "../PrepareForImportDirective"; +import { fooOne } from "../PrepareForImportDirective"; diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/ImportDirectivePackageTopDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/ImportDirectivePackageTopDeclaration.ets new file mode 100644 index 0000000000..f26e372925 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/ImportDirectivePackageTopDeclaration.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 17.19 + * packageModuleDeclaration: + * importDirective* packageTopDeclaration* + * ; + * + * packageTopDeclaration: + * topDeclaration | initializerBlock + * ; + * + * packageModule: + * packageHeader packageModuleDeclaration + * ; + */ + +package myPackage; + +import { fooTwo } from "../PrepareForImportDirective"; +import { fooThree } from "../PrepareForImportDirective"; +import { C } from "../PrepareForImportDirective"; + +let a = 1; +let b = 2; +let c = 3; diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/PackageTopDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/PackageTopDeclaration.ets new file mode 100644 index 0000000000..45063a05d1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/PackageTopDeclaration.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 17.19 + * packageModuleDeclaration: + * importDirective* packageTopDeclaration* + * ; + * + * packageTopDeclaration: + * topDeclaration | initializerBlock + * ; + * + * packageModule: + * packageHeader packageModuleDeclaration + * ; + */ + +package myPackage; + +let example1 = 13; +let example2 = 22; +let example3 = 35; +let example4 = 40; diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageTopDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageTopDeclaration.ets new file mode 100644 index 0000000000..0b4ab75ee6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PackageTopDeclaration.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 17.19 + * packageTopDeclaration: + * topDeclaration | initializerBlock + * ; + * + * packageModuleDeclaration: + * importDirective* packageTopDeclaration* + * ; + */ + +package myPackage; + +let a = 1; + +class ExampleClass { + static initialized = false; + static initializerBlock() { + if (!ExampleClass.initialized) { + ExampleClass.initialized = true; + } + } +} diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PrepareForImportDirective.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PrepareForImportDirective.ets new file mode 100644 index 0000000000..812953d363 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/PrepareForImportDirective.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. + */ + +/** + * This file provides the relevant export files + * for the ImportDirective file in the PackageModuleDeclaration folder + */ + +class A {} +class B {} +class C {} + +function fooOne(this: A) {} +function fooTwo(this: A) {} +function fooThree(this: A) {} + +export A; +export B; +export C; +export fooOne; +export fooTwo; +export fooThree; diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/ReceiverParameter.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/ReceiverParameter.ets new file mode 100644 index 0000000000..2cfeae501e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/ReceiverParameter.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 17.12.1 + * receiverParameter: + * annotationUsage? 'this' ':' type + * ; + * + * signatureWithReceiver: + * '(' receiverParameter (', ' parameterList)? ')' returnType? throwMark? + * ; + * + * functionWithReceiverDeclaration: + * 'function' identifier typeParameters? signatureWithReceiver block + * ; + */ + +@interface ClassPreamble { + revision: number; +} + +class A {} + +function fooOne(@ClassPreamble({ revision: 2 }) this: A) {} + +function fooTwo(this: A) {} diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/SignatureWithReceiver.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/SignatureWithReceiver.ets new file mode 100644 index 0000000000..c1624f6af2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/SignatureWithReceiver.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 17.12.1 + * signatureWithReceiver: + * '(' receiverParameter (', ' parameterList)? ')' returnType? throwMark? + * ; + * + * functionWithReceiverDeclaration: + * 'function' identifier typeParameters? signatureWithReceiver block + * ; + * + * receiverParameter: + * annotationUsage? 'this' ':' type + * ; + */ + +class A {} + +function fooOne(this: A) {} + +function fooTwo(this: A, n: number) {} + +function fooThree(this: A): void {} + +function fooFour(this: A) throws {} + +function fooFive(this: A, n: number): void {} + +function fooSix(this: A, n: number) throws {} + +function fooSeven(this: A): void throws {} + +function fooEight(this: A, n: number): void throws {} diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/SingleQuoteCharacterError.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/SingleQuoteCharacterError.ets new file mode 100644 index 0000000000..82f45e31fe --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/SingleQuoteCharacterError.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 17.1.1 +* SingleQuoteCharacter: +* ~['\\\r\n] +* | '\\' EscapeSequence +* ; +* +* CharLiteral: +* 'c\'' SingleQuoteCharacter '\'' +* ; +* +*/ + +c'\''; +c'\\'; +c'\r'; +c'\n' diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/TrailingLambdaCall.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/TrailingLambdaCall.ets new file mode 100644 index 0000000000..0edf6b7bf7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/TrailingLambdaCall.ets @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 17.13 + * trailingLambdaCall: + * ( objectReference '.' identifier typeArguments? + * | expression ('?.' | typeArguments)? + * ) + * arguments block + * ; + * + * CHAPTER 6.5.14 + * objectReference: + * typeReference + * |'super' + * | primaryExpression + * ; + * + * CHAPTER 5.2.1 + * typeArguments: + * '<' type(','type)* '>' + * ; + */ + +class A { + methodOne(callback: () => void): void { + callback(); + } + methodTwo(arg: T, callback: (result: T) => void): void { + const result = arg; + callback(result); + } +} + +let a = new A(); + +a.methodOne() {} + +a.methodTwo("Hi") {} + +function add(x: number, y: number, callback: (result: number) => void) { + const result = x + y; + callback(result); + return result; +} + +function put(x: string, callback: (result: string) => void): void { + const result = x; + callback(result); +} + +add(1, 2) {} + +a?.methodOne() {} + +put("Hello") {} diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/arrayElementType.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/arrayElementType.ets new file mode 100644 index 0000000000..61971b0fc9 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/arrayElementType.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 17.3 + * arrayElementType: + * typeReference + * | '(' type ')' + * ; + */ + +let a = new string[1]; + +type STR = string; +let b = new (STR)[2][2]; diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/characterLiterals.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/characterLiterals.ets new file mode 100644 index 0000000000..30210783c2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/characterLiterals.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 17.1.1 + * CharLiteral: + * 'c\'' SingleQuoteCharacter '\'' + * ; + * + * SingleQuoteCharacter: + * ~['\\\r\n] + * | '\\' EscapeSequence + * ; + */ + +c'a' +c'\n' diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/interfaceDefaultMethodDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/interfaceDefaultMethodDeclaration.ets new file mode 100644 index 0000000000..ded8ee7199 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/interfaceDefaultMethodDeclaration.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 17.11 + * interfaceDefaultMethodDeclaration: + * 'private'? identifier signature block + * ; + */ + +interface fool { + private priMethod(): void {} + + pubMethod(): void {} +} diff --git a/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/newArrayInstance.ets b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/newArrayInstance.ets new file mode 100644 index 0000000000..2c66a79c11 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/17_experimental_features/newArrayInstance.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 17.3 + * newArrayInstance: + * 'new' arrayElementType dimensionExpression+ (arrayElement)? + * ; + * + * arrayElementType: + * typeReference + * | '(' type ')' + * ; + * + * dimensionExpression: + * '[' expression ']' + * ; + * + * arrayElement: + * '(' expression ')' + * ; + */ + +let a = new string[1]; +a[0] = "a"; + +let b = new number[2][2]; +b[0][0] = 1; + +let c = new string[1]; + +let d = new number[2][2]; diff --git a/ets2panda/test/ast/compiler/ets/spec/18_annotations/AmbientAnnotationDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/18_annotations/AmbientAnnotationDeclaration.ets new file mode 100644 index 0000000000..e3a36b86fd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/18_annotations/AmbientAnnotationDeclaration.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 18.4 + * ambientAnnotationDeclaration: + * 'declare' annotationDeclaration + * ; + */ + +export declare @interface NameAnno { name: string = "" }; diff --git a/ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationDeclaration.ets b/ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationDeclaration.ets new file mode 100644 index 0000000000..5e0c1285de --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationDeclaration.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 18.1 + * annotationDeclaration: + * '@interface' identifier '{' annotationField* '}' + * ; + */ + +@interface MyAnnotation { + name: string; + value: number = 10; +}; + +@interface MyAnnotation1 {}; diff --git a/ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationField.ets b/ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationField.ets new file mode 100644 index 0000000000..65fe90a06c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationField.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 18.1 + * annotationField: + * identifier ':' type constInitializer? + * ; + * + * constInitializer: + * '=' constantExpression + * ; + */ + +@interface MyAnnotation2 { + fieldWithoutDefault: string; +}; + +@interface MyAnnotation3 { + fieldWithDefault: number = 42; +}; diff --git a/ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationUsage.ets b/ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationUsage.ets new file mode 100644 index 0000000000..4f8fe04a92 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationUsage.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 18.2 + * annotationUsage: + * '@' qualifiedName annotationValues? + * ; + */ + +@interface SimpleAnnotation {} +@SimpleAnnotation +class MyClass {}; + +@interface DetailedAnnotation { + authorName: string; + creationDate: string; +} +@DetailedAnnotation({ + authorName: "张三", + creationDate: "2025-03-19" +}) +class DocumentedClass {}; diff --git a/ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationValues.ets b/ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationValues.ets new file mode 100644 index 0000000000..12ca6cff49 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/18_annotations/AnnotationValues.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 18.2 + * annotationValues: + * '(' (objectLiteral | constantExpression)? ')' + * ; + */ + +@interface AuthorInfo { + name: string; + email: string; +} +@AuthorInfo({ + name: "李四", + email: "lisi@example.com" +}) +class Book {}; + +@interface Version { + versionNumber: number; +} +@Version(1) +class Software {}; + +@interface Deprecated {} +@Deprecated() +class OldClass {}; diff --git a/ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/BacktickCharacterError.ets b/ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/BacktickCharacterError.ets new file mode 100644 index 0000000000..bb76998b9d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/BacktickCharacterError.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 + * BacktickCharacter: + * ~['\\\r\n] + * | '\\' EscapeSequence + * | LineContinuation + * ; + */ + +`\` + +/* @@? 28:1 Error SyntaxError: Unexpected token, expected '`' */ +/* @@? 28:1 Error SyntaxError: Unterminated string */ +/* @@? 28:1 Error SyntaxError: Unexpected token, expected '${' or '`' */ +/* @@? 28:1 Error SyntaxError: Unexpected token, expected '`' */ diff --git a/ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/DoubleQuoteCharacterError.ets b/ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/DoubleQuoteCharacterError.ets new file mode 100644 index 0000000000..bd82623129 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/DoubleQuoteCharacterError.ets @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * DoubleQuoteCharacter: + * ~["\\\r\n] + * | '\\' EscapeSequence + * ; + */ + +"\"/* @@ label */ + +/* @@@ label Error SyntaxError: Newline is not allowed in strings */ diff --git a/ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/EscapeSequenceError.ets b/ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/EscapeSequenceError.ets new file mode 100644 index 0000000000..0efb3f8343 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/EscapeSequenceError.ets @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * EscapeSequence: + * ['"bfnrtv0\\] + * | 'x' HexDigit HexDigit + * | 'u' HexDigit HexDigit HexDigit HexDigit + * | 'u' '{' HexDigit+ '}' + * | ~[1-9xu\r\n] + * ; + */ + +"\/* @@ label */1"; +"\/* @@ label1 */2"; +"\/* @@ label2 */3"; +"\/* @@ label3 */4"; +"\/* @@ label4 */5"; +"\/* @@ label5 */6"; +"\/* @@ label6 */7"; +"\/* @@ label7 */8"; +"\/* @@ label8 */9"; +"\x"/* @@ label9 */;/* @@ label10 */ +"\u"; +"\\n";/* @@ label11 */ +"\\r";/* @@ label12 */ +'\1';/* @@ label13 */ +'\2';/* @@ label14 */ +'\3';/* @@ label15 */ +'\4';/* @@ label16 */ +'\5';/* @@ label17 */ +'\6';/* @@ label18 */ +'\7';/* @@ label19 */ +'\8'; +'\9'; +'\x'; +'\u'; +'\\n'; +'\\r'; + +/* @@@ label Error SyntaxError: Invalid character escape sequence */ +/* @@@ label1 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label2 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label3 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label4 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label5 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label6 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label7 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label8 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label9 Error SyntaxError: Invalid unicode escape sequence */ +/* @@@ label10 Error SyntaxError: Newline is not allowed in strings */ +/* @@@ label1 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label2 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label3 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label4 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label5 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label6 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label7 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label8 Error SyntaxError: Invalid character escape sequence */ +/* @@@ label9 Error SyntaxError: Invalid character escape sequence */ diff --git a/ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/SingleQuoteCharacterError.ets b/ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/SingleQuoteCharacterError.ets new file mode 100644 index 0000000000..66a1269457 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/2_lexical_elements/SingleQuoteCharacterError.ets @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 2.9.6 + * SingleQuoteCharacter: + * ~['\\\r\n] + * | '\\' EscapeSequence + * ; + */ + +'\'/* @@ label */ + +/* @@@ label Error SyntaxError: Newline is not allowed in strings */ diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/ArrayLiteral.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/ArrayLiteral.ets new file mode 100644 index 0000000000..9253653bd5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/ArrayLiteral.ets @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 7.4 + * arrayLiteral: + * '[' expressionSequence? ']' + * ; + */ + +let x1 = [1, 2, 3]; + +let x2 = []; diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/ExpressionSequence.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/ExpressionSequence.ets new file mode 100644 index 0000000000..baba105b73 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/ExpressionSequence.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 7.4 + * expressionSequence: + * expression (',' expression)* ','? + * ; + */ + +let y1 = [1, 2, 3]; + +let y2 = [1, 2, 3,]; + +let y3 = [1]; + +let y4 = [1,]; diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/FieldAccessExpression.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/FieldAccessExpression.ets new file mode 100644 index 0000000000..a77a97030c --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/FieldAccessExpression.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 7.9 + * fieldAccessExpression: + * objectReference ('.' | '?.') identifier + * ; + */ + +class Person { + name: string = "Unknown"; +} +let person = new Person(); +person.name = "Alice"; + +let person1: Person | null = null; +person1?.name; diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/FunctionCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/FunctionCallExpression.ets new file mode 100644 index 0000000000..8e00ae1cdd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/FunctionCallExpression.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 7.11 + * functionCallExpression: + * expression ( '?.' | typeArguments)? arguments block? + * ; + */ + +class Person { + sayHello() {} +} +let person1 = new Person(); +person1.sayHello(); + +class MyClass1 { + static identity(arg: T): T { + return arg; + } +} +let result = MyClass1.identity("Hello, World!"); + +class MyClass2 { + execute(callback: () => T): T { + return callback(); + } +} +let myInstance1 = new MyClass2(); +myInstance1.execute(() => { + return "Block executed"; +}); + +let person2: Person | null = null; +person2?.sayHello(); + +class MyClass3 { + execute(callback: () => void) { + callback?.(); + } +} +let myInstance2: MyClass3 | null = null; +myInstance2?.execute(() => {}); + +class MyClass4 { + execute(callback: () => void): void { + callback(); + } +} +let myInstance3 = new MyClass4(); +myInstance3.execute(() => {}); diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/IndexingExpression.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/IndexingExpression.ets new file mode 100644 index 0000000000..1455d6808e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/IndexingExpression.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 7.12 + * indexingExpression: + * expression ('?.')? '[' expression ']' + * ; + */ + +const maybeArray: number[] | null = null; +maybeArray?.[0]; + +const numbers = [1, 2, 3]; +numbers[0]; diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/KeyValueSequence.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/KeyValueSequence.ets new file mode 100644 index 0000000000..df5114cca4 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/KeyValueSequence.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 7.5.3 + * keyValueSequence: + * keyValue (',' keyValue)* ','? + * ; + * + * keyValue: + * expression ':' expression + * ; + */ + +let map1: Record = { + "John": 25, + "Mary": 21 +}; + +let map2: Record = { + "John": 25, + "Mary": 21, +}; + +let map3: Record = { + "John": 25 +}; + +let map4: Record = { + "John": 25, +}; diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/MethodCallExpression.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/MethodCallExpression.ets new file mode 100644 index 0000000000..f28260bd7e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/MethodCallExpression.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 7.10 + * methodCallExpression: + * objectReference ('.' | '?.') identifier typeArguments? arguments block? + * ; + */ + +class MyClass { + sayHello(a: number) {} + sayHello1(a: number) {} + execute(action: () => void) {} + execute1(action: () => void) {} +} +let obj = new MyClass(); +obj.sayHello(1); + +obj.sayHello1(1); + +obj.execute(() => { console.log("Action executed"); }); + +obj.execute1(() => { console.log("Action executed"); }); + +let obj1: MyClass | null = null; +obj1?.sayHello(1); + +obj1?.sayHello1(1); + +obj1?.execute(() => { console.log("Action executed"); }); + +obj1?.execute1(() => { console.log("Action executed"); }); diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/NamedReference.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/NamedReference.ets new file mode 100644 index 0000000000..ceca17ad4e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/NamedReference.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 7.3 + * namedReference: + * qualifiedName typeArguments? + * ; + */ + +function generic_function() {} +generic_function(); + +function generic_function1() {} +generic_function1(); diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/NewClassInstance.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/NewClassInstance.ets new file mode 100644 index 0000000000..39f303787f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/NewClassInstance.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 7.14 + * newClassInstance: + * 'new' typeArguments? typeReference arguments? + * ; + */ + +class GenericClass { + constructor(p: number) {} +} +let instance1 = new GenericClass(5); + +class GenericClass1 {} +let instance2 = new GenericClass1(); + +class GenericClass2 { + constructor(p: number) {} +} +let instance3 = new GenericClass2(5); + +class GenericClass3 {} +let instance4 = new GenericClass3(); diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/NewExpression.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/NewExpression.ets new file mode 100644 index 0000000000..4b96031569 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/NewExpression.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 7.14 + * newExpression: + * newClassInstance + * | newArrayInstance + * ; + */ + +class MyClass { + constructor(p: number) {} +} +let instance = new MyClass(5); + +let numbers = new Array(3); diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/ObjectLiteral.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/ObjectLiteral.ets new file mode 100644 index 0000000000..3d8ec1bcd8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/ObjectLiteral.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 7.5 + * objectLiteral: + * '{' valueSequence? '}' + * ; + */ + +class Person { + name: string = ""; + age: number = 0; +} +let emptyObject: Person = {}; + +let p1: Person = { name: "Alice" }; diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/ParenthesizedExpression.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/ParenthesizedExpression.ets new file mode 100644 index 0000000000..1f9e83f789 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/ParenthesizedExpression.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 7.7 + * parenthesizedExpression: + * '(' expression ')' + * ; + */ + +let c = (5 + 10) * 2; diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/RecordLiteral.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/RecordLiteral.ets new file mode 100644 index 0000000000..a5a4853c1f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/RecordLiteral.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 7.5.3 + * recordLiteral: + * '{' keyValueSequence? '}' + * ; + */ + +let map: Record = { + "John": 25, + "Mary": 21, +}; + +let map1: Record = {}; diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/SpreadExpression.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/SpreadExpression.ets new file mode 100644 index 0000000000..5e20ec07ac --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/SpreadExpression.ets @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CHAPTER 7.6 + * spreadExpression: + * '...' expression + * ; + */ + +let first = [1, 2]; +let second = [3, 4]; +let combined = [...first, ...second]; diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/ThisExpression.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/ThisExpression.ets new file mode 100644 index 0000000000..6d7c836ec6 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/ThisExpression.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 7.8 + * thisExpression: + * 'this' + * ; + */ + +class Person { + name: string; + constructor(name: string) { + this.name = name; + } +} +let person = new Person("Alice"); diff --git a/ets2panda/test/ast/compiler/ets/spec/7_expressions/ValueSequence.ets b/ets2panda/test/ast/compiler/ets/spec/7_expressions/ValueSequence.ets new file mode 100644 index 0000000000..8367b3aca5 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/spec/7_expressions/ValueSequence.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 7.5 + * valueSequence: + * nameValue (',' nameValue)* ','? + * ; + * + * nameValue: + * identifier ':' expression + * ; + */ + +class Person { + name: string = ""; + age: number = 0; +} +let p1: Person = { name: "Alice", age: 25 }; + +let p2: Person = { name: "Alice", age: 25, }; + +let p3: Person = { name: "Alice" }; + +let p4: Person = { name: "Alice", }; diff --git a/ets2panda/test/test-lists/astchecker/astchecker-ets-ignored.txt b/ets2panda/test/test-lists/astchecker/astchecker-ets-ignored.txt index 303bff6cd2..8b6d69b90b 100644 --- a/ets2panda/test/test-lists/astchecker/astchecker-ets-ignored.txt +++ b/ets2panda/test/test-lists/astchecker/astchecker-ets-ignored.txt @@ -15,6 +15,13 @@ ast/parser/ets/lexer001.ets ast/parser/ets/lexer002.ets ast/parser/ets/TypeInferFunc.ets +# Issue: #IBWNGZ +ast/compiler/ets/spec/2_lexical_elements/BacktickCharacterError.ets +ast/compiler/ets/spec/2_lexical_elements/EscapeSequenceError.ets +ast/compiler/ets/spec/2_lexical_elements/DoubleQuoteCharacterError.ets +ast/compiler/ets/spec/2_lexical_elements/SingleQuoteCharacterError.ets +ast/compiler/ets/spec/17_experimental_features/SingleQuoteCharacterError.ets + # Issue: #20639 ast/parser/ets/extension_function_tests/extension_function_array1.ets ast/parser/ets/extension_function_tests/extension_function_array1_primitive.ets diff --git a/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt b/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt index 47504eb951..c932a0f571 100644 --- a/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt +++ b/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt @@ -160,6 +160,23 @@ ast/compiler/ets/import_type_without_export.ets ast/compiler/ets/type_binding_01.ets ast/compiler/ets/type_binding_02.ets +# FailKind.SRC_DUMPER_FAIL (Issue: #IBWNGZ) +ast/compiler/ets/spec/14_ambient_declarations/ambientClassBodyDeclaration.ets +ast/compiler/ets/spec/14_ambient_declarations/ambientIndexerDeclaration.ets +ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceDeclaration.ets +ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceElement.ets +ast/compiler/ets/spec/14_ambient_declarations/ambientNamespaceElementDeclaration.ets +ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/ImportDirective.ets +ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/ImportDirectivePackageTopDeclaration.ets +ast/compiler/ets/spec/17_experimental_features/PackageModuleDeclaration/PackageTopDeclaration.ets +ast/compiler/ets/spec/17_experimental_features/SingleQuoteCharacterError.ets +ast/compiler/ets/spec/17_experimental_features/TrailingLambdaCall.ets +ast/compiler/ets/spec/17_experimental_features/PackageTopDeclaration.ets +ast/compiler/ets/spec/7_expressions/FieldAccessExpression.ets +ast/compiler/ets/spec/7_expressions/FunctionCallExpression.ets +ast/compiler/ets/spec/7_expressions/IndexingExpression.ets +ast/compiler/ets/spec/7_expressions/MethodCallExpression.ets + # FailKind.ES2PANDA_FAIL runtime/ets/StringFasta.ets runtime/ets/struct-identifier.ets -- Gitee