• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16function foo<T>(this:A<T>, p: T): T {
17    return this.data;
18}
19
20class A<T> {
21    data: T
22    constructor(p: T) {
23        this.data = p;
24    }
25    goo1(): T {
26        return this.foo(this.data);
27    }
28
29    goo
30        return this./* @@ label */classVal;
31
32(): T {
33        return foo(this, this.data);
34    }
35
36}
37
38/* @@? 30:9 Error SyntaxError: Unexpected token 'return'. */
39/* @@? 30:9 Error SyntaxError: Field type annotation expected. */
40/* @@? 30:16 Error SyntaxError: Unexpected token 'this'. */
41/* @@? 30:20 Error SyntaxError: Unexpected token '.'. */
42/* @@? 30:43 Error SyntaxError: Field type annotation expected. */
43/* @@? 32:1 Error SyntaxError: Unexpected token '('. */
44/* @@? 32:2 Error SyntaxError: Unexpected token ')'. */
45/* @@? 32:3 Error SyntaxError: Unexpected token ':'. */
46/* @@? 32:7 Error SyntaxError: Field type annotation expected. */
47/* @@? 32:7 Error SyntaxError: Unexpected token '{'. */
48/* @@? 33:9 Error SyntaxError: Unexpected token 'return'. */
49/* @@? 33:19 Error TypeError: Only abstract or native methods can't have body. */
50/* @@? 33:24 Error SyntaxError: The function parameter 'this' must explicitly specify the typeAnnotation. */
51/* @@? 33:30 Error SyntaxError: The function parameter 'this' must explicitly specify the typeAnnotation. */
52/* @@? 33:30 Error SyntaxError: Unexpected token, expected ',' or ')'. */
53/* @@? 33:30 Error SyntaxError: Unexpected token '.'. */
54/* @@? 33:31 Error TypeError: Variable 'data' has already been declared. */
55/* @@? 33:35 Error SyntaxError: Field type annotation expected. */
56/* @@? 33:35 Error SyntaxError: Unexpected token ')'. */
57/* @@? 36:1 Error SyntaxError: Unexpected token '}'. */
58