Accepted baselines.

This commit is contained in:
Daniel Rosenwasser 2017-09-27 17:32:14 -07:00
parent 1841afeaa2
commit 0b7538d04d
7 changed files with 179 additions and 0 deletions

30
tests/baselines/reference/importHelpers.js Normal file → Executable file
View File

@ -11,6 +11,12 @@ class C {
method(@dec x: number) {
}
}
function id<T>(x: T) {
return x;
}
export const result = id`hello world`;
//// [script.ts]
class A { }
@ -23,6 +29,12 @@ class C {
method(@dec x: number) {
}
}
function id<T>(x: T) {
return x;
}
const result = id`hello world`;
//// [tslib.d.ts]
export declare function __extends(d: Function, b: Function): void;
@ -31,6 +43,7 @@ export declare function __decorate(decorators: Function[], target: any, key?: st
export declare function __param(paramIndex: number, decorator: Function): Function;
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
//// [external.js]
@ -67,6 +80,11 @@ var C = /** @class */ (function () {
], C);
return C;
}());
function id(x) {
return x;
}
exports.result = id(_a || (_a = tslib_1.__makeTemplateObject(["hello world"], ["hello world"])));
var _a;
//// [script.js]
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
@ -78,6 +96,13 @@ var __extends = (this && this.__extends) || (function () {
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) {
return Object.defineProperty(cooked, "raw", { value: raw });
}
cooked.raw = raw;
return cooked;
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@ -118,3 +143,8 @@ var C = /** @class */ (function () {
], C);
return C;
}());
function id(x) {
return x;
}
var result = id(_a || (_a = __makeTemplateObject(["hello world"], ["hello world"])));
var _a;

34
tests/baselines/reference/importHelpers.symbols Normal file → Executable file
View File

@ -22,6 +22,20 @@ class C {
}
}
function id<T>(x: T) {
>id : Symbol(id, Decl(external.ts, 9, 1))
>T : Symbol(T, Decl(external.ts, 11, 12))
>x : Symbol(x, Decl(external.ts, 11, 15))
>T : Symbol(T, Decl(external.ts, 11, 12))
return x;
>x : Symbol(x, Decl(external.ts, 11, 15))
}
export const result = id`hello world`;
>result : Symbol(result, Decl(external.ts, 15, 12))
>id : Symbol(id, Decl(external.ts, 9, 1))
=== tests/cases/compiler/script.ts ===
class A { }
>A : Symbol(A, Decl(script.ts, 0, 0))
@ -46,6 +60,20 @@ class C {
}
}
function id<T>(x: T) {
>id : Symbol(id, Decl(script.ts, 9, 1))
>T : Symbol(T, Decl(script.ts, 11, 12))
>x : Symbol(x, Decl(script.ts, 11, 15))
>T : Symbol(T, Decl(script.ts, 11, 12))
return x;
>x : Symbol(x, Decl(script.ts, 11, 15))
}
const result = id`hello world`;
>result : Symbol(result, Decl(script.ts, 15, 5))
>id : Symbol(id, Decl(script.ts, 9, 1))
=== tests/cases/compiler/tslib.d.ts ===
export declare function __extends(d: Function, b: Function): void;
>__extends : Symbol(__extends, Decl(tslib.d.ts, --, --))
@ -89,3 +117,9 @@ export declare function __awaiter(thisArg: any, _arguments: any, P: Function, ge
>generator : Symbol(generator, Decl(tslib.d.ts, --, --))
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
>__makeTemplateObject : Symbol(__makeTemplateObject, Decl(tslib.d.ts, --, --))
>cooked : Symbol(cooked, Decl(tslib.d.ts, --, --))
>raw : Symbol(raw, Decl(tslib.d.ts, --, --))
>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --))

38
tests/baselines/reference/importHelpers.types Normal file → Executable file
View File

@ -22,6 +22,22 @@ class C {
}
}
function id<T>(x: T) {
>id : <T>(x: T) => T
>T : T
>x : T
>T : T
return x;
>x : T
}
export const result = id`hello world`;
>result : TemplateStringsArray
>id`hello world` : TemplateStringsArray
>id : <T>(x: T) => T
>`hello world` : "hello world"
=== tests/cases/compiler/script.ts ===
class A { }
>A : A
@ -46,6 +62,22 @@ class C {
}
}
function id<T>(x: T) {
>id : <T>(x: T) => T
>T : T
>x : T
>T : T
return x;
>x : T
}
const result = id`hello world`;
>result : TemplateStringsArray
>id`hello world` : TemplateStringsArray
>id : <T>(x: T) => T
>`hello world` : "hello world"
=== tests/cases/compiler/tslib.d.ts ===
export declare function __extends(d: Function, b: Function): void;
>__extends : (d: Function, b: Function) => void
@ -89,3 +121,9 @@ export declare function __awaiter(thisArg: any, _arguments: any, P: Function, ge
>generator : Function
>Function : Function
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
>__makeTemplateObject : (cooked: string[], raw: string[]) => TemplateStringsArray
>cooked : string[]
>raw : string[]
>TemplateStringsArray : TemplateStringsArray

View File

@ -0,0 +1,15 @@
tests/cases/compiler/foo.ts(5,23): error TS2343: This syntax requires an imported helper named '__makeTemplateObject', but module 'tslib' has no exported member '__makeTemplateObject'.
==== tests/cases/compiler/foo.ts (1 errors) ====
function id<T>(x: T) {
return x;
}
export const result = id `hello world`;
~~~~~~~~~~~~~~~~
!!! error TS2343: This syntax requires an imported helper named '__makeTemplateObject', but module 'tslib' has no exported member '__makeTemplateObject'.
==== tests/cases/compiler/node_modules/tslib/index.d.ts (0 errors) ====
export { };

View File

@ -0,0 +1,22 @@
//// [tests/cases/compiler/taggedTemplateWithoutDeclaredHelper.ts] ////
//// [foo.ts]
function id<T>(x: T) {
return x;
}
export const result = id `hello world`;
//// [index.d.ts]
export { };
//// [foo.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
function id(x) {
return x;
}
exports.result = id(_a || (_a = tslib_1.__makeTemplateObject(["hello world"], ["hello world"])));
var _a;

View File

@ -0,0 +1,19 @@
=== tests/cases/compiler/foo.ts ===
function id<T>(x: T) {
>id : Symbol(id, Decl(foo.ts, 0, 0))
>T : Symbol(T, Decl(foo.ts, 0, 12))
>x : Symbol(x, Decl(foo.ts, 0, 15))
>T : Symbol(T, Decl(foo.ts, 0, 12))
return x;
>x : Symbol(x, Decl(foo.ts, 0, 15))
}
export const result = id `hello world`;
>result : Symbol(result, Decl(foo.ts, 4, 12))
>id : Symbol(id, Decl(foo.ts, 0, 0))
=== tests/cases/compiler/node_modules/tslib/index.d.ts ===
export { };
No type information for this code.
No type information for this code.

View File

@ -0,0 +1,21 @@
=== tests/cases/compiler/foo.ts ===
function id<T>(x: T) {
>id : <T>(x: T) => T
>T : T
>x : T
>T : T
return x;
>x : T
}
export const result = id `hello world`;
>result : TemplateStringsArray
>id `hello world` : TemplateStringsArray
>id : <T>(x: T) => T
>`hello world` : "hello world"
=== tests/cases/compiler/node_modules/tslib/index.d.ts ===
export { };
No type information for this code.
No type information for this code.