-
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.
Merge pull request #5761 from Microsoft/fixErrorElaboration
Fix crash during error elaboration
- Loading branch information
Showing
6 changed files
with
70 additions
and
5 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
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,25 @@ | ||
tests/cases/compiler/errorElaboration.ts(12,5): error TS2345: Argument of type '() => Container<Ref<string>>' is not assignable to parameter of type '() => Container<Ref<number>>'. | ||
Type 'Container<Ref<string>>' is not assignable to type 'Container<Ref<number>>'. | ||
Type 'Ref<string>' is not assignable to type 'Ref<number>'. | ||
Type 'string' is not assignable to type 'number'. | ||
|
||
|
||
==== tests/cases/compiler/errorElaboration.ts (1 errors) ==== | ||
// Repro for #5712 | ||
|
||
interface Ref<T> { | ||
prop: T; | ||
} | ||
interface Container<T> { | ||
m1: Container<Ref<T>>; | ||
m2: T; | ||
} | ||
declare function foo(x: () => Container<Ref<number>>): void; | ||
let a: () => Container<Ref<string>>; | ||
foo(a); | ||
~ | ||
!!! error TS2345: Argument of type '() => Container<Ref<string>>' is not assignable to parameter of type '() => Container<Ref<number>>'. | ||
!!! error TS2345: Type 'Container<Ref<string>>' is not assignable to type 'Container<Ref<number>>'. | ||
!!! error TS2345: Type 'Ref<string>' is not assignable to type 'Ref<number>'. | ||
!!! error TS2345: Type 'string' 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//// [errorElaboration.ts] | ||
// Repro for #5712 | ||
|
||
interface Ref<T> { | ||
prop: T; | ||
} | ||
interface Container<T> { | ||
m1: Container<Ref<T>>; | ||
m2: T; | ||
} | ||
declare function foo(x: () => Container<Ref<number>>): void; | ||
let a: () => Container<Ref<string>>; | ||
foo(a); | ||
|
||
|
||
//// [errorElaboration.js] | ||
// Repro for #5712 | ||
var a; | ||
foo(a); |
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,12 @@ | ||
// Repro for #5712 | ||
|
||
interface Ref<T> { | ||
prop: T; | ||
} | ||
interface Container<T> { | ||
m1: Container<Ref<T>>; | ||
m2: T; | ||
} | ||
declare function foo(x: () => Container<Ref<number>>): void; | ||
let a: () => Container<Ref<string>>; | ||
foo(a); |