• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16export type function f(): void {
17}
18
19export type let x: number = 7
20
21label1:
22let x = 77
23
24class A {
25    let x: number = 5;
26}
27
28function f() {
29    struct A {
30        let x:number;
31    }
32    function s(): void {}
33}
34
35try
36    let x: number = 89
37} catch(a: Exception) {
38}
39
40try x: number;
41
42try
43    let x: number;
44catch
45finally {}
46
47class A {
48    let x: number = 5;
49}
50
51throw
52"abc"
53// there were more errors
54/* @@? 16:13 Error SyntaxError: Can only type export class or interface!  */
55/* @@? 19:13 Error SyntaxError: Can only type export class or interface!  */
56/* @@? 22:1 Error SyntaxError: Label must be followed by a loop statement  */
57/* @@? 25:5 Error SyntaxError: Identifier expected, got 'let'.  */
58/* @@? 25:9 Error SyntaxError: Field type annotation expected  */
59/* @@? 29:5 Error SyntaxError: Illegal start of STRUCT expression  */
60/* @@? 30:9 Error SyntaxError: Identifier expected, got 'let'.  */
61/* @@? 30:13 Error SyntaxError: Field type annotation expected  */
62/* @@? 32:5 Error SyntaxError: Nested functions are not allowed  */
63/* @@? 36:5 Error SyntaxError: Expected a '{', got 'let'.  */
64/* @@? 40:5 Error SyntaxError: Expected a '{', got 'identification literal'.  */
65/* @@? 40:8 Error SyntaxError: Label must be followed by a loop statement  */
66/* @@? 43:5 Error SyntaxError: Expected a '{', got 'let'.  */
67/* @@? 45:9 Error SyntaxError: Unexpected token '{'.  */
68/* @@? 48:5 Error SyntaxError: Identifier expected, got 'let'.  */
69/* @@? 48:9 Error SyntaxError: Field type annotation expected  */
70/* @@? 52:1 Error SyntaxError: Illegal newline after throw  */
71/* @@? 75:1 Error SyntaxError: Expected a '}' got 'eos'.  */
72/* @@? 42:1 Error SyntaxError: A try statement should contain either finally clause or at least one catch clause.  */
73/* @@? 75:1 Error SyntaxError: Expected a '}' got 'eos'.  */
74/* @@? 40:1 Error SyntaxError: A try statement should contain either finally clause or at least one catch clause.  */
75