Skip to content

Commit 76d0ba5

Browse files
committed
Fix thisPredicateFunction{Completions,QuickInfo}02 tests.
The Crate<T> class had a "this" type predicate that referenced the type parameter T, preventing T from being covariant, which caused unexpected behavior elsewhere. Apply the workaround of giving the method its own type parameter T to avoid affecting the variance of the class's T.
1 parent d47dbb7 commit 76d0ba5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/cases/fourslash/thisPredicateFunctionCompletions02.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//// contents: T;
1313
//// isSundries(): this is Crate<Sundries>;
1414
//// isSupplies(): this is Crate<Supplies>;
15-
//// isPackedTight(): this is (this & {extraContents: T});
15+
//// isPackedTight<T>(this: Crate<T>): this is {extraContents: T};
1616
//// }
1717
//// const crate: Crate<any>;
1818
//// if (crate.isPackedTight()) {

tests/cases/fourslash/thisPredicateFunctionQuickInfo02.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//// contents: T;
1313
//// /*1*/isSundries(): this is Crate<Sundries>;
1414
//// /*2*/isSupplies(): this is Crate<Supplies>;
15-
//// /*3*/isPackedTight(): this is (this & {extraContents: T});
15+
//// /*3*/isPackedTight<T>(this: Crate<T>): this is {extraContents: T};
1616
//// }
1717
//// const crate: Crate<any>;
1818
//// if (crate.isPackedTight/*4*/()) {
@@ -34,18 +34,18 @@
3434
verify.quickInfos({
3535
1: "(method) Crate<T>.isSundries(): this is Crate<Sundries>",
3636
2: "(method) Crate<T>.isSupplies(): this is Crate<Supplies>",
37-
3: `(method) Crate<T>.isPackedTight(): this is this & {
37+
3: `(method) Crate<T>.isPackedTight<T>(this: Crate<T>): this is {
3838
extraContents: T;
3939
}`,
40-
4: `(method) Crate<any>.isPackedTight(): this is Crate<any> & {
40+
4: `(method) Crate<any>.isPackedTight<any>(this: Crate<any>): this is {
4141
extraContents: any;
4242
}`,
4343
5: "(method) Crate<any>.isSundries(): this is Crate<Sundries>",
44-
6: `(method) Crate<Sundries>.isPackedTight(): this is Crate<Sundries> & {
44+
6: `(method) Crate<Sundries>.isPackedTight<Sundries>(this: Crate<Sundries>): this is {
4545
extraContents: Sundries;
4646
}`,
4747
7: "(method) Crate<any>.isSupplies(): this is Crate<Supplies>",
48-
8: `(method) Crate<Supplies>.isPackedTight(): this is Crate<Supplies> & {
48+
8: `(method) Crate<Supplies>.isPackedTight<Supplies>(this: Crate<Supplies>): this is {
4949
extraContents: Supplies;
5050
}`
5151
});

0 commit comments

Comments
 (0)