Accepted baselines.

This commit is contained in:
Daniel Rosenwasser 2018-04-13 23:23:05 -07:00
parent da7967a3cf
commit 090f6bd77c
6 changed files with 204 additions and 141 deletions

View File

@ -1050,6 +1050,7 @@ declare namespace ts {
interface TaggedTemplateExpression extends MemberExpression {
kind: SyntaxKind.TaggedTemplateExpression;
tag: LeftHandSideExpression;
typeArguments?: NodeArray<TypeNode>;
template: TemplateLiteral;
}
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement;

View File

@ -1050,6 +1050,7 @@ declare namespace ts {
interface TaggedTemplateExpression extends MemberExpression {
kind: SyntaxKind.TaggedTemplateExpression;
tag: LeftHandSideExpression;
typeArguments?: NodeArray<TypeNode>;
template: TemplateLiteral;
}
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement;

View File

@ -1,16 +1,18 @@
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(9,18): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(9,20): error TS2693: 'Stuff' only refers to a type, but is being used as a value here.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(22,20): error TS2693: 'Stuff' only refers to a type, but is being used as a value here.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(22,50): error TS1005: ',' expected.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(39,18): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(39,30): error TS2693: 'Stuff' only refers to a type, but is being used as a value here.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(39,53): error TS1128: Declaration or statement expected.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(40,3): error TS2339: Property 'returnedProp' does not exist on type 'boolean'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(41,3): error TS2339: Property 'returnedProp' does not exist on type 'boolean'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(42,3): error TS2339: Property 'returnedProp' does not exist on type 'boolean'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(11,22): error TS2339: Property 'x' does not exist on type '{}'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(13,22): error TS2339: Property 'y' does not exist on type '{}'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(15,22): error TS2339: Property 'z' does not exist on type '{}'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(24,22): error TS2339: Property 'x' does not exist on type '{}'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(26,22): error TS2339: Property 'y' does not exist on type '{}'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(28,22): error TS2339: Property 'z' does not exist on type '{}'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(38,19): error TS2339: Property 'x' does not exist on type '{}'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(39,19): error TS2339: Property 'y' does not exist on type '{}'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(40,19): error TS2339: Property 'z' does not exist on type '{}'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(43,19): error TS2339: Property 'x' does not exist on type '{}'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(44,19): error TS2339: Property 'y' does not exist on type '{}'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(45,19): error TS2339: Property 'z' does not exist on type '{}'.
==== tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts (10 errors) ====
==== tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts (12 errors) ====
declare function f<T>(strs: TemplateStringsArray, ...callbacks: Array<(x: T) => any>): void;
interface Stuff {
@ -20,63 +22,63 @@ tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts(42,3)
}
export const a = f<Stuff> `
~~~~~~~~~~
~~~~~
!!! error TS2693: 'Stuff' only refers to a type, but is being used as a value here.
hello
~~~~~~~~~
${stuff => stuff.x}
~~~~~~~~~~~~~~~~~~~~~~~
~
!!! error TS2339: Property 'x' does not exist on type '{}'.
brave
~~~~~~~~~
${stuff => stuff.y}
~~~~~~~~~~~~~~~~~~~~~~~
~
!!! error TS2339: Property 'y' does not exist on type '{}'.
world
~~~~~~~~~
${stuff => stuff.z}
~~~~~~~~~~~~~~~~~~~~~~~
~
!!! error TS2339: Property 'z' does not exist on type '{}'.
`;
~
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'.
declare function g<Input, T, U, V>(
strs: TemplateStringsArray,
t: (i: Input) => T, u: (i: Input) => U, v: (i: Input) => V): T | U | V;
export const b = g<Stuff, number, string, boolean> `
~~~~~
!!! error TS2693: 'Stuff' only refers to a type, but is being used as a value here.
~
!!! error TS1005: ',' expected.
hello
${stuff => stuff.x}
~
!!! error TS2339: Property 'x' does not exist on type '{}'.
brave
${stuff => stuff.y}
~
!!! error TS2339: Property 'y' does not exist on type '{}'.
world
${stuff => stuff.z}
~
!!! error TS2339: Property 'z' does not exist on type '{}'.
`;
declare let obj: {
prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => {
returnedObjProp: {
lastOne: T
}
returnedObjProp: T
}
}
export const c = obj["prop"]<Stuff> `${(input) => { ...input }}`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'.
~~~~~
!!! error TS2693: 'Stuff' only refers to a type, but is being used as a value here.
~~~
!!! error TS1128: Declaration or statement expected.
c.returnedProp.x;
~~~~~~~~~~~~
!!! error TS2339: Property 'returnedProp' does not exist on type 'boolean'.
c.returnedProp.y;
~~~~~~~~~~~~
!!! error TS2339: Property 'returnedProp' does not exist on type 'boolean'.
c.returnedProp.z;
~~~~~~~~~~~~
!!! error TS2339: Property 'returnedProp' does not exist on type 'boolean'.
export let c = obj["prop"]<Stuff> `${(input) => ({ ...input })}`
c.returnedObjProp.x;
~
!!! error TS2339: Property 'x' does not exist on type '{}'.
c.returnedObjProp.y;
~
!!! error TS2339: Property 'y' does not exist on type '{}'.
c.returnedObjProp.z;
~
!!! error TS2339: Property 'z' does not exist on type '{}'.
c = obj.prop<Stuff> `${(input) => ({ ...input })}`
c.returnedObjProp.x;
~
!!! error TS2339: Property 'x' does not exist on type '{}'.
c.returnedObjProp.y;
~
!!! error TS2339: Property 'y' does not exist on type '{}'.
c.returnedObjProp.z;
~
!!! error TS2339: Property 'z' does not exist on type '{}'.

View File

@ -31,19 +31,22 @@ export const b = g<Stuff, number, string, boolean> `
declare let obj: {
prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => {
returnedObjProp: {
lastOne: T
}
returnedObjProp: T
}
}
export const c = obj["prop"]<Stuff> `${(input) => { ...input }}`
c.returnedProp.x;
c.returnedProp.y;
c.returnedProp.z;
export let c = obj["prop"]<Stuff> `${(input) => ({ ...input })}`
c.returnedObjProp.x;
c.returnedObjProp.y;
c.returnedObjProp.z;
c = obj.prop<Stuff> `${(input) => ({ ...input })}`
c.returnedObjProp.x;
c.returnedObjProp.y;
c.returnedObjProp.z;
//// [taggedTemplatesWithTypeArguments1.js]
export const a = f < Stuff > `
export const a = f<Stuff> `
hello
${stuff => stuff.x}
brave
@ -51,8 +54,7 @@ export const a = f < Stuff > `
world
${stuff => stuff.z}
`;
export const b = g < Stuff, number, string, boolean;
> `
export const b = g<Stuff, number, string, boolean> `
hello
${stuff => stuff.x}
brave
@ -60,7 +62,11 @@ export const b = g < Stuff, number, string, boolean;
world
${stuff => stuff.z}
`;
export const c = obj["prop"] < Stuff > `${(input) => { input; }}`;
c.returnedProp.x;
c.returnedProp.y;
c.returnedProp.z;
export let c = obj["prop"]<Stuff> `${(input) => ({ ...input })}`;
c.returnedObjProp.x;
c.returnedObjProp.y;
c.returnedObjProp.z;
c = obj.prop<Stuff> `${(input) => ({ ...input })}`;
c.returnedObjProp.x;
c.returnedObjProp.y;
c.returnedObjProp.z;

View File

@ -25,6 +25,7 @@ interface Stuff {
export const a = f<Stuff> `
>a : Symbol(a, Decl(taggedTemplatesWithTypeArguments1.ts, 8, 12))
>f : Symbol(f, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 0))
>Stuff : Symbol(Stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 92))
hello
${stuff => stuff.x}
@ -74,9 +75,7 @@ declare function g<Input, T, U, V>(
export const b = g<Stuff, number, string, boolean> `
>b : Symbol(b, Decl(taggedTemplatesWithTypeArguments1.ts, 21, 12))
>g : Symbol(g, Decl(taggedTemplatesWithTypeArguments1.ts, 15, 2))
>number : Symbol(number, Decl(taggedTemplatesWithTypeArguments1.ts, 21, 25))
>string : Symbol(string, Decl(taggedTemplatesWithTypeArguments1.ts, 21, 33))
>boolean : Symbol(boolean, Decl(taggedTemplatesWithTypeArguments1.ts, 21, 41))
>Stuff : Symbol(Stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 92))
hello
${stuff => stuff.x}
@ -108,29 +107,56 @@ declare let obj: {
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 11))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 11))
returnedObjProp: {
returnedObjProp: T
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
lastOne: T
>lastOne : Symbol(lastOne, Decl(taggedTemplatesWithTypeArguments1.ts, 32, 26))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 11))
}
}
}
export const c = obj["prop"]<Stuff> `${(input) => { ...input }}`
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 38, 12))
export let c = obj["prop"]<Stuff> `${(input) => ({ ...input })}`
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>obj : Symbol(obj, Decl(taggedTemplatesWithTypeArguments1.ts, 30, 11))
>"prop" : Symbol(prop, Decl(taggedTemplatesWithTypeArguments1.ts, 30, 18))
>input : Symbol(input, Decl(taggedTemplatesWithTypeArguments1.ts, 38, 40))
>input : Symbol(input, Decl(taggedTemplatesWithTypeArguments1.ts, 38, 40))
>Stuff : Symbol(Stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 92))
>input : Symbol(input, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 38))
>input : Symbol(input, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 38))
c.returnedProp.x;
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 38, 12))
c.returnedObjProp.x;
>c.returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
c.returnedProp.y;
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 38, 12))
c.returnedObjProp.y;
>c.returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
c.returnedProp.z;
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 38, 12))
c.returnedObjProp.z;
>c.returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
c = obj.prop<Stuff> `${(input) => ({ ...input })}`
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>obj.prop : Symbol(prop, Decl(taggedTemplatesWithTypeArguments1.ts, 30, 18))
>obj : Symbol(obj, Decl(taggedTemplatesWithTypeArguments1.ts, 30, 11))
>prop : Symbol(prop, Decl(taggedTemplatesWithTypeArguments1.ts, 30, 18))
>Stuff : Symbol(Stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 92))
>input : Symbol(input, Decl(taggedTemplatesWithTypeArguments1.ts, 41, 24))
>input : Symbol(input, Decl(taggedTemplatesWithTypeArguments1.ts, 41, 24))
c.returnedObjProp.x;
>c.returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
c.returnedObjProp.y;
>c.returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
c.returnedObjProp.z;
>c.returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))

View File

@ -23,35 +23,34 @@ interface Stuff {
}
export const a = f<Stuff> `
>a : boolean
>f<Stuff> ` hello ${stuff => stuff.x} brave ${stuff => stuff.y} world ${stuff => stuff.z}` : boolean
>f<Stuff : boolean
>a : void
>f<Stuff> ` hello ${stuff => stuff.x} brave ${stuff => stuff.y} world ${stuff => stuff.z}` : void
>f : <T>(strs: TemplateStringsArray, ...callbacks: ((x: T) => any)[]) => void
>Stuff : any
>Stuff : Stuff
>` hello ${stuff => stuff.x} brave ${stuff => stuff.y} world ${stuff => stuff.z}` : string
hello
${stuff => stuff.x}
>stuff => stuff.x : (stuff: any) => any
>stuff : any
>stuff => stuff.x : (stuff: {}) => any
>stuff : {}
>stuff.x : any
>stuff : any
>stuff : {}
>x : any
brave
${stuff => stuff.y}
>stuff => stuff.y : (stuff: any) => any
>stuff : any
>stuff => stuff.y : (stuff: {}) => any
>stuff : {}
>stuff.y : any
>stuff : any
>stuff : {}
>y : any
world
${stuff => stuff.z}
>stuff => stuff.z : (stuff: any) => any
>stuff : any
>stuff => stuff.z : (stuff: {}) => any
>stuff : {}
>stuff.z : any
>stuff : any
>stuff : {}
>z : any
`;
@ -85,48 +84,43 @@ declare function g<Input, T, U, V>(
>V : V
export const b = g<Stuff, number, string, boolean> `
>b : boolean
>g<Stuff : boolean
>b : any
>g<Stuff, number, string, boolean> ` hello ${stuff => stuff.x} brave ${stuff => stuff.y} world ${stuff => stuff.z}` : any
>g : <Input, T, U, V>(strs: TemplateStringsArray, t: (i: Input) => T, u: (i: Input) => U, v: (i: Input) => V) => T | U | V
>Stuff : any
>number : any
>string : any
>boolean : any
>> ` hello ${stuff => stuff.x} brave ${stuff => stuff.y} world ${stuff => stuff.z}` : boolean
> : any
>Stuff : Stuff
>` hello ${stuff => stuff.x} brave ${stuff => stuff.y} world ${stuff => stuff.z}` : string
hello
${stuff => stuff.x}
>stuff => stuff.x : (stuff: any) => any
>stuff : any
>stuff => stuff.x : (stuff: {}) => any
>stuff : {}
>stuff.x : any
>stuff : any
>stuff : {}
>x : any
brave
${stuff => stuff.y}
>stuff => stuff.y : (stuff: any) => any
>stuff : any
>stuff => stuff.y : (stuff: {}) => any
>stuff : {}
>stuff.y : any
>stuff : any
>stuff : {}
>y : any
world
${stuff => stuff.z}
>stuff => stuff.z : (stuff: any) => any
>stuff : any
>stuff => stuff.z : (stuff: {}) => any
>stuff : {}
>stuff.z : any
>stuff : any
>stuff : {}
>z : any
`;
declare let obj: {
>obj : { prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: { lastOne: T; }; }; }
>obj : { prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }; }
prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => {
>prop : <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: { lastOne: T; }; }
>prop : <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }
>T : T
>strs : TemplateStringsArray
>TemplateStringsArray : TemplateStringsArray
@ -135,47 +129,80 @@ declare let obj: {
>T : T
>T : T
returnedObjProp: {
>returnedObjProp : { lastOne: T; }
lastOne: T
>lastOne : T
returnedObjProp: T
>returnedObjProp : T
>T : T
}
}
}
export const c = obj["prop"]<Stuff> `${(input) => { ...input }}`
>c : boolean
>obj["prop"]<Stuff> `${(input) => { ...input }}` : boolean
>obj["prop"]<Stuff : boolean
>obj["prop"] : <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: { lastOne: T; }; }
>obj : { prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: { lastOne: T; }; }; }
export let c = obj["prop"]<Stuff> `${(input) => ({ ...input })}`
>c : { returnedObjProp: {}; }
>obj["prop"]<Stuff> `${(input) => ({ ...input })}` : { returnedObjProp: {}; }
>obj["prop"] : <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }
>obj : { prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }; }
>"prop" : "prop"
>Stuff : any
>`${(input) => { ...input }}` : string
>(input) => { ...input } : (input: any) => void
>input : any
>input : any
>Stuff : Stuff
>`${(input) => ({ ...input })}` : string
>(input) => ({ ...input }) : (input: {}) => {}
>input : {}
>({ ...input }) : {}
>{ ...input } : {}
>input : {}
c.returnedProp.x;
>c.returnedProp.x : any
>c.returnedProp : any
>c : boolean
>returnedProp : any
c.returnedObjProp.x;
>c.returnedObjProp.x : any
>c.returnedObjProp : {}
>c : { returnedObjProp: {}; }
>returnedObjProp : {}
>x : any
c.returnedProp.y;
>c.returnedProp.y : any
>c.returnedProp : any
>c : boolean
>returnedProp : any
c.returnedObjProp.y;
>c.returnedObjProp.y : any
>c.returnedObjProp : {}
>c : { returnedObjProp: {}; }
>returnedObjProp : {}
>y : any
c.returnedProp.z;
>c.returnedProp.z : any
>c.returnedProp : any
>c : boolean
>returnedProp : any
c.returnedObjProp.z;
>c.returnedObjProp.z : any
>c.returnedObjProp : {}
>c : { returnedObjProp: {}; }
>returnedObjProp : {}
>z : any
c = obj.prop<Stuff> `${(input) => ({ ...input })}`
>c = obj.prop<Stuff> `${(input) => ({ ...input })}` : { returnedObjProp: {}; }
>c : { returnedObjProp: {}; }
>obj.prop<Stuff> `${(input) => ({ ...input })}` : { returnedObjProp: {}; }
>obj.prop : <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }
>obj : { prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }; }
>prop : <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }
>Stuff : Stuff
>`${(input) => ({ ...input })}` : string
>(input) => ({ ...input }) : (input: {}) => {}
>input : {}
>({ ...input }) : {}
>{ ...input } : {}
>input : {}
c.returnedObjProp.x;
>c.returnedObjProp.x : any
>c.returnedObjProp : {}
>c : { returnedObjProp: {}; }
>returnedObjProp : {}
>x : any
c.returnedObjProp.y;
>c.returnedObjProp.y : any
>c.returnedObjProp : {}
>c : { returnedObjProp: {}; }
>returnedObjProp : {}
>y : any
c.returnedObjProp.z;
>c.returnedObjProp.z : any
>c.returnedObjProp : {}
>c : { returnedObjProp: {}; }
>returnedObjProp : {}
>z : any