Repository navigation
Fix declaration emit crash on inaccessible heritage types #64952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Cheng (chengchuu)
wants to merge
3
commits into
microsoft:main
Choose a base branch
from
chengchuu:fix/declaration-emit-heritage-crash
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+249
−2
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
63 changes: 63 additions & 0 deletions
63
tsc/testdata/baselines/reference/compiler/declarationEmitInaccessibleHeritageType.errors.txt
This file contains hidden or 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,63 @@ | ||
| anonymousClassDeclaration.ts(1,1): error TS1344: A label is not allowed here. | ||
| anonymousClassDeclaration.ts(2,33): error TS4082: Default export of the module has or is using private name 'I'. | ||
| anonymousClassExpression.ts(1,1): error TS1344: A label is not allowed here. | ||
| anonymousClassExpression.ts(2,34): error TS4082: Default export of the module has or is using private name 'I'. | ||
| implements.ts(1,1): error TS1344: A label is not allowed here. | ||
| implements.ts(2,27): error TS4019: Implements clause of exported class 'C' has or is using private name 'I'. | ||
| interface.ts(1,1): error TS1344: A label is not allowed here. | ||
| interface.ts(2,28): error TS4022: 'extends' clause of exported interface 'J' has or is using private name 'I'. | ||
| namedClassExpression.ts(1,1): error TS1344: A label is not allowed here. | ||
| namedClassExpression.ts(2,36): error TS4082: Default export of the module has or is using private name 'I'. | ||
| typeArgument.ts(1,1): error TS1344: A label is not allowed here. | ||
| typeArgument.ts(3,33): error TS4022: 'extends' clause of exported interface 'J' has or is using private name 'I'. | ||
|
|
||
|
|
||
| ==== interface.ts (2 errors) ==== | ||
| label: interface I {} | ||
| ~~~~~ | ||
| !!! error TS1344: A label is not allowed here. | ||
| export interface J extends I {} | ||
| ~ | ||
| !!! error TS4022: 'extends' clause of exported interface 'J' has or is using private name 'I'. | ||
|
|
||
| ==== implements.ts (2 errors) ==== | ||
| label: interface I {} | ||
| ~~~~~ | ||
| !!! error TS1344: A label is not allowed here. | ||
| export class C implements I {} | ||
| ~ | ||
| !!! error TS4019: Implements clause of exported class 'C' has or is using private name 'I'. | ||
|
|
||
| ==== typeArgument.ts (2 errors) ==== | ||
| label: interface I {} | ||
| ~~~~~ | ||
| !!! error TS1344: A label is not allowed here. | ||
| interface Base<T> {} | ||
| export interface J extends Base<I> {} | ||
| ~ | ||
| !!! error TS4022: 'extends' clause of exported interface 'J' has or is using private name 'I'. | ||
|
|
||
| ==== namedClassExpression.ts (2 errors) ==== | ||
| label: interface I {} | ||
| ~~~~~ | ||
| !!! error TS1344: A label is not allowed here. | ||
| export default (class C implements I {}); | ||
| ~ | ||
| !!! error TS4082: Default export of the module has or is using private name 'I'. | ||
|
|
||
| ==== anonymousClassExpression.ts (2 errors) ==== | ||
| label: interface I {} | ||
| ~~~~~ | ||
| !!! error TS1344: A label is not allowed here. | ||
| export default (class implements I {}); | ||
| ~ | ||
| !!! error TS4082: Default export of the module has or is using private name 'I'. | ||
|
|
||
| ==== anonymousClassDeclaration.ts (2 errors) ==== | ||
| label: interface I {} | ||
| ~~~~~ | ||
| !!! error TS1344: A label is not allowed here. | ||
| export default class implements I {} | ||
| ~ | ||
| !!! error TS4082: Default export of the module has or is using private name 'I'. | ||
|
|
50 changes: 50 additions & 0 deletions
50
tsc/testdata/baselines/reference/compiler/declarationEmitInaccessibleHeritageType.js
This file contains hidden or 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,50 @@ | ||
| //// [tests/cases/compiler/declarationEmitInaccessibleHeritageType.ts] //// | ||
|
|
||
| //// [interface.ts] | ||
| label: interface I {} | ||
| export interface J extends I {} | ||
|
|
||
| //// [implements.ts] | ||
| label: interface I {} | ||
| export class C implements I {} | ||
|
|
||
| //// [typeArgument.ts] | ||
| label: interface I {} | ||
| interface Base<T> {} | ||
| export interface J extends Base<I> {} | ||
|
|
||
| //// [namedClassExpression.ts] | ||
| label: interface I {} | ||
| export default (class C implements I {}); | ||
|
|
||
| //// [anonymousClassExpression.ts] | ||
| label: interface I {} | ||
| export default (class implements I {}); | ||
|
|
||
| //// [anonymousClassDeclaration.ts] | ||
| label: interface I {} | ||
| export default class implements I {} | ||
|
|
||
|
|
||
| //// [interface.js] | ||
| label: ; | ||
| export {}; | ||
| //// [implements.js] | ||
| label: ; | ||
| export class C { | ||
| } | ||
| //// [typeArgument.js] | ||
| label: ; | ||
| export {}; | ||
| //// [namedClassExpression.js] | ||
| label: ; | ||
| export default (class C { | ||
| }); | ||
| //// [anonymousClassExpression.js] | ||
| label: ; | ||
| export default (class { | ||
| }); | ||
| //// [anonymousClassDeclaration.js] | ||
| label: ; | ||
| export default class { | ||
| } |
53 changes: 53 additions & 0 deletions
53
tsc/testdata/baselines/reference/compiler/declarationEmitInaccessibleHeritageType.symbols
This file contains hidden or 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,53 @@ | ||
| //// [tests/cases/compiler/declarationEmitInaccessibleHeritageType.ts] //// | ||
|
|
||
| === interface.ts === | ||
| label: interface I {} | ||
| >I : Symbol(I, Decl(interface.ts, 0, 6)) | ||
|
|
||
| export interface J extends I {} | ||
| >J : Symbol(J, Decl(interface.ts, 0, 21)) | ||
| >I : Symbol(I, Decl(interface.ts, 0, 6)) | ||
|
|
||
| === implements.ts === | ||
| label: interface I {} | ||
| >I : Symbol(I, Decl(implements.ts, 0, 6)) | ||
|
|
||
| export class C implements I {} | ||
| >C : Symbol(C, Decl(implements.ts, 0, 21)) | ||
| >I : Symbol(I, Decl(implements.ts, 0, 6)) | ||
|
|
||
| === typeArgument.ts === | ||
| label: interface I {} | ||
| >I : Symbol(I, Decl(typeArgument.ts, 0, 6)) | ||
|
|
||
| interface Base<T> {} | ||
| >Base : Symbol(Base, Decl(typeArgument.ts, 0, 21)) | ||
| >T : Symbol(T, Decl(typeArgument.ts, 1, 15)) | ||
|
|
||
| export interface J extends Base<I> {} | ||
| >J : Symbol(J, Decl(typeArgument.ts, 1, 20)) | ||
| >Base : Symbol(Base, Decl(typeArgument.ts, 0, 21)) | ||
| >I : Symbol(I, Decl(typeArgument.ts, 0, 6)) | ||
|
|
||
| === namedClassExpression.ts === | ||
| label: interface I {} | ||
| >I : Symbol(I, Decl(namedClassExpression.ts, 0, 6)) | ||
|
|
||
| export default (class C implements I {}); | ||
| >C : Symbol(C, Decl(namedClassExpression.ts, 1, 16)) | ||
| >I : Symbol(I, Decl(namedClassExpression.ts, 0, 6)) | ||
|
|
||
| === anonymousClassExpression.ts === | ||
| label: interface I {} | ||
| >I : Symbol(I, Decl(anonymousClassExpression.ts, 0, 6)) | ||
|
|
||
| export default (class implements I {}); | ||
| >I : Symbol(I, Decl(anonymousClassExpression.ts, 0, 6)) | ||
|
|
||
| === anonymousClassDeclaration.ts === | ||
| label: interface I {} | ||
| >I : Symbol(I, Decl(anonymousClassDeclaration.ts, 0, 6)) | ||
|
|
||
| export default class implements I {} | ||
| >I : Symbol(I, Decl(anonymousClassDeclaration.ts, 0, 6)) | ||
|
|
45 changes: 45 additions & 0 deletions
45
tsc/testdata/baselines/reference/compiler/declarationEmitInaccessibleHeritageType.types
This file contains hidden or 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,45 @@ | ||
| //// [tests/cases/compiler/declarationEmitInaccessibleHeritageType.ts] //// | ||
|
|
||
| === interface.ts === | ||
| label: interface I {} | ||
| >label : any | ||
|
|
||
| export interface J extends I {} | ||
|
|
||
| === implements.ts === | ||
| label: interface I {} | ||
| >label : any | ||
|
|
||
| export class C implements I {} | ||
| >C : C | ||
|
|
||
| === typeArgument.ts === | ||
| label: interface I {} | ||
| >label : any | ||
|
|
||
| interface Base<T> {} | ||
| export interface J extends Base<I> {} | ||
|
|
||
| === namedClassExpression.ts === | ||
| label: interface I {} | ||
| >label : any | ||
|
|
||
| export default (class C implements I {}); | ||
| >(class C implements I {}) : typeof C | ||
| >class C implements I {} : typeof C | ||
| >C : typeof C | ||
|
|
||
| === anonymousClassExpression.ts === | ||
| label: interface I {} | ||
| >label : any | ||
|
|
||
| export default (class implements I {}); | ||
| >(class implements I {}) : typeof (Anonymous class) | ||
| >class implements I {} : typeof (Anonymous class) | ||
|
|
||
| === anonymousClassDeclaration.ts === | ||
| label: interface I {} | ||
| >label : any | ||
|
|
||
| export default class implements I {} | ||
|
|
26 changes: 26 additions & 0 deletions
26
tsc/testdata/tests/cases/compiler/declarationEmitInaccessibleHeritageType.ts
This file contains hidden or 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,26 @@ | ||
| // @declaration: true | ||
|
|
||
| // @filename: interface.ts | ||
| label: interface I {} | ||
| export interface J extends I {} | ||
|
|
||
| // @filename: implements.ts | ||
| label: interface I {} | ||
| export class C implements I {} | ||
|
|
||
| // @filename: typeArgument.ts | ||
| label: interface I {} | ||
| interface Base<T> {} | ||
| export interface J extends Base<I> {} | ||
|
|
||
| // @filename: namedClassExpression.ts | ||
| label: interface I {} | ||
| export default (class C implements I {}); | ||
|
|
||
| // @filename: anonymousClassExpression.ts | ||
| label: interface I {} | ||
| export default (class implements I {}); | ||
|
|
||
| // @filename: anonymousClassDeclaration.ts | ||
| label: interface I {} | ||
| export default class implements I {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.