-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Reuse cached resolved signatures early #60208
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
mixinWithBaseDependingOnSelfNoCrash1.ts(11,48): error TS2345: Argument of type 'typeof BaseItem' is not assignable to parameter of type 'new (...args: any[]) => any'. | ||
Type 'typeof BaseItem' provides no match for the signature 'new (...args: any[]): any'. | ||
|
||
|
||
==== mixinWithBaseDependingOnSelfNoCrash1.ts (1 errors) ==== | ||
// https://github.com/microsoft/TypeScript/issues/60202 | ||
|
||
declare class Document<Parent> {} | ||
|
||
declare class BaseItem extends Document<typeof Item> {} | ||
|
||
declare function ClientDocumentMixin< | ||
BaseClass extends new (...args: any[]) => any, | ||
>(Base: BaseClass): any; | ||
|
||
declare class Item extends ClientDocumentMixin(BaseItem) {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. due to the circular nature of this example, the compiler goes into
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks a ton for this PR and the explanation! It makes the crash make much more sense to me now. I will say some of these steps still seem to have a bit of concerning logic and seem to help explain something else weird I noted on my issue, namely that there doesn't have to be a "real" loop in the base type for you to get an error like Playground (make sure to make any edit to overcome the crash and view an error!) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tbh your example is somewhat convoluted to the point that I'm not sure if it should error or not. It's definitely outside of the "regular TS" territory 😅 so all I was after here was to fix the crash. Once this gets fixed you might want to raise a new issue about the circularity issue if you thing it shouldn't be reported |
||
~~~~~~~~ | ||
!!! error TS2345: Argument of type 'typeof BaseItem' is not assignable to parameter of type 'new (...args: any[]) => any'. | ||
!!! error TS2345: Type 'typeof BaseItem' provides no match for the signature 'new (...args: any[]): any'. | ||
|
||
export {}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//// [tests/cases/conformance/classes/mixinWithBaseDependingOnSelfNoCrash1.ts] //// | ||
|
||
=== mixinWithBaseDependingOnSelfNoCrash1.ts === | ||
// https://github.com/microsoft/TypeScript/issues/60202 | ||
|
||
declare class Document<Parent> {} | ||
>Document : Symbol(Document, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 0, 0)) | ||
>Parent : Symbol(Parent, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 2, 23)) | ||
|
||
declare class BaseItem extends Document<typeof Item> {} | ||
>BaseItem : Symbol(BaseItem, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 2, 33)) | ||
>Document : Symbol(Document, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 0, 0)) | ||
>Item : Symbol(Item, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 8, 24)) | ||
|
||
declare function ClientDocumentMixin< | ||
>ClientDocumentMixin : Symbol(ClientDocumentMixin, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 4, 55)) | ||
|
||
BaseClass extends new (...args: any[]) => any, | ||
>BaseClass : Symbol(BaseClass, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 6, 37)) | ||
>args : Symbol(args, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 7, 25)) | ||
|
||
>(Base: BaseClass): any; | ||
>Base : Symbol(Base, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 8, 2)) | ||
>BaseClass : Symbol(BaseClass, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 6, 37)) | ||
|
||
declare class Item extends ClientDocumentMixin(BaseItem) {} | ||
>Item : Symbol(Item, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 8, 24)) | ||
>ClientDocumentMixin : Symbol(ClientDocumentMixin, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 4, 55)) | ||
>BaseItem : Symbol(BaseItem, Decl(mixinWithBaseDependingOnSelfNoCrash1.ts, 2, 33)) | ||
|
||
export {}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//// [tests/cases/conformance/classes/mixinWithBaseDependingOnSelfNoCrash1.ts] //// | ||
|
||
=== mixinWithBaseDependingOnSelfNoCrash1.ts === | ||
// https://github.com/microsoft/TypeScript/issues/60202 | ||
|
||
declare class Document<Parent> {} | ||
>Document : Document<Parent> | ||
> : ^^^^^^^^^^^^^^^^ | ||
|
||
declare class BaseItem extends Document<typeof Item> {} | ||
>BaseItem : BaseItem | ||
> : ^^^^^^^^ | ||
>Document : Document<typeof Item> | ||
> : ^^^^^^^^^^^^^^^^^^^^^ | ||
>Item : typeof Item | ||
> : ^^^^^^^^^^^ | ||
|
||
declare function ClientDocumentMixin< | ||
>ClientDocumentMixin : <BaseClass extends new (...args: any[]) => any>(Base: BaseClass) => any | ||
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^ | ||
|
||
BaseClass extends new (...args: any[]) => any, | ||
>args : any[] | ||
> : ^^^^^ | ||
|
||
>(Base: BaseClass): any; | ||
>Base : BaseClass | ||
> : ^^^^^^^^^ | ||
|
||
declare class Item extends ClientDocumentMixin(BaseItem) {} | ||
>Item : Item | ||
> : ^^^^ | ||
>ClientDocumentMixin(BaseItem) : any | ||
> : ^^^ | ||
>ClientDocumentMixin : <BaseClass extends new (...args: any[]) => any>(Base: BaseClass) => any | ||
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^ | ||
>BaseItem : typeof BaseItem | ||
> : ^^^^^^^^^^^^^^^ | ||
|
||
export {}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// @strict: true | ||
// @noEmit: true | ||
|
||
// https://github.com/microsoft/TypeScript/issues/60202 | ||
|
||
declare class Document<Parent> {} | ||
|
||
declare class BaseItem extends Document<typeof Item> {} | ||
|
||
declare function ClientDocumentMixin< | ||
BaseClass extends new (...args: any[]) => any, | ||
>(Base: BaseClass): any; | ||
|
||
declare class Item extends ClientDocumentMixin(BaseItem) {} | ||
|
||
export {}; |
Uh oh!
There was an error while loading. Please reload this page.