Skip to content

Commit

Permalink
Accepted baselines.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRosenwasser committed Sep 28, 2017
1 parent 4ec1643 commit 9f3db7f
Show file tree
Hide file tree
Showing 28 changed files with 108 additions and 136 deletions.
5 changes: 2 additions & 3 deletions tests/baselines/reference/asOperator3.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ var c = 123 + 456 + " trailing";
var d = "Hello " + 123 + " World";
var e = "Hello";
var f = 1 + (1 + " end of string");
var g = tag(_a || (_a = __makeTemplateObject(["Hello ", " World"], ["Hello ", " World"])), 123);
var h = tag(_b || (_b = __makeTemplateObject(["Hello"], ["Hello"])));
var _a, _b;
var g = tag(__makeTemplateObject(["Hello ", " World"], ["Hello ", " World"]), 123);
var h = tag(__makeTemplateObject(["Hello"], ["Hello"]));
3 changes: 1 addition & 2 deletions tests/baselines/reference/asOperatorASI.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ var Foo = /** @class */ (function () {
}());
// Example 1
var x = 10;
as(_a || (_a = __makeTemplateObject(["Hello world"], ["Hello world"]))); // should not error
as(__makeTemplateObject(["Hello world"], ["Hello world"])); // should not error
// Example 2
var y = 20;
as(Foo); // should emit
var _a;
3 changes: 1 addition & 2 deletions tests/baselines/reference/importHelpers.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,4 @@ var C = /** @class */ (function () {
function id(x) {
return x;
}
var result = id(_a || (_a = __makeTemplateObject(["hello world"], ["hello world"])));
var _a;
var result = id(__makeTemplateObject(["hello world"], ["hello world"]));
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ function f() {
args[_i] = arguments[_i];
}
}
f(_a || (_a = __makeTemplateObject(["\r", "\n"], ["\\x0D", "\\x0A"])), "Interrupted CRLF");
var _a;
f(__makeTemplateObject(["\r", "\n"], ["\\x0D", "\\x0A"]), "Interrupted CRLF");
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ function f() {
x[_i] = arguments[_i];
}
}
f(_a || (_a = __makeTemplateObject(["0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"], ["0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"])));
var _a;
f(__makeTemplateObject(["0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"], ["0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"]));
Original file line number Diff line number Diff line change
Expand Up @@ -101,65 +101,64 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
};
// Generic tag with one parameter
function noParams(n) { }
noParams(_a || (_a = __makeTemplateObject([""], [""])));
noParams(__makeTemplateObject([""], [""]));
// Generic tag with parameter which does not use type parameter
function noGenericParams(n) { }
noGenericParams(_b || (_b = __makeTemplateObject([""], [""])));
noGenericParams(__makeTemplateObject([""], [""]));
// Generic tag with multiple type parameters and only one used in parameter type annotation
function someGenerics1a(n, m) { }
someGenerics1a(_c || (_c = __makeTemplateObject(["", ""], ["", ""])), 3);
someGenerics1a(__makeTemplateObject(["", ""], ["", ""]), 3);
function someGenerics1b(n, m) { }
someGenerics1b(_d || (_d = __makeTemplateObject(["", ""], ["", ""])), 3);
someGenerics1b(__makeTemplateObject(["", ""], ["", ""]), 3);
// Generic tag with argument of function type whose parameter is of type parameter type
function someGenerics2a(strs, n) { }
someGenerics2a(_e || (_e = __makeTemplateObject(["", ""], ["", ""])), function (n) { return n; });
someGenerics2a(__makeTemplateObject(["", ""], ["", ""]), function (n) { return n; });
function someGenerics2b(strs, n) { }
someGenerics2b(_f || (_f = __makeTemplateObject(["", ""], ["", ""])), function (n, x) { return n; });
someGenerics2b(__makeTemplateObject(["", ""], ["", ""]), function (n, x) { return n; });
// Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter
function someGenerics3(strs, producer) { }
someGenerics3(_g || (_g = __makeTemplateObject(["", ""], ["", ""])), function () { return ''; });
someGenerics3(_h || (_h = __makeTemplateObject(["", ""], ["", ""])), function () { return undefined; });
someGenerics3(_j || (_j = __makeTemplateObject(["", ""], ["", ""])), function () { return 3; });
someGenerics3(__makeTemplateObject(["", ""], ["", ""]), function () { return ''; });
someGenerics3(__makeTemplateObject(["", ""], ["", ""]), function () { return undefined; });
someGenerics3(__makeTemplateObject(["", ""], ["", ""]), function () { return 3; });
// 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type
function someGenerics4(strs, n, f) { }
someGenerics4(_k || (_k = __makeTemplateObject(["", "", ""], ["", "", ""])), 4, function () { return null; });
someGenerics4(_l || (_l = __makeTemplateObject(["", "", ""], ["", "", ""])), '', function () { return 3; });
someGenerics4(_m || (_m = __makeTemplateObject(["", "", ""], ["", "", ""])), null, null);
someGenerics4(__makeTemplateObject(["", "", ""], ["", "", ""]), 4, function () { return null; });
someGenerics4(__makeTemplateObject(["", "", ""], ["", "", ""]), '', function () { return 3; });
someGenerics4(__makeTemplateObject(["", "", ""], ["", "", ""]), null, null);
// 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
function someGenerics5(strs, n, f) { }
someGenerics5(_o || (_o = __makeTemplateObject(["", " ", ""], ["", " ", ""])), 4, function () { return null; });
someGenerics5(_p || (_p = __makeTemplateObject(["", "", ""], ["", "", ""])), '', function () { return 3; });
someGenerics5(_q || (_q = __makeTemplateObject(["", "", ""], ["", "", ""])), null, null);
someGenerics5(__makeTemplateObject(["", " ", ""], ["", " ", ""]), 4, function () { return null; });
someGenerics5(__makeTemplateObject(["", "", ""], ["", "", ""]), '', function () { return 3; });
someGenerics5(__makeTemplateObject(["", "", ""], ["", "", ""]), null, null);
// Generic tag with multiple arguments of function types that each have parameters of the same generic type
function someGenerics6(strs, a, b, c) { }
someGenerics6(_r || (_r = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), function (n) { return n; }, function (n) { return n; }, function (n) { return n; });
someGenerics6(_s || (_s = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), function (n) { return n; }, function (n) { return n; }, function (n) { return n; });
someGenerics6(_t || (_t = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), function (n) { return n; }, function (n) { return n; }, function (n) { return n; });
someGenerics6(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), function (n) { return n; }, function (n) { return n; }, function (n) { return n; });
someGenerics6(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), function (n) { return n; }, function (n) { return n; }, function (n) { return n; });
someGenerics6(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), function (n) { return n; }, function (n) { return n; }, function (n) { return n; });
// Generic tag with multiple arguments of function types that each have parameters of different generic type
function someGenerics7(strs, a, b, c) { }
someGenerics7(_u || (_u = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), function (n) { return n; }, function (n) { return n; }, function (n) { return n; });
someGenerics7(_v || (_v = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), function (n) { return n; }, function (n) { return n; }, function (n) { return n; });
someGenerics7(_w || (_w = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), function (n) { return n; }, function (n) { return n; }, function (n) { return n; });
someGenerics7(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), function (n) { return n; }, function (n) { return n; }, function (n) { return n; });
someGenerics7(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), function (n) { return n; }, function (n) { return n; }, function (n) { return n; });
someGenerics7(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), function (n) { return n; }, function (n) { return n; }, function (n) { return n; });
// Generic tag with argument of generic function type
function someGenerics8(strs, n) { return n; }
var x = someGenerics8(_x || (_x = __makeTemplateObject(["", ""], ["", ""])), someGenerics7);
x(_y || (_y = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), null, null, null);
var x = someGenerics8(__makeTemplateObject(["", ""], ["", ""]), someGenerics7);
x(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), null, null, null);
// Generic tag with multiple parameters of generic type passed arguments with no best common type
function someGenerics9(strs, a, b, c) {
return null;
}
var a9a = someGenerics9(_z || (_z = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), '', 0, []);
var a9a = someGenerics9(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), '', 0, []);
var a9a;
var a9e = someGenerics9(_0 || (_0 = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), undefined, { x: 6, z: new Date() }, { x: 6, y: '' });
var a9e = someGenerics9(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), undefined, { x: 6, z: new Date() }, { x: 6, y: '' });
var a9e;
// Generic tag with multiple parameters of generic type passed arguments with a single best common type
var a9d = someGenerics9(_1 || (_1 = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), { x: 3 }, { x: 6 }, { x: 6 });
var a9d = someGenerics9(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), { x: 3 }, { x: 6 }, { x: 6 });
var a9d;
// Generic tag with multiple parameters of generic type where one argument is of type 'any'
var anyVar;
var a = someGenerics9(_2 || (_2 = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), 7, anyVar, 4);
var a = someGenerics9(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), 7, anyVar, 4);
var a;
// Generic tag with multiple parameters of generic type where one argument is [] and the other is not 'any'
var arr = someGenerics9(_3 || (_3 = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), [], null, undefined);
var arr = someGenerics9(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), [], null, undefined);
var arr;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
return cooked;
};
var f;
f(_a || (_a = __makeTemplateObject(["abc"], ["abc"])));
f(_b || (_b = __makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"])), 1, 2);
f(_c || (_c = __makeTemplateObject(["abc"], ["abc"]))).member;
f(_d || (_d = __makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"])), 1, 2).member;
f(_e || (_e = __makeTemplateObject(["abc"], ["abc"])))["member"];
f(_f || (_f = __makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"])), 1, 2)["member"];
f(_g || (_g = __makeTemplateObject(["abc"], ["abc"])))[0].member(_h || (_h = __makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"])), 1, 2);
f(_j || (_j = __makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"])), 1, 2)["member"].member(_k || (_k = __makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"])), 1, 2);
f(_l || (_l = __makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"])), true, true)["member"].member(_m || (_m = __makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"])), 1, 2);
f(__makeTemplateObject(["abc"], ["abc"]));
f(__makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"]), 1, 2);
f(__makeTemplateObject(["abc"], ["abc"])).member;
f(__makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"]), 1, 2).member;
f(__makeTemplateObject(["abc"], ["abc"]))["member"];
f(__makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"]), 1, 2)["member"];
f(__makeTemplateObject(["abc"], ["abc"]))[0].member(__makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"]), 1, 2);
f(__makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"]), 1, 2)["member"].member(__makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"]), 1, 2);
f(__makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"]), true, true)["member"].member(__makeTemplateObject(["abc", "def", "ghi"], ["abc", "def", "ghi"]), 1, 2);
f.thisIsNotATag("abc");
f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi");
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
return cooked;
};
var f;
var x = new new new (f(_a || (_a = __makeTemplateObject(["abc", "def"], ["abc", "def"])), 0).member)("hello")(42) === true;
var _a;
var x = new new new (f(__makeTemplateObject(["abc", "def"], ["abc", "def"]), 0).member)("hello")(42) === true;
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ function f() {
args[_i] = arguments[_i];
}
}
f(_a || (_a = __makeTemplateObject(["\n\n"], ["\n\\\n\n"])));
var _a;
f(__makeTemplateObject(["\n\n"], ["\n\\\n\n"]));
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ var c = foo([], 1, 2); // boolean
var d = foo([], 1, true); // boolean (with error)
var e = foo([], 1, "2"); // {}
var f = foo([], 1, 2, 3); // any (with error)
var u = foo(_a || (_a = __makeTemplateObject([""], [""]))); // number
var v = foo(_b || (_b = __makeTemplateObject(["", ""], ["", ""])), 1); // string
var w = foo(_c || (_c = __makeTemplateObject(["", "", ""], ["", "", ""])), 1, 2); // boolean
var x = foo(_d || (_d = __makeTemplateObject(["", "", ""], ["", "", ""])), 1, true); // boolean (with error)
var y = foo(_e || (_e = __makeTemplateObject(["", "", ""], ["", "", ""])), 1, "2"); // {}
var z = foo(_f || (_f = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), 1, 2, 3); // any (with error)
var _a, _b, _c, _d, _e, _f;
var u = foo(__makeTemplateObject([""], [""])); // number
var v = foo(__makeTemplateObject(["", ""], ["", ""]), 1); // string
var w = foo(__makeTemplateObject(["", "", ""], ["", "", ""]), 1, 2); // boolean
var x = foo(__makeTemplateObject(["", "", ""], ["", "", ""]), 1, true); // boolean (with error)
var y = foo(__makeTemplateObject(["", "", ""], ["", "", ""]), 1, "2"); // {}
var z = foo(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), 1, 2, 3); // any (with error)
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function foo1() {
}
return undefined;
}
var a = foo1(_a || (_a = __makeTemplateObject(["", ""], ["", ""])), 1);
var a = foo1(__makeTemplateObject(["", ""], ["", ""]), 1);
var b = foo1([], 1);
function foo2() {
var stuff = [];
Expand All @@ -41,6 +41,5 @@ function foo2() {
}
return undefined;
}
var c = foo2(_b || (_b = __makeTemplateObject(["", ""], ["", ""])), 1);
var c = foo2(__makeTemplateObject(["", ""], ["", ""]), 1);
var d = foo2([], 1);
var _a, _b;
Original file line number Diff line number Diff line change
Expand Up @@ -81,41 +81,40 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
return cooked;
};
function fn1() { return null; }
var s = fn1(_a || (_a = __makeTemplateObject(["", ""], ["", ""])), undefined);
var s = fn1(__makeTemplateObject(["", ""], ["", ""]), undefined);
// No candidate overloads found
fn1(_b || (_b = __makeTemplateObject(["", ""], ["", ""])), {}); // Error
fn1(__makeTemplateObject(["", ""], ["", ""]), {}); // Error
function fn2() { return undefined; }
var d1 = fn2(_c || (_c = __makeTemplateObject(["", "", ""], ["", "", ""])), 0, undefined); // contextually typed
var d2 = fn2(_d || (_d = __makeTemplateObject(["", "", ""], ["", "", ""])), 0, undefined); // any
var d1 = fn2(__makeTemplateObject(["", "", ""], ["", "", ""]), 0, undefined); // contextually typed
var d2 = fn2(__makeTemplateObject(["", "", ""], ["", "", ""]), 0, undefined); // any
d1.foo(); // error
d2(); // no error (typed as any)
// Generic and non-generic overload where generic overload is the only candidate
fn2(_e || (_e = __makeTemplateObject(["", "", ""], ["", "", ""])), 0, ''); // OK
fn2(__makeTemplateObject(["", "", ""], ["", "", ""]), 0, ''); // OK
// Generic and non-generic overload where non-generic overload is the only candidate
fn2(_f || (_f = __makeTemplateObject(["", "", ""], ["", "", ""])), '', 0); // OK
fn2(__makeTemplateObject(["", "", ""], ["", "", ""]), '', 0); // OK
function fn3() { return null; }
var s = fn3(_g || (_g = __makeTemplateObject(["", ""], ["", ""])), 3);
var s = fn3(_h || (_h = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), '', 3, '');
var n = fn3(_j || (_j = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), 5, 5, 5);
var s = fn3(__makeTemplateObject(["", ""], ["", ""]), 3);
var s = fn3(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), '', 3, '');
var n = fn3(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), 5, 5, 5);
var n;
// Generic overloads with differing arity tagging with arguments matching each overload type parameter count
var s = fn3(_k || (_k = __makeTemplateObject(["", ""], ["", ""])), 4);
var s = fn3(_l || (_l = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), '', '', '');
var n = fn3(_m || (_m = __makeTemplateObject(["", "", "", ""], ["", "", "", ""])), '', '', 3);
var s = fn3(__makeTemplateObject(["", ""], ["", ""]), 4);
var s = fn3(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), '', '', '');
var n = fn3(__makeTemplateObject(["", "", "", ""], ["", "", "", ""]), '', '', 3);
// Generic overloads with differing arity tagging with argument count that doesn't match any overload
fn3(_o || (_o = __makeTemplateObject([""], [""]))); // Error
fn3(__makeTemplateObject([""], [""])); // Error
function fn4() { }
// Generic overloads with constraints tagged with types that satisfy the constraints
fn4(_p || (_p = __makeTemplateObject(["", "", ""], ["", "", ""])), '', 3);
fn4(_q || (_q = __makeTemplateObject(["", "", ""], ["", "", ""])), 3, '');
fn4(_r || (_r = __makeTemplateObject(["", "", ""], ["", "", ""])), 3, undefined);
fn4(_s || (_s = __makeTemplateObject(["", "", ""], ["", "", ""])), '', null);
fn4(__makeTemplateObject(["", "", ""], ["", "", ""]), '', 3);
fn4(__makeTemplateObject(["", "", ""], ["", "", ""]), 3, '');
fn4(__makeTemplateObject(["", "", ""], ["", "", ""]), 3, undefined);
fn4(__makeTemplateObject(["", "", ""], ["", "", ""]), '', null);
// Generic overloads with constraints called with type arguments that do not satisfy the constraints
fn4(_t || (_t = __makeTemplateObject(["", "", ""], ["", "", ""])), null, null); // Error
fn4(__makeTemplateObject(["", "", ""], ["", "", ""]), null, null); // Error
// Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints
fn4(_u || (_u = __makeTemplateObject(["", "", ""], ["", "", ""])), true, null);
fn4(_v || (_v = __makeTemplateObject(["", "", ""], ["", "", ""])), null, true);
fn4(__makeTemplateObject(["", "", ""], ["", "", ""]), true, null);
fn4(__makeTemplateObject(["", "", ""], ["", "", ""]), null, true);
function fn5() { return undefined; }
fn5(_w || (_w = __makeTemplateObject(["", ""], ["", ""])), function (n) { return n.toFixed(); }); // will error; 'n' should have type 'string'.
fn5(_x || (_x = __makeTemplateObject(["", ""], ["", ""])), function (n) { return n.substr(0); });
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
fn5(__makeTemplateObject(["", ""], ["", ""]), function (n) { return n.toFixed(); }); // will error; 'n' should have type 'string'.
fn5(__makeTemplateObject(["", ""], ["", ""]), function (n) { return n.substr(0); });
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ function declare(x) {
ys[_i - 1] = arguments[_i];
}
}
declare(_a || (_a = __makeTemplateObject(["Hello ", " world!"], ["Hello ", " world!"])), 0);
var _a;
declare(__makeTemplateObject(["Hello ", " world!"], ["Hello ", " world!"]), 0);
Loading

0 comments on commit 9f3db7f

Please sign in to comment.