Fixed bug where function expressions were not getting checked in template expressions.
This commit is contained in:
parent
17c822966d
commit
e3848b98b1
|
@ -8647,6 +8647,8 @@ module ts {
|
|||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
case SyntaxKind.TemplateExpression:
|
||||
case SyntaxKind.TemplateSpan:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.TypeOfExpression:
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts(6,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts(6,31): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts (2 errors) ====
|
||||
|
||||
|
||||
function foo(...rest: any[]) {
|
||||
|
@ -10,3 +11,5 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFuncti
|
|||
foo `${function (x: number) { x = "bad"; } }`;
|
||||
~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
@ -0,0 +1,11 @@
|
|||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.ts(5,31): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.ts (1 errors) ====
|
||||
|
||||
function foo(...rest: any[]) {
|
||||
}
|
||||
|
||||
foo `${function (x: number) { x = "bad"; } }`;
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
@ -1,14 +0,0 @@
|
|||
=== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.ts ===
|
||||
|
||||
function foo(...rest: any[]) {
|
||||
>foo : (...rest: any[]) => void
|
||||
>rest : any[]
|
||||
}
|
||||
|
||||
foo `${function (x: number) { x = "bad"; } }`;
|
||||
>foo : (...rest: any[]) => void
|
||||
>function (x: number) { x = "bad"; } : (x: number) => void
|
||||
>x : number
|
||||
>x = "bad" : string
|
||||
>x : number
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts(3,27): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts (1 errors) ====
|
||||
|
||||
|
||||
`${function (x: number) { x = "bad"; } }`;
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
@ -1,9 +0,0 @@
|
|||
=== tests/cases/conformance/es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts ===
|
||||
|
||||
|
||||
`${function (x: number) { x = "bad"; } }`;
|
||||
>function (x: number) { x = "bad"; } : (x: number) => void
|
||||
>x : number
|
||||
>x = "bad" : string
|
||||
>x : number
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
tests/cases/conformance/es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.ts(2,27): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.ts (1 errors) ====
|
||||
|
||||
`${function (x: number) { x = "bad"; } }`;
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
@ -1,8 +0,0 @@
|
|||
=== tests/cases/conformance/es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.ts ===
|
||||
|
||||
`${function (x: number) { x = "bad"; } }`;
|
||||
>function (x: number) { x = "bad"; } : (x: number) => void
|
||||
>x : number
|
||||
>x = "bad" : string
|
||||
>x : number
|
||||
|
Loading…
Reference in a new issue