{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/dev_compiler/issues/105","labels_url":"https://api.github.com/repos/dart-lang/dev_compiler/issues/105/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/dev_compiler/issues/105/comments","events_url":"https://api.github.com/repos/dart-lang/dev_compiler/issues/105/events","html_url":"https://github.com/dart-lang/dev_compiler/issues/105","id":64598045,"number":105,"title":"Infer parameter types","user":{"login":"jacob314","id":1226812,"avatar_url":"https://avatars.githubusercontent.com/u/1226812?v=3","gravatar_id":"","url":"https://api.github.com/users/jacob314","html_url":"https://github.com/jacob314","followers_url":"https://api.github.com/users/jacob314/followers","following_url":"https://api.github.com/users/jacob314/following{/other_user}","gists_url":"https://api.github.com/users/jacob314/gists{/gist_id}","starred_url":"https://api.github.com/users/jacob314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacob314/subscriptions","organizations_url":"https://api.github.com/users/jacob314/orgs","repos_url":"https://api.github.com/users/jacob314/repos","events_url":"https://api.github.com/users/jacob314/events{/privacy}","received_events_url":"https://api.github.com/users/jacob314/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-26T18:11:59Z","updated_at":"2015-03-26T22:51:05Z","closed_at":null,"body":"Currently we infer return types but not parameter types.\r\nWe will have an easiest to explain story for users if we infer both.\r\n\r\nExample errors currently reported if parameter types are omitted in a subclass. Technically these errors shouldn't occur but in practice I think they are good as they match the user intent that a subclass rarely intentionally uses a less specific type than the base class.\r\n\r\n```\r\nsevere: line 9, column 3 of package:angular/change_detection/prototype_map.dart: [InvalidMethodOverride] Invalid override. The type of PrototypeMap.[]= ((dynamic, dynamic) → void) is not a subtype of Map<K, V>.[]= ((K, V) → void).\r\n  void operator []=(name, value) {\r\n  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nsevere: line 22, column 3 of package:angular/change_detection/prototype_map.dart: [InvalidMethodOverride] Invalid override. The type of PrototypeMap.forEach ((dynamic) → void) is not a subtype of Map<K, V>.forEach (((K, V) → void) → void).\r\n  void forEach(fn) {\r\n```\r\nRepro source code diff to fix these errors:\r\nFor example, consider the following diff required to fix:\r\n```diff\r\n   PrototypeMap(this.prototype);\r\n \r\n-  void operator []=(name, value) {\r\n+  void operator []=(K name, V value) {\r\n     self[name] = value;\r\n   }\r\n-  V operator [](name) => self.containsKey(name) ? self[name] : prototype[name];\r\n+  V operator [](Object name) => self.containsKey(name) ? self[name] : prototype[name];\r\n \r\n   bool get isEmpty => self.isEmpty && prototype.isEmpty;\r\n   bool get isNotEmpty => self.isNotEmpty || prototype.isNotEmpty;\r\n @@ -19,21 +19,21 @@ class PrototypeMap<K, V> implements Map<K,V> {\r\n   Iterable<V> get values => self.values;\r\n   int get length => self.length;\r\n \r\n-  void forEach(fn) {\r\n+  void forEach(void fn(K key, V value)) {\r\n     // todo(vbe) include prototype ?\r\n     self.forEach(fn);\r\n   }\r\n-  V remove(key) => self.remove(key);\r\n+  V remove(Object key) => self.remove(key);\r\n   clear() => self.clear;\r\n   // todo(vbe) include prototype ?\r\n-  bool containsKey(key) => self.containsKey(key);\r\n+  bool containsKey(Object key) => self.containsKey(key);\r\n   // todo(vbe) include prototype ?\r\n-  bool containsValue(key) => self.containsValue(key);\r\n-  void addAll(map) {\r\n+  bool containsValue(Object value) => self.containsValue(value);\r\n+  void addAll(Map<K, V> map) {\r\n     self.addAll(map);\r\n   }\r\n   // todo(vbe) include prototype ?\r\n-  V putIfAbsent(key, fn) => self.putIfAbsent(key, fn);\r\n+  V putIfAbsent(K key, V fn()) => self.putIfAbsent(key, fn);\r\n \r\n   toString() => self.toString();\r\n }\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/dart-lang/dev_compiler/issues/comments/86744771","html_url":"https://github.com/dart-lang/dev_compiler/issues/105#issuecomment-86744771","issue_url":"https://api.github.com/repos/dart-lang/dev_compiler/issues/105","id":86744771,"user":{"login":"vsmenon","id":2119553,"avatar_url":"https://avatars.githubusercontent.com/u/2119553?v=3","gravatar_id":"","url":"https://api.github.com/users/vsmenon","html_url":"https://github.com/vsmenon","followers_url":"https://api.github.com/users/vsmenon/followers","following_url":"https://api.github.com/users/vsmenon/following{/other_user}","gists_url":"https://api.github.com/users/vsmenon/gists{/gist_id}","starred_url":"https://api.github.com/users/vsmenon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsmenon/subscriptions","organizations_url":"https://api.github.com/users/vsmenon/orgs","repos_url":"https://api.github.com/users/vsmenon/repos","events_url":"https://api.github.com/users/vsmenon/events{/privacy}","received_events_url":"https://api.github.com/users/vsmenon/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T22:51:04Z","updated_at":"2015-03-26T22:51:04Z","body":"One counterexample of sorts:\r\n\r\nclass A {\r\n  void foo(x) { ... }\r\n}\r\n\r\nclass B {\r\n  void foo(T x) { ... }\r\n}\r\n\r\nOur current behavior allows this.  Typing foo as Object->void would not.\r\n"}}