forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reset partial memberlist on defered circularity to calculate the corr…
…ect members (microsoft#20179) * Reset partial memberlist on defered circularity to calculate the correct members * Remove return type
- Loading branch information
Showing
6 changed files
with
183 additions
and
8 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
52 changes: 52 additions & 0 deletions
52
tests/baselines/reference/circularConstraintYieldsAppropriateError.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,52 @@ | ||
//// [circularConstraintYieldsAppropriateError.ts] | ||
// https://github.com/Microsoft/TypeScript/issues/16861 | ||
class BaseType<T> { | ||
bar: T | ||
} | ||
|
||
class NextType<C extends { someProp: any }, T = C['someProp']> extends BaseType<T> { | ||
baz: string; | ||
} | ||
|
||
class Foo extends NextType<Foo> { | ||
someProp: { | ||
test: true | ||
} | ||
} | ||
|
||
const foo = new Foo(); | ||
foo.bar.test | ||
|
||
//// [circularConstraintYieldsAppropriateError.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 __()); | ||
}; | ||
})(); | ||
// https://github.com/Microsoft/TypeScript/issues/16861 | ||
var BaseType = /** @class */ (function () { | ||
function BaseType() { | ||
} | ||
return BaseType; | ||
}()); | ||
var NextType = /** @class */ (function (_super) { | ||
__extends(NextType, _super); | ||
function NextType() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return NextType; | ||
}(BaseType)); | ||
var Foo = /** @class */ (function (_super) { | ||
__extends(Foo, _super); | ||
function Foo() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return Foo; | ||
}(NextType)); | ||
var foo = new Foo(); | ||
foo.bar.test; |
48 changes: 48 additions & 0 deletions
48
tests/baselines/reference/circularConstraintYieldsAppropriateError.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,48 @@ | ||
=== tests/cases/compiler/circularConstraintYieldsAppropriateError.ts === | ||
// https://github.com/Microsoft/TypeScript/issues/16861 | ||
class BaseType<T> { | ||
>BaseType : Symbol(BaseType, Decl(circularConstraintYieldsAppropriateError.ts, 0, 0)) | ||
>T : Symbol(T, Decl(circularConstraintYieldsAppropriateError.ts, 1, 15)) | ||
|
||
bar: T | ||
>bar : Symbol(BaseType.bar, Decl(circularConstraintYieldsAppropriateError.ts, 1, 19)) | ||
>T : Symbol(T, Decl(circularConstraintYieldsAppropriateError.ts, 1, 15)) | ||
} | ||
|
||
class NextType<C extends { someProp: any }, T = C['someProp']> extends BaseType<T> { | ||
>NextType : Symbol(NextType, Decl(circularConstraintYieldsAppropriateError.ts, 3, 1)) | ||
>C : Symbol(C, Decl(circularConstraintYieldsAppropriateError.ts, 5, 15)) | ||
>someProp : Symbol(someProp, Decl(circularConstraintYieldsAppropriateError.ts, 5, 26)) | ||
>T : Symbol(T, Decl(circularConstraintYieldsAppropriateError.ts, 5, 43)) | ||
>C : Symbol(C, Decl(circularConstraintYieldsAppropriateError.ts, 5, 15)) | ||
>BaseType : Symbol(BaseType, Decl(circularConstraintYieldsAppropriateError.ts, 0, 0)) | ||
>T : Symbol(T, Decl(circularConstraintYieldsAppropriateError.ts, 5, 43)) | ||
|
||
baz: string; | ||
>baz : Symbol(NextType.baz, Decl(circularConstraintYieldsAppropriateError.ts, 5, 84)) | ||
} | ||
|
||
class Foo extends NextType<Foo> { | ||
>Foo : Symbol(Foo, Decl(circularConstraintYieldsAppropriateError.ts, 7, 1)) | ||
>NextType : Symbol(NextType, Decl(circularConstraintYieldsAppropriateError.ts, 3, 1)) | ||
>Foo : Symbol(Foo, Decl(circularConstraintYieldsAppropriateError.ts, 7, 1)) | ||
|
||
someProp: { | ||
>someProp : Symbol(Foo.someProp, Decl(circularConstraintYieldsAppropriateError.ts, 9, 33)) | ||
|
||
test: true | ||
>test : Symbol(test, Decl(circularConstraintYieldsAppropriateError.ts, 10, 15)) | ||
} | ||
} | ||
|
||
const foo = new Foo(); | ||
>foo : Symbol(foo, Decl(circularConstraintYieldsAppropriateError.ts, 15, 5)) | ||
>Foo : Symbol(Foo, Decl(circularConstraintYieldsAppropriateError.ts, 7, 1)) | ||
|
||
foo.bar.test | ||
>foo.bar.test : Symbol(test, Decl(circularConstraintYieldsAppropriateError.ts, 10, 15)) | ||
>foo.bar : Symbol(BaseType.bar, Decl(circularConstraintYieldsAppropriateError.ts, 1, 19)) | ||
>foo : Symbol(foo, Decl(circularConstraintYieldsAppropriateError.ts, 15, 5)) | ||
>bar : Symbol(BaseType.bar, Decl(circularConstraintYieldsAppropriateError.ts, 1, 19)) | ||
>test : Symbol(test, Decl(circularConstraintYieldsAppropriateError.ts, 10, 15)) | ||
|
50 changes: 50 additions & 0 deletions
50
tests/baselines/reference/circularConstraintYieldsAppropriateError.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,50 @@ | ||
=== tests/cases/compiler/circularConstraintYieldsAppropriateError.ts === | ||
// https://github.com/Microsoft/TypeScript/issues/16861 | ||
class BaseType<T> { | ||
>BaseType : BaseType<T> | ||
>T : T | ||
|
||
bar: T | ||
>bar : T | ||
>T : T | ||
} | ||
|
||
class NextType<C extends { someProp: any }, T = C['someProp']> extends BaseType<T> { | ||
>NextType : NextType<C, T> | ||
>C : C | ||
>someProp : any | ||
>T : T | ||
>C : C | ||
>BaseType : BaseType<T> | ||
>T : T | ||
|
||
baz: string; | ||
>baz : string | ||
} | ||
|
||
class Foo extends NextType<Foo> { | ||
>Foo : Foo | ||
>NextType : NextType<Foo, { test: true; }> | ||
>Foo : Foo | ||
|
||
someProp: { | ||
>someProp : { test: true; } | ||
|
||
test: true | ||
>test : true | ||
>true : true | ||
} | ||
} | ||
|
||
const foo = new Foo(); | ||
>foo : Foo | ||
>new Foo() : Foo | ||
>Foo : typeof Foo | ||
|
||
foo.bar.test | ||
>foo.bar.test : true | ||
>foo.bar : { test: true; } | ||
>foo : Foo | ||
>bar : { test: true; } | ||
>test : true | ||
|
17 changes: 17 additions & 0 deletions
17
tests/cases/compiler/circularConstraintYieldsAppropriateError.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,17 @@ | ||
// https://github.com/Microsoft/TypeScript/issues/16861 | ||
class BaseType<T> { | ||
bar: T | ||
} | ||
|
||
class NextType<C extends { someProp: any }, T = C['someProp']> extends BaseType<T> { | ||
baz: string; | ||
} | ||
|
||
class Foo extends NextType<Foo> { | ||
someProp: { | ||
test: true | ||
} | ||
} | ||
|
||
const foo = new Foo(); | ||
foo.bar.test |