-
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.
* Added test case for #20026 * Implemented #20026 * Addresed comments at /pull/20157#discussion_r152086287 * Fixed merge issues * Fixed baseline issue * Merged upstream
- Loading branch information
1 parent
c4d7629
commit 73e3e8d
Showing
7 changed files
with
109 additions
and
11 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
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/nullableFunctionError.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,17 @@ | ||
tests/cases/compiler/nullableFunctionError.ts(1,1): error TS2721: Cannot invoke an object which is possibly 'null'. | ||
tests/cases/compiler/nullableFunctionError.ts(2,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. | ||
tests/cases/compiler/nullableFunctionError.ts(4,1): error TS2723: Cannot invoke an object which is possibly 'null' or 'undefined'. | ||
|
||
|
||
==== tests/cases/compiler/nullableFunctionError.ts (3 errors) ==== | ||
null(); | ||
~~~~ | ||
!!! error TS2721: Cannot invoke an object which is possibly 'null'. | ||
undefined(); | ||
~~~~~~~~~ | ||
!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. | ||
let f: null | undefined; | ||
f(); | ||
~ | ||
!!! error TS2723: Cannot invoke an object which is possibly 'null' or 'undefined'. | ||
|
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 @@ | ||
//// [nullableFunctionError.ts] | ||
null(); | ||
undefined(); | ||
let f: null | undefined; | ||
f(); | ||
|
||
|
||
//// [nullableFunctionError.js] | ||
null(); | ||
undefined(); | ||
var f; | ||
f(); |
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,11 @@ | ||
=== tests/cases/compiler/nullableFunctionError.ts === | ||
null(); | ||
undefined(); | ||
>undefined : Symbol(undefined) | ||
|
||
let f: null | undefined; | ||
>f : Symbol(f, Decl(nullableFunctionError.ts, 2, 3)) | ||
|
||
f(); | ||
>f : Symbol(f, Decl(nullableFunctionError.ts, 2, 3)) | ||
|
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 @@ | ||
=== tests/cases/compiler/nullableFunctionError.ts === | ||
null(); | ||
>null() : any | ||
>null : null | ||
|
||
undefined(); | ||
>undefined() : any | ||
>undefined : undefined | ||
|
||
let f: null | undefined; | ||
>f : null | undefined | ||
>null : null | ||
|
||
f(); | ||
>f() : any | ||
>f : null | undefined | ||
|
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,6 @@ | ||
// @strictNullChecks: true | ||
|
||
null(); | ||
undefined(); | ||
let f: null | undefined; | ||
f(); |