[Issue 4525] Regression(2.020) Array member call syntax can't find matches in current class

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 31 22:51:55 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=4525


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


--- Comment #6 from Kenji Hara <k.hara.pg at gmail.com> 2012-01-31 22:51:48 PST ---
(In reply to comment #5)
> Further investigation shows that this is not a bug.
> 
>     array.func(arguments)
> 
> is rewritten to be:
> 
>     .func(array, arguments)
> 
> Note the leading ., which means look for func() at module scope. Foo.bar() in
> the example is not at module scope, hence it is not found. Note that the error
> message gives the clue in referring to "mymodule.bar", not just "bar".
> 
> This was a deliberate design choice, as universal function call syntax is a
> feature meant to be used with global functions, not local ones.

The original bug issue against paired the change is bug 2344. But finding UFCS
property/member function from global scope causes problems like this issue.

And the finding rule is not work against function local import, see bug 6185.

My suggestion is here:
http://d.puremagic.com/issues/show_bug.cgi?id=6185#c6

- The UFCS lookup should start *from most inside scope*, not module scope.
- Until reaching to module scope, UFCS lookup should not raise errors against
mismatches of invalid function call, instead *ignore* them silently.
- Finally, if there is no match in all scopes, raise an error.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list