From cf17be2c764c087449e12dde85c14b36a087a16e Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 25 Apr 2017 14:46:30 -0700 Subject: [PATCH] Revert "Add another test case" This reverts commit 510bc8196760f9d62b29d2f3e48a8bc6ad0d8d14. --- .../reference/covariantCallbacks.errors.txt | 31 ++----------------- .../baselines/reference/covariantCallbacks.js | 20 +----------- .../covariantCallbacks.ts | 15 +-------- 3 files changed, 4 insertions(+), 62 deletions(-) diff --git a/tests/baselines/reference/covariantCallbacks.errors.txt b/tests/baselines/reference/covariantCallbacks.errors.txt index 55c69c89728f1..3a1ea25b96e46 100644 --- a/tests/baselines/reference/covariantCallbacks.errors.txt +++ b/tests/baselines/reference/covariantCallbacks.errors.txt @@ -18,15 +18,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covarian Types of property 'forEach' are incompatible. Type '(cb: (item: A) => void) => void' is not assignable to type '(cb: (item: A, context: any) => void) => void'. Types of parameters 'cb' and 'cb' are incompatible. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covariantCallbacks.ts(69,5): error TS2322: Type 'AList4' is not assignable to type 'BList4'. - Types of property 'forEach' are incompatible. - Type '(cb: (item: A) => A) => void' is not assignable to type '(cb: (item: B) => B) => void'. - Types of parameters 'cb' and 'cb' are incompatible. - Types of parameters 'item' and 'item' are incompatible. - Type 'A' is not assignable to type 'B'. -==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covariantCallbacks.ts (6 errors) ==== +==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covariantCallbacks.ts (5 errors) ==== // Test that callback parameters are related covariantly interface P { @@ -108,25 +102,4 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covarian !!! error TS2322: Types of property 'forEach' are incompatible. !!! error TS2322: Type '(cb: (item: A) => void) => void' is not assignable to type '(cb: (item: A, context: any) => void) => void'. !!! error TS2322: Types of parameters 'cb' and 'cb' are incompatible. - } - - interface AList4 { - forEach(cb: (item: A) => A): void; - } - - interface BList4 { - forEach(cb: (item: B) => B): void; - } - - function f14(a: AList4, b: BList4) { - a = b; - b = a; // Error - ~ -!!! error TS2322: Type 'AList4' is not assignable to type 'BList4'. -!!! error TS2322: Types of property 'forEach' are incompatible. -!!! error TS2322: Type '(cb: (item: A) => A) => void' is not assignable to type '(cb: (item: B) => B) => void'. -!!! error TS2322: Types of parameters 'cb' and 'cb' are incompatible. -!!! error TS2322: Types of parameters 'item' and 'item' are incompatible. -!!! error TS2322: Type 'A' is not assignable to type 'B'. - } - \ No newline at end of file + } \ No newline at end of file diff --git a/tests/baselines/reference/covariantCallbacks.js b/tests/baselines/reference/covariantCallbacks.js index 497a1ff991678..fb2ecfbc3c18e 100644 --- a/tests/baselines/reference/covariantCallbacks.js +++ b/tests/baselines/reference/covariantCallbacks.js @@ -55,21 +55,7 @@ interface BList3 { function f13(a: AList3, b: BList3) { a = b; b = a; // Error -} - -interface AList4 { - forEach(cb: (item: A) => A): void; -} - -interface BList4 { - forEach(cb: (item: B) => B): void; -} - -function f14(a: AList4, b: BList4) { - a = b; - b = a; // Error -} - +} //// [covariantCallbacks.js] // Test that callback parameters are related covariantly @@ -94,7 +80,3 @@ function f13(a, b) { a = b; b = a; // Error } -function f14(a, b) { - a = b; - b = a; // Error -} diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covariantCallbacks.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covariantCallbacks.ts index 462911fb17ac9..c46f396f414ea 100644 --- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covariantCallbacks.ts +++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covariantCallbacks.ts @@ -56,17 +56,4 @@ interface BList3 { function f13(a: AList3, b: BList3) { a = b; b = a; // Error -} - -interface AList4 { - forEach(cb: (item: A) => A): void; -} - -interface BList4 { - forEach(cb: (item: B) => B): void; -} - -function f14(a: AList4, b: BList4) { - a = b; - b = a; // Error -} +} \ No newline at end of file