Thread overview |
---|
September 07, 2008 [Issue 2344] New: Two wrong lookups for array functions | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2344 Summary: Two wrong lookups for array functions Product: D Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: andrei@metalanguage.com size_t blah(int[] r) { return r.length; } struct A { int[] r; size_t blah() { return r.blah(); } } void main() { A a; a.blah; } The code above says: function test.A.blah () does not match parameter types (int[]) Error: expected 0 arguments, not 1 So it looks like the compiler first morphs r.blah() into blah(r), but then uses the local scope to look for blah. Therefore A.blah will be found, leading to the nonsensical call this.blah(r). Interestingly, if the parens are removed leaving r.blah, the lookup is still wrong but in a different way: Error: no property 'blah' for type 'int[]' So this time the call fails to start with. Both errors are bugs. The code should compile with and without parentheses. -- |
October 10, 2008 [Issue 2344] Two wrong lookups for array functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2344 ------- Comment #1 from bugzilla@digitalmars.com 2008-10-10 18:23 ------- This is an enhancement. Rewriting: array.foo as: .foo(array) rather than: foo(array) does the trick. -- |
October 10, 2008 [Issue 2344] Two wrong lookups for array functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2344 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement -- |
October 11, 2008 [Issue 2344] Two wrong lookups for array functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2344 ------- Comment #2 from andrei@metalanguage.com 2008-10-10 20:34 ------- (In reply to comment #1) > This is an enhancement. Rewriting: > array.foo > as: > .foo(array) > rather than: > foo(array) > does the trick. > Nah. The whole point was to have obj.foo work for arrays and other beasts. -- |
October 21, 2008 [Issue 2344] Two wrong lookups for array functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2344 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #3 from bugzilla@digitalmars.com 2008-10-20 22:21 ------- Fixed dmd 2.020 -- |
February 01, 2012 [Issue 2344] Two wrong lookups for array functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2344 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wbaxter@gmail.com --- Comment #4 from yebblies <yebblies@gmail.com> 2012-02-02 02:18:48 EST --- *** Issue 1457 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation