1/* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16abstract struct X { 17 x: number = 89 18} 19 20abstract struct B extends X { 21 f(): void { 22 this.x = 55 23 } 24} 25 26function f(x: int): void { 27 for (let i = 0; i < x; ++i) { 28 aa: 29 while (i < 10) { 30 aa: 31 while (i > 10) { 32 ++i 33 break aa 34 } 35 ++i 36 } 37 } 38} 39 40return 48; 41 42function g(x: int): int { 43 switch x 44 case 1: return 0; 45 case 2: return 1; 46 77: return 2; 47 default: return -1; 48 default: return -2; 49} 50} 51 52 53/* @@? 16:10 Error TypeError: Structs are only used to define UI components, it should be translated at 'plugin after parser' phase. */ 54/* @@? 20:10 Error TypeError: Structs are only used to define UI components, it should be translated at 'plugin after parser' phase. */ 55/* @@? 20:27 Error TypeError: struct B is not extensible. */ 56/* @@? 30:17 Error SyntaxError: Label already declared. */ 57/* @@? 40:1 Error SyntaxError: return keyword should be used in function body. */ 58/* @@? 40:8 Error TypeError: All return statements in the function should be empty or have a value. */ 59/* @@? 43:12 Error SyntaxError: Expected '(', got 'identification literal'. */ 60/* @@? 44:9 Error SyntaxError: Expected ')', got 'case'. */ 61/* @@? 44:9 Error SyntaxError: Expected '{', got 'case'. */ 62/* @@? 46:15 Error SyntaxError: Unexpected token ':'. */ 63/* @@? 46:17 Error SyntaxError: Unexpected token 'return'. */ 64/* @@? 48:9 Error SyntaxError: Multiple default clauses. */ 65