mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
104 lines
2.8 KiB
Diff
104 lines
2.8 KiB
Diff
--- old.instantiationExpressionErrors.js
|
|
+++ new.instantiationExpressionErrors.js
|
|
@@= skipped -107, +107 lines =@@
|
|
|
|
//// [instantiationExpressionErrors.js]
|
|
"use strict";
|
|
-var _a, _b, _c;
|
|
+var _a, _b;
|
|
+var _c;
|
|
// Type arguments in member expressions
|
|
-const a1 = (f); // { (): number; g<U>(): U; }
|
|
-const a2 = (f.g); // () => number
|
|
+const a1 = f; // { (): number; g<U>(): U; }
|
|
+const a2 = f.g; // () => number
|
|
const a3 = f.g; // <U>() => U
|
|
-const a4 = (f.g); // () => number
|
|
-const a5 = (f['g']); // () => number
|
|
+const a4 = f.g; // () => number
|
|
+const a5 = f['g']; // () => number
|
|
// `[` is an expression starter and cannot immediately follow a type argument list
|
|
const a6 = f < number > ['g']; // Error
|
|
const a7 = (f)['g'];
|
|
// An `<` cannot immediately follow a type argument list
|
|
const a8 = f < number > ; // Relational operator error
|
|
-const a9 = ((f)); // Error, no applicable signatures
|
|
+const a9 = (f); // Error, no applicable signatures
|
|
// Type arguments with `?.` token
|
|
const b1 = f === null || f === void 0 ? void 0 : f(); // Error, `(` expected
|
|
const b2 = f === null || f === void 0 ? void 0 : f();
|
|
-const b3 = (_a = (f)) === null || _a === void 0 ? void 0 : _a();
|
|
-const b4 = (_b = (f)) === null || _b === void 0 ? void 0 : _b(); // Error, expected no type arguments
|
|
-const c1 = (g) || ((x) => x);
|
|
-const c2 = (_c = (g)) !== null && _c !== void 0 ? _c : ((x) => x);
|
|
-const c3 = (g) && ((x) => x);
|
|
+const b3 = (_a = f) === null || _a === void 0 ? void 0 : _a();
|
|
+const b4 = (_b = f) === null || _b === void 0 ? void 0 : _b(); // Error, expected no type arguments
|
|
+const c1 = g || ((x) => x);
|
|
+const c2 = (_c = g) !== null && _c !== void 0 ? _c : ((x) => x);
|
|
+const c3 = g && ((x) => x);
|
|
// Parsed as function call, even though this differs from JavaScript
|
|
const x1 = f(true);
|
|
// Parsed as relational expressions
|
|
@@= skipped -28, +29 lines =@@
|
|
const r2 = f < true > +1;
|
|
const r3 = f < true > -1;
|
|
// All of the following are parsed as instantiation expressions
|
|
-const x2 = (f);
|
|
-true;
|
|
-const x3 = (f);
|
|
-true;
|
|
-const x4 = (f);
|
|
+const x2 = f;
|
|
+true;
|
|
+const x3 = f;
|
|
+true;
|
|
+const x4 = f;
|
|
if (true) { }
|
|
-const x5 = (f);
|
|
+const x5 = f;
|
|
let yy = 0;
|
|
-const x6 = (f);
|
|
-let x10 = (f);
|
|
+const x6 = f;
|
|
+let x10 = f;
|
|
this.bar();
|
|
-let x11 = (f);
|
|
+let x11 = f;
|
|
function bar() { }
|
|
-let x12 = (f);
|
|
+let x12 = f;
|
|
class C {
|
|
}
|
|
-let x13 = (f);
|
|
+let x13 = f;
|
|
bar();
|
|
-let x14 = (f);
|
|
+let x14 = f;
|
|
void bar();
|
|
class C1 {
|
|
}
|
|
-C1.specialFoo = (f);
|
|
+C1.specialFoo = f;
|
|
C1.bar = 123;
|
|
class C2 {
|
|
constructor() {
|
|
- this.specialFoo = (f);
|
|
+ this.specialFoo = f;
|
|
this.bar = 123;
|
|
}
|
|
}
|
|
class C3 {
|
|
constructor() {
|
|
- this.specialFoo = (f);
|
|
+ this.specialFoo = f;
|
|
this.bar = 123;
|
|
}
|
|
}
|
|
class C4 {
|
|
constructor() {
|
|
- this.specialFoo = (f);
|
|
+ this.specialFoo = f;
|
|
this.bar = 123;
|
|
}
|
|
}
|