You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Uncalled-function error with function check in binary expression misses usage in body #41586
In version 4.2.0-dev.20201112 (nightly on the playground) this works as expected. With strictNullChecks enabled it errors, without strictNullChecks it provides no error.
👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of the repro in this issue running against the nightly TypeScript. If something changes, I will post a new comment.
Martin Johns (@MartinJohns) I think that's because the problem started with Oleksandr Tarasiuk (@a-tarasyuk)'s recent PR to issue the error for binary expressions. Before that, the checker never issued an error for uncalled functions in binary expressions.
Separately, this means that the playground nightly is a week out of date, which is concerning. I'll let Orta Therox (@orta) know.
I checked this case before, as I remember we need to handle binary expression and condition body. Not sure what need to check - find parent context of binary expression or use a binary expression from a condition.
if(f&&b){f()}
I suppose getFalsyFlags will return true for condition type, so maybe need to find the parent of binary expression. Nathan Shively-Sanders (@sandersn) What do you think?
I think you just have to find the parent of the binary expression and if it's IfStatement, pass the body to checkTestingKnownTruthyCallableType. I've got a fix for this bug that does just that; I'm going to make sure if fixes the other bug too.
Activity
sandersn commentedon Nov 18, 2020
Oleksandr Tarasiuk (@a-tarasyuk) you might be interested in this too.
Fix tsconfigs of d3/v5 dependents
Fix tsconfigs of d3/v5 dependents (#49668)
MartinJohns commentedon Nov 19, 2020
In version 4.2.0-dev.20201112 (nightly on the playground) this works as expected. With
strictNullChecksenabled it errors, withoutstrictNullChecksit provides no error.typescript-bot commentedon Nov 19, 2020
👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of the repro in this issue running against the nightly TypeScript. If something changes, I will post a new comment.
Issue body code block by Nathan Shively-Sanders (@sandersn)
❌ Failed: -
This condition will always return true since the function is always defined. Did you mean to call it instead?Historical Information
Issue body code block by Nathan Shively-Sanders (@sandersn)
❌ Failed: -
This condition will always return true since the function is always defined. Did you mean to call it instead?👍 Compiled
sandersn commentedon Nov 19, 2020
Martin Johns (@MartinJohns) I think that's because the problem started with Oleksandr Tarasiuk (@a-tarasyuk)'s recent PR to issue the error for binary expressions. Before that, the checker never issued an error for uncalled functions in binary expressions.
Separately, this means that the playground nightly is a week out of date, which is concerning. I'll let Orta Therox (@orta) know.
a-tarasyuk commentedon Nov 19, 2020
Nathan Shively-Sanders (@sandersn) Yep. I think these issues (#41586, #41588) are equal and both related to this #40260 (comment).
sandersn commentedon Nov 19, 2020
Makes sense. I have some time this morning so I can look at it if you're not already working on it.
a-tarasyuk commentedon Nov 19, 2020
I checked this case before, as I remember we need to handle binary expression and condition body. Not sure what need to check - find parent context of binary expression or use a binary expression from a condition.
I suppose
getFalsyFlagswill returntruefor condition type, so maybe need to find the parent of binary expression. Nathan Shively-Sanders (@sandersn) What do you think?sandersn commentedon Nov 19, 2020
I think you just have to find the parent of the binary expression and if it's IfStatement, pass the body to checkTestingKnownTruthyCallableType. I've got a fix for this bug that does just that; I'm going to make sure if fixes the other bug too.
sandersn commentedon Nov 19, 2020
No, the other bug also repros without a binary expression. I'll update the repro for it.
Improve uncalled function checks
Improve uncalled function checks (#41599)
Fix tsconfigs of d3/v5 dependents (DefinitelyTyped#49668)