-
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.
Fix stack overflow when resolving default construct signatures (#17878)
* Fix stack overflow when resolving default construct signatures * No need for || emptyArray
- Loading branch information
Showing
5 changed files
with
126 additions
and
6 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
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,42 @@ | ||
//// [cloduleGenericOnSelfMember.ts] | ||
class ServiceBase<T> { | ||
field: T; | ||
} | ||
class Service extends ServiceBase<typeof Service.Base> { | ||
} | ||
namespace Service { | ||
export const Base = { | ||
name: "1", | ||
value: 5 | ||
}; | ||
} | ||
|
||
//// [cloduleGenericOnSelfMember.js] | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var ServiceBase = /** @class */ (function () { | ||
function ServiceBase() { | ||
} | ||
return ServiceBase; | ||
}()); | ||
var Service = /** @class */ (function (_super) { | ||
__extends(Service, _super); | ||
function Service() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return Service; | ||
}(ServiceBase)); | ||
(function (Service) { | ||
Service.Base = { | ||
name: "1", | ||
value: 5 | ||
}; | ||
})(Service || (Service = {})); |
30 changes: 30 additions & 0 deletions
30
tests/baselines/reference/cloduleGenericOnSelfMember.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,30 @@ | ||
=== tests/cases/compiler/cloduleGenericOnSelfMember.ts === | ||
class ServiceBase<T> { | ||
>ServiceBase : Symbol(ServiceBase, Decl(cloduleGenericOnSelfMember.ts, 0, 0)) | ||
>T : Symbol(T, Decl(cloduleGenericOnSelfMember.ts, 0, 18)) | ||
|
||
field: T; | ||
>field : Symbol(ServiceBase.field, Decl(cloduleGenericOnSelfMember.ts, 0, 22)) | ||
>T : Symbol(T, Decl(cloduleGenericOnSelfMember.ts, 0, 18)) | ||
} | ||
class Service extends ServiceBase<typeof Service.Base> { | ||
>Service : Symbol(Service, Decl(cloduleGenericOnSelfMember.ts, 2, 1), Decl(cloduleGenericOnSelfMember.ts, 4, 1)) | ||
>ServiceBase : Symbol(ServiceBase, Decl(cloduleGenericOnSelfMember.ts, 0, 0)) | ||
>Service.Base : Symbol(Service.Base, Decl(cloduleGenericOnSelfMember.ts, 6, 16)) | ||
>Service : Symbol(Service, Decl(cloduleGenericOnSelfMember.ts, 2, 1), Decl(cloduleGenericOnSelfMember.ts, 4, 1)) | ||
>Base : Symbol(Service.Base, Decl(cloduleGenericOnSelfMember.ts, 6, 16)) | ||
} | ||
namespace Service { | ||
>Service : Symbol(Service, Decl(cloduleGenericOnSelfMember.ts, 2, 1), Decl(cloduleGenericOnSelfMember.ts, 4, 1)) | ||
|
||
export const Base = { | ||
>Base : Symbol(Base, Decl(cloduleGenericOnSelfMember.ts, 6, 16)) | ||
|
||
name: "1", | ||
>name : Symbol(name, Decl(cloduleGenericOnSelfMember.ts, 6, 25)) | ||
|
||
value: 5 | ||
>value : Symbol(value, Decl(cloduleGenericOnSelfMember.ts, 7, 18)) | ||
|
||
}; | ||
} |
33 changes: 33 additions & 0 deletions
33
tests/baselines/reference/cloduleGenericOnSelfMember.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,33 @@ | ||
=== tests/cases/compiler/cloduleGenericOnSelfMember.ts === | ||
class ServiceBase<T> { | ||
>ServiceBase : ServiceBase<T> | ||
>T : T | ||
|
||
field: T; | ||
>field : T | ||
>T : T | ||
} | ||
class Service extends ServiceBase<typeof Service.Base> { | ||
>Service : Service | ||
>ServiceBase : ServiceBase<{ name: string; value: number; }> | ||
>Service.Base : { name: string; value: number; } | ||
>Service : typeof Service | ||
>Base : { name: string; value: number; } | ||
} | ||
namespace Service { | ||
>Service : typeof Service | ||
|
||
export const Base = { | ||
>Base : { name: string; value: number; } | ||
>{ name: "1", value: 5 } : { name: string; value: number; } | ||
|
||
name: "1", | ||
>name : string | ||
>"1" : "1" | ||
|
||
value: 5 | ||
>value : number | ||
>5 : 5 | ||
|
||
}; | ||
} |
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 @@ | ||
class ServiceBase<T> { | ||
field: T; | ||
} | ||
class Service extends ServiceBase<typeof Service.Base> { | ||
} | ||
namespace Service { | ||
export const Base = { | ||
name: "1", | ||
value: 5 | ||
}; | ||
} |