mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-12 11:50:54 -06:00
Add a regression test related to narrowing in plain JS files (#59611)
This commit is contained in:
parent
01a874a8ba
commit
562b815ba3
21
tests/baselines/reference/narrowingPlainJsNoCrash1.js
Normal file
21
tests/baselines/reference/narrowingPlainJsNoCrash1.js
Normal file
@ -0,0 +1,21 @@
|
||||
//// [tests/cases/compiler/narrowingPlainJsNoCrash1.ts] ////
|
||||
|
||||
//// [index.js]
|
||||
// https://github.com/microsoft/TypeScript/issues/59594
|
||||
|
||||
var a$b = {};
|
||||
var c, d;
|
||||
d = a$b;
|
||||
while (d !== a$b);
|
||||
while ((c = a$b != a$b)) c.e;
|
||||
|
||||
|
||||
//// [index.js]
|
||||
// https://github.com/microsoft/TypeScript/issues/59594
|
||||
var a$b = {};
|
||||
var c, d;
|
||||
d = a$b;
|
||||
while (d !== a$b)
|
||||
;
|
||||
while ((c = a$b != a$b))
|
||||
c.e;
|
||||
26
tests/baselines/reference/narrowingPlainJsNoCrash1.symbols
Normal file
26
tests/baselines/reference/narrowingPlainJsNoCrash1.symbols
Normal file
@ -0,0 +1,26 @@
|
||||
//// [tests/cases/compiler/narrowingPlainJsNoCrash1.ts] ////
|
||||
|
||||
=== index.js ===
|
||||
// https://github.com/microsoft/TypeScript/issues/59594
|
||||
|
||||
var a$b = {};
|
||||
>a$b : Symbol(a$b, Decl(index.js, 2, 3))
|
||||
|
||||
var c, d;
|
||||
>c : Symbol(c, Decl(index.js, 3, 3))
|
||||
>d : Symbol(d, Decl(index.js, 3, 6))
|
||||
|
||||
d = a$b;
|
||||
>d : Symbol(d, Decl(index.js, 3, 6))
|
||||
>a$b : Symbol(a$b, Decl(index.js, 2, 3))
|
||||
|
||||
while (d !== a$b);
|
||||
>d : Symbol(d, Decl(index.js, 3, 6))
|
||||
>a$b : Symbol(a$b, Decl(index.js, 2, 3))
|
||||
|
||||
while ((c = a$b != a$b)) c.e;
|
||||
>c : Symbol(c, Decl(index.js, 3, 3))
|
||||
>a$b : Symbol(a$b, Decl(index.js, 2, 3))
|
||||
>a$b : Symbol(a$b, Decl(index.js, 2, 3))
|
||||
>c : Symbol(c, Decl(index.js, 3, 3))
|
||||
|
||||
48
tests/baselines/reference/narrowingPlainJsNoCrash1.types
Normal file
48
tests/baselines/reference/narrowingPlainJsNoCrash1.types
Normal file
@ -0,0 +1,48 @@
|
||||
//// [tests/cases/compiler/narrowingPlainJsNoCrash1.ts] ////
|
||||
|
||||
=== index.js ===
|
||||
// https://github.com/microsoft/TypeScript/issues/59594
|
||||
|
||||
var a$b = {};
|
||||
>a$b : {}
|
||||
> : ^^
|
||||
>{} : {}
|
||||
> : ^^
|
||||
|
||||
var c, d;
|
||||
>c : any
|
||||
>d : any
|
||||
|
||||
d = a$b;
|
||||
>d = a$b : {}
|
||||
> : ^^
|
||||
>d : any
|
||||
>a$b : {}
|
||||
> : ^^
|
||||
|
||||
while (d !== a$b);
|
||||
>d !== a$b : boolean
|
||||
> : ^^^^^^^
|
||||
>d : {}
|
||||
> : ^^
|
||||
>a$b : {}
|
||||
> : ^^
|
||||
|
||||
while ((c = a$b != a$b)) c.e;
|
||||
>(c = a$b != a$b) : boolean
|
||||
> : ^^^^^^^
|
||||
>c = a$b != a$b : boolean
|
||||
> : ^^^^^^^
|
||||
>c : any
|
||||
>a$b != a$b : boolean
|
||||
> : ^^^^^^^
|
||||
>a$b : {}
|
||||
> : ^^
|
||||
>a$b : {}
|
||||
> : ^^
|
||||
>c.e : error
|
||||
>c : true
|
||||
> : ^^^^
|
||||
>e : any
|
||||
> : ^^^
|
||||
|
||||
13
tests/cases/compiler/narrowingPlainJsNoCrash1.ts
Normal file
13
tests/cases/compiler/narrowingPlainJsNoCrash1.ts
Normal file
@ -0,0 +1,13 @@
|
||||
// @allowJs: true
|
||||
// @checkJs: false
|
||||
// @outDir: true
|
||||
|
||||
// @filename: index.js
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/59594
|
||||
|
||||
var a$b = {};
|
||||
var c, d;
|
||||
d = a$b;
|
||||
while (d !== a$b);
|
||||
while ((c = a$b != a$b)) c.e;
|
||||
Loading…
x
Reference in New Issue
Block a user