{"action":"created","issue":{"url":"https://api.github.com/repos/pascalabcnet/pascalabcnet/issues/719","repository_url":"https://api.github.com/repos/pascalabcnet/pascalabcnet","labels_url":"https://api.github.com/repos/pascalabcnet/pascalabcnet/issues/719/labels{/name}","comments_url":"https://api.github.com/repos/pascalabcnet/pascalabcnet/issues/719/comments","events_url":"https://api.github.com/repos/pascalabcnet/pascalabcnet/issues/719/events","html_url":"https://github.com/pascalabcnet/pascalabcnet/issues/719","id":305583615,"number":719,"title":"Problem with overload method matching","user":{"login":"sglienke","id":6238697,"avatar_url":"https://avatars3.githubusercontent.com/u/6238697?v=4","gravatar_id":"","url":"https://api.github.com/users/sglienke","html_url":"https://github.com/sglienke","followers_url":"https://api.github.com/users/sglienke/followers","following_url":"https://api.github.com/users/sglienke/following{/other_user}","gists_url":"https://api.github.com/users/sglienke/gists{/gist_id}","starred_url":"https://api.github.com/users/sglienke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sglienke/subscriptions","organizations_url":"https://api.github.com/users/sglienke/orgs","repos_url":"https://api.github.com/users/sglienke/repos","events_url":"https://api.github.com/users/sglienke/events{/privacy}","received_events_url":"https://api.github.com/users/sglienke/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-03-15T14:47:52Z","updated_at":"2018-03-15T16:40:46Z","closed_at":"2018-03-15T15:48:43Z","author_association":"NONE","body":"I encountered two different issues with generic overload method matching. (Version 3.3.5 build 1636)\r\n\r\nI am using System.Reactive 4.0.0-preview00001 from nuget\r\n\r\nThe first one:\r\n\r\n```\r\n{$reference 'System.Reactive.dll'}\r\n\r\nuses\r\n  System,\r\n  System.Reactive.Linq;\r\n  \r\nbegin\r\n  Observable.Range(1, 10).Subscribe(Console.WriteLine);\r\nend.\r\n```\r\n\r\nThis gives:\r\nReactive.pas(8) : The best overloaded method match for 'Subscribe' has some invalid arguments\r\n\r\nBut in fact Console.WriteLine has an overload that matches one of the Subscribe overloads (the one with the onNext parameter)\r\n\r\nThis however works: Subscribe(x -> Writeln(x));\r\n\r\n\r\nThe second is this one:\r\n\r\n```\r\n{$reference 'System.Reactive.dll'}\r\n\r\nuses\r\n  System,\r\n  System.Reactive.Linq;\r\n  \r\nbegin\r\n  var x := Observable.Interval(TimeSpan.FromMilliseconds(1000)).StartWith(0);\r\n  Readln;\r\nend.\r\n```\r\n\r\nWhere I get: \r\nReactive.pas(8) : Cannot call the generic function 'StartWith' with these arguments\r\n\r\nHowever since Observable.Interval returns an IObservable<Int64> and the StartWith extension method has the overload with params: array of T (where T is in this case Int64) it should find this.\r\n\r\nthis however works: StartWith(Int64(0));\r\n\r\nWhen writing this it also works as Range returns `IObservable<Integer>`;\r\n\r\nObservable.Range(1, 10).StartWith(0)"},"comment":{"url":"https://api.github.com/repos/pascalabcnet/pascalabcnet/issues/comments/373442473","html_url":"https://github.com/pascalabcnet/pascalabcnet/issues/719#issuecomment-373442473","issue_url":"https://api.github.com/repos/pascalabcnet/pascalabcnet/issues/719","id":373442473,"user":{"login":"sglienke","id":6238697,"avatar_url":"https://avatars3.githubusercontent.com/u/6238697?v=4","gravatar_id":"","url":"https://api.github.com/users/sglienke","html_url":"https://github.com/sglienke","followers_url":"https://api.github.com/users/sglienke/followers","following_url":"https://api.github.com/users/sglienke/following{/other_user}","gists_url":"https://api.github.com/users/sglienke/gists{/gist_id}","starred_url":"https://api.github.com/users/sglienke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sglienke/subscriptions","organizations_url":"https://api.github.com/users/sglienke/orgs","repos_url":"https://api.github.com/users/sglienke/repos","events_url":"https://api.github.com/users/sglienke/events{/privacy}","received_events_url":"https://api.github.com/users/sglienke/received_events","type":"User","site_admin":false},"created_at":"2018-03-15T16:40:46Z","updated_at":"2018-03-15T16:40:46Z","author_association":"NONE","body":"Here is some more code to show the issue:\r\n\r\n```\r\ntype\r\n  IFoo<T> = interface\r\n    procedure Test1(action: T -> ());\r\n  end;\r\n  \r\nprocedure Test2<T>(Self: IFoo<T>; action: T -> ()); extensionmethod;\r\nbegin\r\nend;\r\n\r\nprocedure PrintIt(i:Integer);\r\nbegin\r\n  Writeln(i);\r\nend;\r\n\r\nprocedure PrintItInt(i:Integer);\r\nbegin\r\n  Writeln(i);\r\nend;\r\n\r\nprocedure PrintIt(i:string);\r\nbegin\r\n  Writeln(i);\r\nend;\r\n\r\nvar\r\n  foo: IFoo<Integer>;\r\nbegin\r\n  foo.Test1(PrintIt); // works, properly selected int overload;\r\n  foo.Test2(PrintItInt); // works, explicitly put a non overloaded routine\r\n  \r\n  // does not work\r\n  // extensionmethod seems to not properly select correct overload\r\n  // it knows that T is Integer because foo is IFoo<Integer>\r\n  foo.Test2(PrintIt); \r\nend.\r\n```"}}
{"actor":{"display_login":"sglienke"}}