-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix elided var handling in declaration emit visibility checks (#58605)
Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
- Loading branch information
1 parent
11b73ec
commit 6f72e24
Showing
7 changed files
with
56 additions
and
7 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
5 changes: 4 additions & 1 deletion
5
tests/baselines/reference/declarationEmitInvalidExport.errors.txt
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
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/declarationEmitVarInElidedBlock.errors.txt
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,10 @@ | ||
declarationEmitVarInElidedBlock.ts(4,22): error TS4025: Exported variable 'b' has or is using private name 'a'. | ||
|
||
|
||
==== declarationEmitVarInElidedBlock.ts (1 errors) ==== | ||
{ | ||
var a = ""; | ||
} | ||
export let b: typeof a; | ||
~ | ||
!!! error TS4025: Exported variable 'b' has or is using private name 'a'. |
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/declarationEmitVarInElidedBlock.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,11 @@ | ||
//// [tests/cases/compiler/declarationEmitVarInElidedBlock.ts] //// | ||
|
||
=== declarationEmitVarInElidedBlock.ts === | ||
{ | ||
var a = ""; | ||
>a : Symbol(a, Decl(declarationEmitVarInElidedBlock.ts, 1, 7)) | ||
} | ||
export let b: typeof a; | ||
>b : Symbol(b, Decl(declarationEmitVarInElidedBlock.ts, 3, 10)) | ||
>a : Symbol(a, Decl(declarationEmitVarInElidedBlock.ts, 1, 7)) | ||
|
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/declarationEmitVarInElidedBlock.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,16 @@ | ||
//// [tests/cases/compiler/declarationEmitVarInElidedBlock.ts] //// | ||
|
||
=== declarationEmitVarInElidedBlock.ts === | ||
{ | ||
var a = ""; | ||
>a : string | ||
> : ^^^^^^ | ||
>"" : "" | ||
> : ^^ | ||
} | ||
export let b: typeof a; | ||
>b : string | ||
> : ^^^^^^ | ||
>a : string | ||
> : ^^^^^^ | ||
|
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,6 @@ | ||
// @declaration: true | ||
// @emitDeclarationOnly: true | ||
{ | ||
var a = ""; | ||
} | ||
export let b: typeof a; |