digitalmars.D.bugs - [Issue 11261] New: Can't infer types without explicit slice in foreach
- d-bugmail puremagic.com (44/44) Oct 14 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11261
- d-bugmail puremagic.com (17/17) Oct 14 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11261
- d-bugmail puremagic.com (10/10) Oct 14 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11261
- d-bugmail puremagic.com (12/22) Oct 14 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11261
- d-bugmail puremagic.com (11/11) Oct 15 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11261
- d-bugmail puremagic.com (9/9) Oct 15 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11261
- d-bugmail puremagic.com (10/10) Oct 15 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11261
http://d.puremagic.com/issues/show_bug.cgi?id=11261 Summary: Can't infer types without explicit slice in foreach Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: regression Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: Jesse.K.Phillips+D gmail.com 10:54:11 PDT --- When using a range to proved a key-value tuple, the compiler is unable to infer the key-value in a foreach when slice is not present (2). Using an array continues to work (1). This functioned in 2.63. import std.typecons; import std.range; class Container { alias Tuple!(string, "key", string, "value") Key; InputRange!Key opSlice() { // 1 Key[] opSlice() { Range r; return inputRangeObject(r); // 1 return [Key("myKey", "My Value")]; } private struct Range { enum empty = false; auto popFront() { } auto front() { return Key("myKey", "myValue"); } } } void main() { auto container = new Container(); foreach(k,v; container) // 2 foreach(k,v; container[]) { break; } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 14 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11261 Jesse Phillips <Jesse.K.Phillips+D gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Jesse.K.Phillips+D gmail.co | |m 11:36:46 PDT --- While the version with an explicit slice does infer types, it is inferring the wrong ones. k = uint v = Tuple!(string, "key", string, "value") This is consistent with 2.63, without the explicit slice the types are k = string v = string -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 14 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11261 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull, rejects-valid https://github.com/D-Programming-Language/dmd/pull/2668 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 14 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11261While the version with an explicit slice does infer types, it is inferring the wrong ones. k = uint v = Tuple!(string, "key", string, "value") This is consistent with 2.63, without the explicit slice the types are k = string v = stringIn the first case (foreach (k, v; container)), both k and v should be inferred to string. However in the second case (foreach (k, v; container[])) you _cannot_ get same inference result. Because std.range.InputRange interface defines an opApply with indexing (size_t + KeyType), and it is preferentially used for foreach argument type deduction. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 14 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11261 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/800631a95964ff15a4dadb15b031f80222449031 fix Issue 11261 - Can't infer types without explicit slice in foreach https://github.com/D-Programming-Language/dmd/commit/339deaa9be455c98aa00c4f0741c76b8774b0e41 [REG2.064a] Issue 11261 - Can't infer types without explicit slice in foreach -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 15 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11261 Commit pushed to 2.064 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/718dfbb02f8ca7356e8f46637b2e90e2f81d96d0 [REG2.064a] Issue 11261 - Can't infer types without explicit slice in foreach -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 15 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11261 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 15 2013