From 81b3e85592cb0191bb80af8f4a62970cc0ea2873 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 29 Sep 2017 23:05:38 -0700 Subject: [PATCH] Accepted baselines. --- .../taggedTemplatesInModuleAndGlobal.js | 61 +++++++++++++++++++ .../taggedTemplatesInModuleAndGlobal.symbols | 50 +++++++++++++++ .../taggedTemplatesInModuleAndGlobal.types | 60 ++++++++++++++++++ 3 files changed, 171 insertions(+) create mode 100644 tests/baselines/reference/taggedTemplatesInModuleAndGlobal.js create mode 100644 tests/baselines/reference/taggedTemplatesInModuleAndGlobal.symbols create mode 100644 tests/baselines/reference/taggedTemplatesInModuleAndGlobal.types diff --git a/tests/baselines/reference/taggedTemplatesInModuleAndGlobal.js b/tests/baselines/reference/taggedTemplatesInModuleAndGlobal.js new file mode 100644 index 00000000000..6e64f8406c3 --- /dev/null +++ b/tests/baselines/reference/taggedTemplatesInModuleAndGlobal.js @@ -0,0 +1,61 @@ +//// [tests/cases/compiler/taggedTemplatesInModuleAndGlobal.ts] //// + +//// [global.ts] +namespace n { + function id(x: T): T { + return x; + } + + function templateObjectFactory() { + return id`hello world`; + } + let result = templateObjectFactory() === templateObjectFactory(); +} +//// [module.ts] +export { } +function id(x: T): T { + return x; +} + +function templateObjectFactory() { + return id`hello world`; +} +let result = templateObjectFactory() === templateObjectFactory(); + + +//// [global.js] +var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { + if (Object.defineProperty) { + return Object.defineProperty(cooked, "raw", { value: raw }); + } + cooked.raw = raw; + return cooked; +}; +var n; +(function (n) { + function id(x) { + return x; + } + function templateObjectFactory() { + return id(__makeTemplateObject(["hello world"], ["hello world"])); + } + var result = templateObjectFactory() === templateObjectFactory(); +})(n || (n = {})); +//// [module.js] +"use strict"; +var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { + if (Object.defineProperty) { + return Object.defineProperty(cooked, "raw", { value: raw }); + } + cooked.raw = raw; + return cooked; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +function id(x) { + return x; +} +function templateObjectFactory() { + return id(_a || (_a = __makeTemplateObject(["hello world"], ["hello world"]))); +} +var result = templateObjectFactory() === templateObjectFactory(); +var _a; diff --git a/tests/baselines/reference/taggedTemplatesInModuleAndGlobal.symbols b/tests/baselines/reference/taggedTemplatesInModuleAndGlobal.symbols new file mode 100644 index 00000000000..b33ff869734 --- /dev/null +++ b/tests/baselines/reference/taggedTemplatesInModuleAndGlobal.symbols @@ -0,0 +1,50 @@ +=== tests/cases/compiler/global.ts === +namespace n { +>n : Symbol(n, Decl(global.ts, 0, 0)) + + function id(x: T): T { +>id : Symbol(id, Decl(global.ts, 0, 13)) +>T : Symbol(T, Decl(global.ts, 1, 16)) +>x : Symbol(x, Decl(global.ts, 1, 19)) +>T : Symbol(T, Decl(global.ts, 1, 16)) +>T : Symbol(T, Decl(global.ts, 1, 16)) + + return x; +>x : Symbol(x, Decl(global.ts, 1, 19)) + } + + function templateObjectFactory() { +>templateObjectFactory : Symbol(templateObjectFactory, Decl(global.ts, 3, 5)) + + return id`hello world`; +>id : Symbol(id, Decl(global.ts, 0, 13)) + } + let result = templateObjectFactory() === templateObjectFactory(); +>result : Symbol(result, Decl(global.ts, 8, 7)) +>templateObjectFactory : Symbol(templateObjectFactory, Decl(global.ts, 3, 5)) +>templateObjectFactory : Symbol(templateObjectFactory, Decl(global.ts, 3, 5)) +} +=== tests/cases/compiler/module.ts === +export { } +function id(x: T): T { +>id : Symbol(id, Decl(module.ts, 0, 10)) +>T : Symbol(T, Decl(module.ts, 1, 12)) +>x : Symbol(x, Decl(module.ts, 1, 15)) +>T : Symbol(T, Decl(module.ts, 1, 12)) +>T : Symbol(T, Decl(module.ts, 1, 12)) + + return x; +>x : Symbol(x, Decl(module.ts, 1, 15)) +} + +function templateObjectFactory() { +>templateObjectFactory : Symbol(templateObjectFactory, Decl(module.ts, 3, 1)) + + return id`hello world`; +>id : Symbol(id, Decl(module.ts, 0, 10)) +} +let result = templateObjectFactory() === templateObjectFactory(); +>result : Symbol(result, Decl(module.ts, 8, 3)) +>templateObjectFactory : Symbol(templateObjectFactory, Decl(module.ts, 3, 1)) +>templateObjectFactory : Symbol(templateObjectFactory, Decl(module.ts, 3, 1)) + diff --git a/tests/baselines/reference/taggedTemplatesInModuleAndGlobal.types b/tests/baselines/reference/taggedTemplatesInModuleAndGlobal.types new file mode 100644 index 00000000000..14550acb6b0 --- /dev/null +++ b/tests/baselines/reference/taggedTemplatesInModuleAndGlobal.types @@ -0,0 +1,60 @@ +=== tests/cases/compiler/global.ts === +namespace n { +>n : typeof n + + function id(x: T): T { +>id : (x: T) => T +>T : T +>x : T +>T : T +>T : T + + return x; +>x : T + } + + function templateObjectFactory() { +>templateObjectFactory : () => TemplateStringsArray + + return id`hello world`; +>id`hello world` : TemplateStringsArray +>id : (x: T) => T +>`hello world` : "hello world" + } + let result = templateObjectFactory() === templateObjectFactory(); +>result : boolean +>templateObjectFactory() === templateObjectFactory() : boolean +>templateObjectFactory() : TemplateStringsArray +>templateObjectFactory : () => TemplateStringsArray +>templateObjectFactory() : TemplateStringsArray +>templateObjectFactory : () => TemplateStringsArray +} +=== tests/cases/compiler/module.ts === +export { } +function id(x: T): T { +>id : (x: T) => T +>T : T +>x : T +>T : T +>T : T + + return x; +>x : T +} + +function templateObjectFactory() { +>templateObjectFactory : () => TemplateStringsArray + + return id`hello world`; +>id`hello world` : TemplateStringsArray +>id : (x: T) => T +>`hello world` : "hello world" +} +let result = templateObjectFactory() === templateObjectFactory(); +>result : boolean +>templateObjectFactory() === templateObjectFactory() : boolean +>templateObjectFactory() : TemplateStringsArray +>templateObjectFactory : () => TemplateStringsArray +>templateObjectFactory() : TemplateStringsArray +>templateObjectFactory : () => TemplateStringsArray +