Closed
Description
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.