Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove now-unneeded nongeneric checks
- Loading branch information
Showing
6 changed files
with
126 additions
and
17 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
32 changes: 32 additions & 0 deletions
32
tests/baselines/reference/checkInfiniteExpansionTermination.errors.txt
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,32 @@ | ||
tests/cases/compiler/checkInfiniteExpansionTermination.ts(16,1): error TS2322: Type 'ISubject<Bar>' is not assignable to type 'IObservable<Foo>'. | ||
Types of property 'n' are incompatible. | ||
Type 'IObservable<Bar[]>' is not assignable to type 'IObservable<Foo[]>'. | ||
Type 'Bar[]' is not assignable to type 'Foo[]'. | ||
Property 'x' is missing in type 'Bar' but required in type 'Foo'. | ||
|
||
|
||
==== tests/cases/compiler/checkInfiniteExpansionTermination.ts (1 errors) ==== | ||
// Regression test for #1002 | ||
// Before fix this code would cause infinite loop | ||
|
||
interface IObservable<T> { | ||
n: IObservable<T[]>; // Needed, must be T[] | ||
} | ||
|
||
// Needed | ||
interface ISubject<T> extends IObservable<T> { } | ||
|
||
interface Foo { x } | ||
interface Bar { y } | ||
|
||
var values: IObservable<Foo>; | ||
var values2: ISubject<Bar>; | ||
values = values2; | ||
~~~~~~ | ||
!!! error TS2322: Type 'ISubject<Bar>' is not assignable to type 'IObservable<Foo>'. | ||
!!! error TS2322: Types of property 'n' are incompatible. | ||
!!! error TS2322: Type 'IObservable<Bar[]>' is not assignable to type 'IObservable<Foo[]>'. | ||
!!! error TS2322: Type 'Bar[]' is not assignable to type 'Foo[]'. | ||
!!! error TS2322: Property 'x' is missing in type 'Bar' but required in type 'Foo'. | ||
!!! related TS2728 tests/cases/compiler/checkInfiniteExpansionTermination.ts:11:17: 'x' is declared here. | ||
|
52 changes: 52 additions & 0 deletions
52
tests/baselines/reference/invariantGenericErrorElaboration.errors.txt
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 @@ | ||
tests/cases/compiler/invariantGenericErrorElaboration.ts(3,7): error TS2322: Type 'Num' is not assignable to type 'Runtype<any>'. | ||
Types of property 'constraint' are incompatible. | ||
Type 'Constraint<Num>' is not assignable to type 'Constraint<Runtype<any>>'. | ||
Types of property 'constraint' are incompatible. | ||
Type 'Constraint<Constraint<Num>>' is not assignable to type 'Constraint<Constraint<Runtype<any>>>'. | ||
Types of property 'constraint' are incompatible. | ||
Type 'Constraint<Constraint<Constraint<Num>>>' is not assignable to type 'Constraint<Constraint<Constraint<Runtype<any>>>>'. | ||
Type 'Constraint<Constraint<Runtype<any>>>' is not assignable to type 'Constraint<Constraint<Num>>'. | ||
Types of property 'underlying' are incompatible. | ||
Type 'Constraint<Runtype<any>>' is not assignable to type 'Constraint<Num>'. | ||
tests/cases/compiler/invariantGenericErrorElaboration.ts(4,19): error TS2322: Type 'Num' is not assignable to type 'Runtype<any>'. | ||
|
||
|
||
==== tests/cases/compiler/invariantGenericErrorElaboration.ts (2 errors) ==== | ||
// Repro from #19746 | ||
|
||
const wat: Runtype<any> = Num; | ||
~~~ | ||
!!! error TS2322: Type 'Num' is not assignable to type 'Runtype<any>'. | ||
!!! error TS2322: Types of property 'constraint' are incompatible. | ||
!!! error TS2322: Type 'Constraint<Num>' is not assignable to type 'Constraint<Runtype<any>>'. | ||
!!! error TS2322: Types of property 'constraint' are incompatible. | ||
!!! error TS2322: Type 'Constraint<Constraint<Num>>' is not assignable to type 'Constraint<Constraint<Runtype<any>>>'. | ||
!!! error TS2322: Types of property 'constraint' are incompatible. | ||
!!! error TS2322: Type 'Constraint<Constraint<Constraint<Num>>>' is not assignable to type 'Constraint<Constraint<Constraint<Runtype<any>>>>'. | ||
!!! error TS2322: Type 'Constraint<Constraint<Runtype<any>>>' is not assignable to type 'Constraint<Constraint<Num>>'. | ||
!!! error TS2322: Types of property 'underlying' are incompatible. | ||
!!! error TS2322: Type 'Constraint<Runtype<any>>' is not assignable to type 'Constraint<Num>'. | ||
!!! related TS2728 tests/cases/compiler/invariantGenericErrorElaboration.ts:12:3: 'tag' is declared here. | ||
const Foo = Obj({ foo: Num }) | ||
~~~ | ||
!!! error TS2322: Type 'Num' is not assignable to type 'Runtype<any>'. | ||
!!! related TS6501 tests/cases/compiler/invariantGenericErrorElaboration.ts:17:34: The expected type comes from this index signature. | ||
|
||
interface Runtype<A> { | ||
constraint: Constraint<this> | ||
witness: A | ||
} | ||
|
||
interface Num extends Runtype<number> { | ||
tag: 'number' | ||
} | ||
declare const Num: Num | ||
|
||
interface Obj<O extends { [_ in string]: Runtype<any> }> extends Runtype<{[K in keyof O]: O[K]['witness'] }> {} | ||
declare function Obj<O extends { [_: string]: Runtype<any> }>(fields: O): Obj<O>; | ||
|
||
interface Constraint<A extends Runtype<any>> extends Runtype<A['witness']> { | ||
underlying: A, | ||
check: (x: A['witness']) => void, | ||
} | ||
|
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
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/recursiveTypeComparison.errors.txt
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,27 @@ | ||
tests/cases/compiler/recursiveTypeComparison.ts(14,5): error TS2322: Type 'Observable<{}>' is not assignable to type 'Property<number>'. | ||
Types of property 'needThisOne' are incompatible. | ||
Type 'Observable<{}>' is not assignable to type 'Observable<number>'. | ||
Type '{}' is not assignable to type 'number'. | ||
|
||
|
||
==== tests/cases/compiler/recursiveTypeComparison.ts (1 errors) ==== | ||
// Before fix this would take an exceeding long time to complete (#1170) | ||
|
||
interface Observable<T> { | ||
// This member can't be of type T, Property<T>, or Observable<anything but T> | ||
needThisOne: Observable<T>; | ||
// Add more to make it slower | ||
expo1: Property<T[]>; // 0.31 seconds in check | ||
expo2: Property<T[]>; // 3.11 seconds | ||
expo3: Property<T[]>; // 82.28 seconds | ||
} | ||
interface Property<T> extends Observable<T> { } | ||
|
||
var p: Observable<{}>; | ||
var stuck: Property<number> = p; | ||
~~~~~ | ||
!!! error TS2322: Type 'Observable<{}>' is not assignable to type 'Property<number>'. | ||
!!! error TS2322: Types of property 'needThisOne' are incompatible. | ||
!!! error TS2322: Type 'Observable<{}>' is not assignable to type 'Observable<number>'. | ||
!!! error TS2322: Type '{}' is not assignable to type 'number'. | ||
|
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