Bug 12432 – Diagnostic on argument count mismatch for ranges and opApply should improve

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-21T10:40:00Z
Last change time
2014-03-23T02:55:42Z
Keywords
diagnostic, pull
Assigned to
andrej.mitrovich
Creator
jlquinn

Comments

Comment #0 by jlquinn — 2014-03-21T10:40:52Z
import std.algorithm; void foo(string line) { foreach (int i,string tok; splitter(line, " ")) {} } ~/dmd2/linux/bin64/dmd -c junk.d junk.d(5): Error: cannot infer argument types This is dmd 2.065.0 on ubuntu 64 bit. Removing the int i fixes the problem. I think I recall seeing something about trying to use an index variable with a forward range. It's nice to be able to use the var, even if I'm not trying to index into the range. More importantly, the error message is completely opaque.
Comment #1 by andrej.mitrovich — 2014-03-21T11:35:40Z
Comment #2 by github-bugzilla — 2014-03-23T01:55:57Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a38a23830977a42f9b36a51d7e4e7a6e9b917ad1 Fix Issue 12432 - Implement better diagnostics for argument count mismatch in range and opApply contexts. https://github.com/D-Programming-Language/dmd/commit/86d59a72df020fedc6e3bc87a885fa969121ea3e Merge pull request #3396 from AndrejMitrovic/Fix12432 Issue 12432 - Better diagnostics for argument count mismatch in range and opApply