forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptional-chaining-error.js
More file actions
35 lines (30 loc) · 1.03 KB
/
optional-chaining-error.js
File metadata and controls
35 lines (30 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// RUN: (! %hermes -dump-ast --pretty-json %s 2>&1) | %FileCheck %s --match-full-lines
new obj ?. (arg);
// // CHECK: {{.*}}:10:9: error: Constructor calls may not contain an optional chain
// // CHECK: new obj ?. (arg);
// // CHECK: ^~
new obj ?. prop();
// CHECK: {{.*}}:15:9: error: Constructor calls may not contain an optional chain
// CHECK: new obj ?. prop();
// CHECK: ^~
a?.b.c`abc`;
// CHECK: {{.*}}:20:7: error: invalid use of tagged template literal in optional chain
// CHECK: a?.b.c`abc`;
// CHECK: ^~~~~
// CHECK: {{.*}}:20:1: note: location of optional chain
// CHECK: a?.b.c`abc`;
// CHECK: ^~~~~~
a?.b.c
`abc`;
// CHECK: {{.*}}:29:1: error: invalid use of tagged template literal in optional chain
// CHECK: `abc`;
// CHECK: ^~~~~
// CHECK: {{.*}}:28:1: note: location of optional chain
// CHECK: a?.b.c
// CHECK: ^~~~~~