TypeScript Version: Version 3.4.0-dev.20190329
Search Terms: "debug failure getArgumentArityError"
Code
const s = {
a: function a(k: string) {
return k
},
b: function b(k: string, l: number) {
return `${k}:${l}`
},
}
type AnyFunc = 'a' | 'b'
function c(f: AnyFunc, k: string, ...args: any[]) {
return s[f](k, ...args)
}
Expected behavior: c() can be called as either c('a', 'foo') or c('b', 'foo', 3) (not necessarily fully type-checked).
Actual behavior: Crash:
$ node_modules/.bin/tsc src/test.ts
C:\Users\wfaust\Documents\Development\screeps\node_modules\typescript\lib\tsc.js:72973
throw e;
^
Error: Debug Failure. False expression.
at Object.first (C:\Users\wfaust\Documents\Development\screeps\node_modules\typescript\lib\tsc.js:951:15)
at getArgumentArityError (C:\Users\wfaust\Documents\Development\screeps\node_modules\typescript\lib\tsc.js:41936:32)
at resolveCall (C:\Users\wfaust\Documents\Development\screeps\node_modules\typescript\lib\tsc.js:42023:41)
at resolveCallExpression (C:\Users\wfaust\Documents\Development\screeps\node_modules\typescript\lib\tsc.js:42255:20)
at resolveSignature (C:\Users\wfaust\Documents\Development\screeps\node_modules\typescript\lib\tsc.js:42494:28)
at getResolvedSignature (C:\Users\wfaust\Documents\Development\screeps\node_modules\typescript\lib\tsc.js:42514:26)
at checkCallExpression (C:\Users\wfaust\Documents\Development\screeps\node_modules\typescript\lib\tsc.js:42585:29)
at checkExpressionWorker (C:\Users\wfaust\Documents\Development\screeps\node_modules\typescript\lib\tsc.js:44393:28)
at checkExpression (C:\Users\wfaust\Documents\Development\screeps\node_modules\typescript\lib\tsc.js:44320:38)
at checkExpressionCached (C:\Users\wfaust\Documents\Development\screeps\node_modules\typescript\lib\tsc.js:44109:38)
Related Issues: Lots of debug failures, but none that seem relevant.
This bug seems to occur only for 3.4.0-dev.20190313 and after, I have tried one by one from 3.4.0-dev.20190329 backwards until that.
here is a more simple reproducible code
You will see NO compiled output since it crashed. Open the browser console to view the Debug Failure. False expression. error.
@RyanCavanaugh would you consider doing a bugfix release for 3.4.x with #30758 in it instead of waiting for TypeScript 3.5? Just tried to upgrade our codebase to TS 3.4 and was blocked by this issue today.
@RyanCavanaugh Also looking for a response here. This seems to be a bug introduced in 3.4 so it would make sense to patch it before 3.5. This is also blocking the upgrade for a few projects I maintain.
If I open a PR to cherry-pick this commit into the release branch, release-3.4. Would it be accepted?
We can take a PR for 3.4 and see if anything else comes in over the next few days to go along with it
Most helpful comment
@RyanCavanaugh Also looking for a response here. This seems to be a bug introduced in
3.4so it would make sense to patch it before3.5. This is also blocking the upgrade for a few projects I maintain.If I open a PR to cherry-pick this commit into the release branch, release-3.4. Would it be accepted?