1/* 2 * Copyright (c) 2024 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/* @@? 16:10 Error SyntaxError: struct declaration is not allowed to use 'abstract' modifiers. */ 53/* @@? 20:10 Error SyntaxError: struct declaration is not allowed to use 'abstract' modifiers. */ 54/* @@? 26:1 Error SyntaxError: struct declaration cannot extends from other class */ 55/* @@? 30:13 Error SyntaxError: Label already declared */ 56/* @@? 40:1 Error SyntaxError: return keyword should be used in function body */ 57/* @@? 43:12 Error SyntaxError: Unexpected token 'identification literal', expected '('. */ 58/* @@? 44:9 Error SyntaxError: Unexpected token 'case', expected ')'. */ 59/* @@? 44:9 Error SyntaxError: Unexpected token 'case', expected '{'. */ 60/* @@? 46:11 Error SyntaxError: Unexpected token ':'. */ 61/* @@? 46:11 Error SyntaxError: Unexpected token ':'. */ 62/* @@? 46:11 Error SyntaxError: Unexpected token ':', expected 'case' or 'default'. */ 63/* @@? 48:9 Error SyntaxError: Multiple default clauses. */ 64