forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
processTaggedTemplateExpression
visit a returned node
This problem was introduced in 70399e1 (from PR microsoft#23801), which added a `visitTaggedTemplateExpression` case for `TaggedTemplateExpression`, before that, it would fallback to the default of `visitNode`. So re-add that happen in `processTaggedTemplateExpression`. Since it doesn't hurt, I left a `Debug.checkDefined(property.name)` instead of `!`-ing it. Fixes microsoft#38558.
- Loading branch information
1 parent
1a15717
commit ea1e0ab
Showing
6 changed files
with
160 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
tests/baselines/reference/taggedTemplateStringsWithCurriedFunction.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//// [taggedTemplateStringsWithCurriedFunction.ts] | ||
// Originated from #38558 | ||
|
||
const f = _ => (..._) => ""; | ||
|
||
f({ ...{ x: 0 } })``; | ||
f({ ...{ x: 0 } })`x`; | ||
f({ ...{ x: 0 } })`x${f}x`; | ||
f({ ...{ x: 0 }, y: (() => 1)() })``; | ||
f({ x: (() => 1)(), ...{ y: 1 } })``; | ||
|
||
|
||
//// [taggedTemplateStringsWithCurriedFunction.js] | ||
// Originated from #38558 | ||
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { | ||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } | ||
return cooked; | ||
}; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var f = function (_) { return function () { | ||
var _ = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
_[_i] = arguments[_i]; | ||
} | ||
return ""; | ||
}; }; | ||
f(__assign({ x: 0 }))(__makeTemplateObject([""], [""])); | ||
f(__assign({ x: 0 }))(__makeTemplateObject(["x"], ["x"])); | ||
f(__assign({ x: 0 }))(__makeTemplateObject(["x", "x"], ["x", "x"]), f); | ||
f(__assign({ x: 0 }, { y: (function () { return 1; })() }))(__makeTemplateObject([""], [""])); | ||
f(__assign({ x: (function () { return 1; })() }, { y: 1 }))(__makeTemplateObject([""], [""])); |
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/taggedTemplateStringsWithCurriedFunction.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
=== tests/cases/compiler/taggedTemplateStringsWithCurriedFunction.ts === | ||
// Originated from #38558 | ||
|
||
const f = _ => (..._) => ""; | ||
>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) | ||
>_ : Symbol(_, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 9)) | ||
>_ : Symbol(_, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 16)) | ||
|
||
f({ ...{ x: 0 } })``; | ||
>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) | ||
>x : Symbol(x, Decl(taggedTemplateStringsWithCurriedFunction.ts, 4, 8)) | ||
|
||
f({ ...{ x: 0 } })`x`; | ||
>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) | ||
>x : Symbol(x, Decl(taggedTemplateStringsWithCurriedFunction.ts, 5, 8)) | ||
|
||
f({ ...{ x: 0 } })`x${f}x`; | ||
>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) | ||
>x : Symbol(x, Decl(taggedTemplateStringsWithCurriedFunction.ts, 6, 8)) | ||
>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) | ||
|
||
f({ ...{ x: 0 }, y: (() => 1)() })``; | ||
>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) | ||
>x : Symbol(x, Decl(taggedTemplateStringsWithCurriedFunction.ts, 7, 8)) | ||
>y : Symbol(y, Decl(taggedTemplateStringsWithCurriedFunction.ts, 7, 16)) | ||
|
||
f({ x: (() => 1)(), ...{ y: 1 } })``; | ||
>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) | ||
>x : Symbol(x, Decl(taggedTemplateStringsWithCurriedFunction.ts, 8, 3)) | ||
>y : Symbol(y, Decl(taggedTemplateStringsWithCurriedFunction.ts, 8, 24)) | ||
|
72 changes: 72 additions & 0 deletions
72
tests/baselines/reference/taggedTemplateStringsWithCurriedFunction.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
=== tests/cases/compiler/taggedTemplateStringsWithCurriedFunction.ts === | ||
// Originated from #38558 | ||
|
||
const f = _ => (..._) => ""; | ||
>f : (_: any) => (..._: any[]) => string | ||
>_ => (..._) => "" : (_: any) => (..._: any[]) => string | ||
>_ : any | ||
>(..._) => "" : (..._: any[]) => string | ||
>_ : any[] | ||
>"" : "" | ||
|
||
f({ ...{ x: 0 } })``; | ||
>f({ ...{ x: 0 } })`` : string | ||
>f({ ...{ x: 0 } }) : (..._: any[]) => string | ||
>f : (_: any) => (..._: any[]) => string | ||
>{ ...{ x: 0 } } : { x: number; } | ||
>{ x: 0 } : { x: number; } | ||
>x : number | ||
>0 : 0 | ||
>`` : "" | ||
|
||
f({ ...{ x: 0 } })`x`; | ||
>f({ ...{ x: 0 } })`x` : string | ||
>f({ ...{ x: 0 } }) : (..._: any[]) => string | ||
>f : (_: any) => (..._: any[]) => string | ||
>{ ...{ x: 0 } } : { x: number; } | ||
>{ x: 0 } : { x: number; } | ||
>x : number | ||
>0 : 0 | ||
>`x` : "x" | ||
|
||
f({ ...{ x: 0 } })`x${f}x`; | ||
>f({ ...{ x: 0 } })`x${f}x` : string | ||
>f({ ...{ x: 0 } }) : (..._: any[]) => string | ||
>f : (_: any) => (..._: any[]) => string | ||
>{ ...{ x: 0 } } : { x: number; } | ||
>{ x: 0 } : { x: number; } | ||
>x : number | ||
>0 : 0 | ||
>`x${f}x` : string | ||
>f : (_: any) => (..._: any[]) => string | ||
|
||
f({ ...{ x: 0 }, y: (() => 1)() })``; | ||
>f({ ...{ x: 0 }, y: (() => 1)() })`` : string | ||
>f({ ...{ x: 0 }, y: (() => 1)() }) : (..._: any[]) => string | ||
>f : (_: any) => (..._: any[]) => string | ||
>{ ...{ x: 0 }, y: (() => 1)() } : { y: number; x: number; } | ||
>{ x: 0 } : { x: number; } | ||
>x : number | ||
>0 : 0 | ||
>y : number | ||
>(() => 1)() : number | ||
>(() => 1) : () => number | ||
>() => 1 : () => number | ||
>1 : 1 | ||
>`` : "" | ||
|
||
f({ x: (() => 1)(), ...{ y: 1 } })``; | ||
>f({ x: (() => 1)(), ...{ y: 1 } })`` : string | ||
>f({ x: (() => 1)(), ...{ y: 1 } }) : (..._: any[]) => string | ||
>f : (_: any) => (..._: any[]) => string | ||
>{ x: (() => 1)(), ...{ y: 1 } } : { y: number; x: number; } | ||
>x : number | ||
>(() => 1)() : number | ||
>(() => 1) : () => number | ||
>() => 1 : () => number | ||
>1 : 1 | ||
>{ y: 1 } : { y: number; } | ||
>y : number | ||
>1 : 1 | ||
>`` : "" | ||
|
11 changes: 11 additions & 0 deletions
11
tests/cases/compiler/taggedTemplateStringsWithCurriedFunction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//@target: es3 | ||
|
||
// Originated from #38558 | ||
|
||
const f = _ => (..._) => ""; | ||
|
||
f({ ...{ x: 0 } })``; | ||
f({ ...{ x: 0 } })`x`; | ||
f({ ...{ x: 0 } })`x${f}x`; | ||
f({ ...{ x: 0 }, y: (() => 1)() })``; | ||
f({ x: (() => 1)(), ...{ y: 1 } })``; |