-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more test cases for some other related issues this fixes
- Loading branch information
Showing
12 changed files
with
227 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
tests/baselines/reference/indirectGlobalSymbolPartOfObjectType.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,9 @@ | ||
//// [indirectGlobalSymbolPartOfObjectType.ts] | ||
export { } | ||
const Symbol = globalThis.Symbol; | ||
[][Symbol.iterator]; | ||
|
||
//// [indirectGlobalSymbolPartOfObjectType.js] | ||
const Symbol = globalThis.Symbol; | ||
[][Symbol.iterator]; | ||
export {}; |
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/indirectGlobalSymbolPartOfObjectType.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,13 @@ | ||
=== tests/cases/compiler/indirectGlobalSymbolPartOfObjectType.ts === | ||
export { } | ||
const Symbol = globalThis.Symbol; | ||
>Symbol : Symbol(Symbol, Decl(indirectGlobalSymbolPartOfObjectType.ts, 1, 5)) | ||
>globalThis.Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
>globalThis : Symbol(globalThis) | ||
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
|
||
[][Symbol.iterator]; | ||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) | ||
>Symbol : Symbol(Symbol, Decl(indirectGlobalSymbolPartOfObjectType.ts, 1, 5)) | ||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) | ||
|
15 changes: 15 additions & 0 deletions
15
tests/baselines/reference/indirectGlobalSymbolPartOfObjectType.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,15 @@ | ||
=== tests/cases/compiler/indirectGlobalSymbolPartOfObjectType.ts === | ||
export { } | ||
const Symbol = globalThis.Symbol; | ||
>Symbol : SymbolConstructor | ||
>globalThis.Symbol : SymbolConstructor | ||
>globalThis : typeof globalThis | ||
>Symbol : SymbolConstructor | ||
|
||
[][Symbol.iterator]; | ||
>[][Symbol.iterator] : () => IterableIterator<undefined> | ||
>[] : undefined[] | ||
>Symbol.iterator : unique symbol | ||
>Symbol : SymbolConstructor | ||
>iterator : unique symbol | ||
|
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/keyofObjectWithGlobalSymbolIncluded.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,13 @@ | ||
//// [keyofObjectWithGlobalSymbolIncluded.ts] | ||
const obj = { | ||
[Symbol.species]: Array | ||
}; | ||
|
||
type Q = keyof typeof obj; | ||
|
||
|
||
//// [keyofObjectWithGlobalSymbolIncluded.js] | ||
"use strict"; | ||
const obj = { | ||
[Symbol.species]: Array | ||
}; |
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/keyofObjectWithGlobalSymbolIncluded.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,17 @@ | ||
=== tests/cases/compiler/keyofObjectWithGlobalSymbolIncluded.ts === | ||
const obj = { | ||
>obj : Symbol(obj, Decl(keyofObjectWithGlobalSymbolIncluded.ts, 0, 5)) | ||
|
||
[Symbol.species]: Array | ||
>[Symbol.species] : Symbol([Symbol.species], Decl(keyofObjectWithGlobalSymbolIncluded.ts, 0, 13)) | ||
>Symbol.species : Symbol(SymbolConstructor.species, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
>species : Symbol(SymbolConstructor.species, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
|
||
}; | ||
|
||
type Q = keyof typeof obj; | ||
>Q : Symbol(Q, Decl(keyofObjectWithGlobalSymbolIncluded.ts, 2, 2)) | ||
>obj : Symbol(obj, Decl(keyofObjectWithGlobalSymbolIncluded.ts, 0, 5)) | ||
|
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/keyofObjectWithGlobalSymbolIncluded.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,18 @@ | ||
=== tests/cases/compiler/keyofObjectWithGlobalSymbolIncluded.ts === | ||
const obj = { | ||
>obj : { [Symbol.species]: ArrayConstructor; } | ||
>{ [Symbol.species]: Array} : { [Symbol.species]: ArrayConstructor; } | ||
|
||
[Symbol.species]: Array | ||
>[Symbol.species] : ArrayConstructor | ||
>Symbol.species : unique symbol | ||
>Symbol : SymbolConstructor | ||
>species : unique symbol | ||
>Array : ArrayConstructor | ||
|
||
}; | ||
|
||
type Q = keyof typeof obj; | ||
>Q : unique symbol | ||
>obj : { [Symbol.species]: ArrayConstructor; } | ||
|
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/readonlyFloat32ArrayAssignableWithFloat32Array.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,27 @@ | ||
//// [readonlyFloat32ArrayAssignableWithFloat32Array.ts] | ||
function update(b: Readonly<Float32Array>) { | ||
const c = copy(b); | ||
add(c, c); | ||
} | ||
|
||
function add(a: Float32Array, b: Float32Array, c: Float32Array = a) { | ||
c[0] = a[0] + b[0]; | ||
} | ||
|
||
function copy(a: Float32Array) { | ||
return new Float32Array(a); | ||
} | ||
|
||
//// [readonlyFloat32ArrayAssignableWithFloat32Array.js] | ||
"use strict"; | ||
function update(b) { | ||
var c = copy(b); | ||
add(c, c); | ||
} | ||
function add(a, b, c) { | ||
if (c === void 0) { c = a; } | ||
c[0] = a[0] + b[0]; | ||
} | ||
function copy(a) { | ||
return new Float32Array(a); | ||
} |
43 changes: 43 additions & 0 deletions
43
tests/baselines/reference/readonlyFloat32ArrayAssignableWithFloat32Array.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,43 @@ | ||
=== tests/cases/compiler/readonlyFloat32ArrayAssignableWithFloat32Array.ts === | ||
function update(b: Readonly<Float32Array>) { | ||
>update : Symbol(update, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 0, 0)) | ||
>b : Symbol(b, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 0, 16)) | ||
>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --)) | ||
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
|
||
const c = copy(b); | ||
>c : Symbol(c, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 1, 9)) | ||
>copy : Symbol(copy, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 7, 1)) | ||
>b : Symbol(b, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 0, 16)) | ||
|
||
add(c, c); | ||
>add : Symbol(add, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 3, 1)) | ||
>c : Symbol(c, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 1, 9)) | ||
>c : Symbol(c, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 1, 9)) | ||
} | ||
|
||
function add(a: Float32Array, b: Float32Array, c: Float32Array = a) { | ||
>add : Symbol(add, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 3, 1)) | ||
>a : Symbol(a, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 5, 13)) | ||
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
>b : Symbol(b, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 5, 29)) | ||
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
>c : Symbol(c, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 5, 46)) | ||
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
>a : Symbol(a, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 5, 13)) | ||
|
||
c[0] = a[0] + b[0]; | ||
>c : Symbol(c, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 5, 46)) | ||
>a : Symbol(a, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 5, 13)) | ||
>b : Symbol(b, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 5, 29)) | ||
} | ||
|
||
function copy(a: Float32Array) { | ||
>copy : Symbol(copy, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 7, 1)) | ||
>a : Symbol(a, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 9, 14)) | ||
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
|
||
return new Float32Array(a); | ||
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
>a : Symbol(a, Decl(readonlyFloat32ArrayAssignableWithFloat32Array.ts, 9, 14)) | ||
} |
48 changes: 48 additions & 0 deletions
48
tests/baselines/reference/readonlyFloat32ArrayAssignableWithFloat32Array.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,48 @@ | ||
=== tests/cases/compiler/readonlyFloat32ArrayAssignableWithFloat32Array.ts === | ||
function update(b: Readonly<Float32Array>) { | ||
>update : (b: Readonly<Float32Array>) => void | ||
>b : Readonly<Float32Array> | ||
|
||
const c = copy(b); | ||
>c : Float32Array | ||
>copy(b) : Float32Array | ||
>copy : (a: Float32Array) => Float32Array | ||
>b : Readonly<Float32Array> | ||
|
||
add(c, c); | ||
>add(c, c) : void | ||
>add : (a: Float32Array, b: Float32Array, c?: Float32Array) => void | ||
>c : Float32Array | ||
>c : Float32Array | ||
} | ||
|
||
function add(a: Float32Array, b: Float32Array, c: Float32Array = a) { | ||
>add : (a: Float32Array, b: Float32Array, c?: Float32Array) => void | ||
>a : Float32Array | ||
>b : Float32Array | ||
>c : Float32Array | ||
>a : Float32Array | ||
|
||
c[0] = a[0] + b[0]; | ||
>c[0] = a[0] + b[0] : number | ||
>c[0] : number | ||
>c : Float32Array | ||
>0 : 0 | ||
>a[0] + b[0] : number | ||
>a[0] : number | ||
>a : Float32Array | ||
>0 : 0 | ||
>b[0] : number | ||
>b : Float32Array | ||
>0 : 0 | ||
} | ||
|
||
function copy(a: Float32Array) { | ||
>copy : (a: Float32Array) => Float32Array | ||
>a : Float32Array | ||
|
||
return new Float32Array(a); | ||
>new Float32Array(a) : Float32Array | ||
>Float32Array : Float32ArrayConstructor | ||
>a : Float32Array | ||
} |
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,4 @@ | ||
// @target: es6 | ||
export { } | ||
const Symbol = globalThis.Symbol; | ||
[][Symbol.iterator]; |
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,7 @@ | ||
// @target: es6 | ||
// @strict: true | ||
const obj = { | ||
[Symbol.species]: Array | ||
}; | ||
|
||
type Q = keyof typeof obj; |
13 changes: 13 additions & 0 deletions
13
tests/cases/compiler/readonlyFloat32ArrayAssignableWithFloat32Array.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,13 @@ | ||
// @strict: true | ||
function update(b: Readonly<Float32Array>) { | ||
const c = copy(b); | ||
add(c, c); | ||
} | ||
|
||
function add(a: Float32Array, b: Float32Array, c: Float32Array = a) { | ||
c[0] = a[0] + b[0]; | ||
} | ||
|
||
function copy(a: Float32Array) { | ||
return new Float32Array(a); | ||
} |