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 16class A { 17 static static f(): void; 18 native native f2(): void { 19 console.log(f); 20 } 21 22 static private abstract static f3(): int { 23 return 7 24 } 25 26 native async f4(); 27 async abstract f5(); 28 29 static { 30 let x: number = 99 31 } 32 33 static { 34 let y: number = 75 35 } 36} 37 38abstract abstract class B { 39 x: number = 77; 40 41 async $_get(): int { 42 return 5; 43 } 44 45 async $_set(): void; 46 47 async $_iterator(a: int): int { 48 return a + 1; 49 } 50} 51 52declare namespace abc { 53 class C { 54 x: number = 53; 55 } 56} 57 58declare native class Z {} 59 60function s(): void { 61 class C { 62 private x: number; 63 } 64 65 interface I { 66 private f(): void; 67 static static g(): void; 68 } 69} 70 71interface I1 { 72 class A {} 73 74 get color(): string { 75 return "red"; 76 } 77 78 x: number = 79} 80 81/* @@? 17:12 Error SyntaxError: Duplicated modifier is not allowed */ 82/* @@? 18:12 Error SyntaxError: Duplicated modifier is not allowed */ 83/* @@? 22:12 Error SyntaxError: Access modifier must precede field and method modifiers. */ 84/* @@? 26:18 Error SyntaxError: Native method cannot be async */ 85/* @@? 27:20 Error SyntaxError: Abstract method cannot be async */ 86/* @@? 35:5 Error SyntaxError: Only one static block is allowed */ 87/* @@? 38:10 Error SyntaxError: Duplicated modifier is not allowed */ 88/* @@? 41:5 Error SyntaxError: The special predefined method '$_get' cannot be asynchronous. */ 89/* @@? 41:5 Error SyntaxError: The special predefined method '$_get' should have exactly one required parameter. */ 90/* @@? 45:5 Error SyntaxError: The special predefined method '$_set' cannot be asynchronous. */ 91/* @@? 45:5 Error SyntaxError: The special predefined method '$_set' should have exactly two required parameters. */ 92/* @@? 47:5 Error SyntaxError: The special predefined method '$_iterator' cannot be asynchronous. */ 93/* @@? 47:5 Error SyntaxError: The special predefined method '$_iterator' should not have parameters. */ 94/* @@? 54:23 Error SyntaxError: Initializers are not allowed in ambient contexts. */ 95/* @@? 58:9 Error SyntaxError: Unexpected token. */ 96/* @@? 58:16 Error SyntaxError: 'native' flags must be used for functions only at top-level. */ 97/* @@? 58:24 Error SyntaxError: Unexpected token, expected: '('. */ 98/* @@? 58:25 Error SyntaxError: Unexpected token, expected an identifier. */ 99/* @@? 60:1 Error SyntaxError: Unexpected token, expected an identifier. */ 100/* @@? 60:11 Error SyntaxError: Parameter declaration should have an explicit type annotation. */ 101/* @@? 60:11 Error SyntaxError: Invalid token: ',' or ')' expected. */ 102/* @@? 60:12 Error SyntaxError: Unexpected token ')'. */ 103/* @@? 60:13 Error SyntaxError: Unexpected token ':'. */ 104/* @@? 60:20 Error SyntaxError: Unexpected token '{'. */ 105/* @@? 66:18 Error SyntaxError: Private interface methods must have body */ 106/* @@? 67:9 Error SyntaxError: Unexpected token, expected 'private' or identifier */ 107/* @@? 67:16 Error SyntaxError: Identifier expected */ 108/* @@? 67:16 Error SyntaxError: Unexpected token, expected 'private' or identifier */ 109/* @@? 67:24 Error SyntaxError: Private interface methods must have body */ 110/* @@? 72:5 Error SyntaxError: Unexpected token, expected 'private' or identifier */ 111/* @@? 72:13 Error SyntaxError: Interface fields must have type annotation. */ 112/* @@? 72:14 Error SyntaxError: Invalid Type */ 113/* @@? 72:14 Error SyntaxError: Unexpected token: '}'. */ 114/* @@? 74:9 Error SyntaxError: Unexpected token 'identification literal'. */ 115/* @@? 74:16 Error SyntaxError: Unexpected token ':'. */ 116/* @@? 74:16 Error SyntaxError: Unexpected token ':'. */ 117/* @@? 74:25 Error SyntaxError: Unexpected token '{'. */ 118/* @@? 75:9 Error SyntaxError: return keyword should be used in function body */ 119/* @@? 78:8 Error SyntaxError: Label must be followed by a loop statement */ 120/* @@? 79:1 Error SyntaxError: Unexpected token '}'. */ 121/* @@? 79:1 Error SyntaxError: Unexpected token '}'. */ 122