-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use same behavior for call expressions
- Loading branch information
1 parent
2522469
commit 60d5813
Showing
6 changed files
with
62 additions
and
4 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
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/truthinessCallExpressionCoercion4.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,12 @@ | ||
tests/cases/compiler/truthinessCallExpressionCoercion4.ts(3,5): error TS2774: This condition will always return true since this function is always defined. Did you mean to call it instead? | ||
|
||
|
||
==== tests/cases/compiler/truthinessCallExpressionCoercion4.ts (1 errors) ==== | ||
const or = x => y => x || y; | ||
|
||
if (or(true)) { // error | ||
~~~~~~~~ | ||
!!! error TS2774: This condition will always return true since this function is always defined. Did you mean to call it instead? | ||
|
||
} | ||
|
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/truthinessCallExpressionCoercion4.js
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 @@ | ||
//// [truthinessCallExpressionCoercion4.ts] | ||
const or = x => y => x || y; | ||
|
||
if (or(true)) { // error | ||
|
||
} | ||
|
||
|
||
//// [truthinessCallExpressionCoercion4.js] | ||
var or = function (x) { return function (y) { return x || y; }; }; | ||
if (or(true)) { // error | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/truthinessCallExpressionCoercion4.symbols
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,13 @@ | ||
=== tests/cases/compiler/truthinessCallExpressionCoercion4.ts === | ||
const or = x => y => x || y; | ||
>or : Symbol(or, Decl(truthinessCallExpressionCoercion4.ts, 0, 5)) | ||
>x : Symbol(x, Decl(truthinessCallExpressionCoercion4.ts, 0, 10)) | ||
>y : Symbol(y, Decl(truthinessCallExpressionCoercion4.ts, 0, 15)) | ||
>x : Symbol(x, Decl(truthinessCallExpressionCoercion4.ts, 0, 10)) | ||
>y : Symbol(y, Decl(truthinessCallExpressionCoercion4.ts, 0, 15)) | ||
|
||
if (or(true)) { // error | ||
>or : Symbol(or, Decl(truthinessCallExpressionCoercion4.ts, 0, 5)) | ||
|
||
} | ||
|
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/truthinessCallExpressionCoercion4.types
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,18 @@ | ||
=== tests/cases/compiler/truthinessCallExpressionCoercion4.ts === | ||
const or = x => y => x || y; | ||
>or : (x: any) => (y: any) => any | ||
>x => y => x || y : (x: any) => (y: any) => any | ||
>x : any | ||
>y => x || y : (y: any) => any | ||
>y : any | ||
>x || y : any | ||
>x : any | ||
>y : any | ||
|
||
if (or(true)) { // error | ||
>or(true) : (y: any) => any | ||
>or : (x: any) => (y: any) => any | ||
>true : true | ||
|
||
} | ||
|
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,7 @@ | ||
// @strictNullChecks: true | ||
|
||
const or = x => y => x || y; | ||
|
||
if (or(true)) { // error | ||
|
||
} |