{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/dev_compiler/issues/350","labels_url":"https://api.github.com/repos/dart-lang/dev_compiler/issues/350/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/dev_compiler/issues/350/comments","events_url":"https://api.github.com/repos/dart-lang/dev_compiler/issues/350/events","html_url":"https://github.com/dart-lang/dev_compiler/issues/350","id":108370337,"number":350,"title":"task mode: field initializer inference is overriding explicit LHS type","user":{"login":"jmesserly","id":1081711,"avatar_url":"https://avatars.githubusercontent.com/u/1081711?v=3","gravatar_id":"","url":"https://api.github.com/users/jmesserly","html_url":"https://github.com/jmesserly","followers_url":"https://api.github.com/users/jmesserly/followers","following_url":"https://api.github.com/users/jmesserly/following{/other_user}","gists_url":"https://api.github.com/users/jmesserly/gists{/gist_id}","starred_url":"https://api.github.com/users/jmesserly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmesserly/subscriptions","organizations_url":"https://api.github.com/users/jmesserly/orgs","repos_url":"https://api.github.com/users/jmesserly/repos","events_url":"https://api.github.com/users/jmesserly/events{/privacy}","received_events_url":"https://api.github.com/users/jmesserly/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dart-lang/dev_compiler/labels/analyzer","name":"analyzer","color":"f7c6c7"},{"url":"https://api.github.com/repos/dart-lang/dev_compiler/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"leafpetersen","id":8484504,"avatar_url":"https://avatars.githubusercontent.com/u/8484504?v=3","gravatar_id":"","url":"https://api.github.com/users/leafpetersen","html_url":"https://github.com/leafpetersen","followers_url":"https://api.github.com/users/leafpetersen/followers","following_url":"https://api.github.com/users/leafpetersen/following{/other_user}","gists_url":"https://api.github.com/users/leafpetersen/gists{/gist_id}","starred_url":"https://api.github.com/users/leafpetersen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leafpetersen/subscriptions","organizations_url":"https://api.github.com/users/leafpetersen/orgs","repos_url":"https://api.github.com/users/leafpetersen/repos","events_url":"https://api.github.com/users/leafpetersen/events{/privacy}","received_events_url":"https://api.github.com/users/leafpetersen/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-09-25T17:18:07Z","updated_at":"2015-09-26T01:45:38Z","closed_at":null,"body":"From @vsmenon's [comment](https://github.com/dart-lang/dev_compiler/issues/342#issuecomment-142446581):\r\n> For the field type inference issue, we're seeing extra casts like:\r\n> ```js\r\nZone._current = dart.as(zone, _RootZone);\r\n```\r\n> even though _current is declared in Dart as:\r\n> ```dart\r\n  static Zone _current = _ROOT_ZONE;\r\n```\r\n> It appears that the rhs expression type is incorrectly overriding the lhs declared type.\r\n\r\nI've also seen this in 'casts in constant contexts' in checker test:\r\n```dart\r\n          class A {\r\n            static const num n = 3.0;\r\n            static const int i = /*info:AssignmentCast*/n;\r\n            final int fi;\r\n            const A(num a) : this.fi = /*info:DownCastImplicit*/a;\r\n          }\r\n          class B extends A {\r\n            const B(Object a) : super(/*info:DownCastImplicit*/a);\r\n          }\r\n          void foo(Object o) {\r\n            var a = const A(/*info:DownCastImplicit*/o);\r\n          }\r\n```\r\n\r\nThe `i = n` initializer fails with a static type error because it thinks `n` is `double` instead of `num` like it should be.\r\n"},"comment":{"url":"https://api.github.com/repos/dart-lang/dev_compiler/issues/comments/143390196","html_url":"https://github.com/dart-lang/dev_compiler/issues/350#issuecomment-143390196","issue_url":"https://api.github.com/repos/dart-lang/dev_compiler/issues/350","id":143390196,"user":{"login":"jmesserly","id":1081711,"avatar_url":"https://avatars.githubusercontent.com/u/1081711?v=3","gravatar_id":"","url":"https://api.github.com/users/jmesserly","html_url":"https://github.com/jmesserly","followers_url":"https://api.github.com/users/jmesserly/followers","following_url":"https://api.github.com/users/jmesserly/following{/other_user}","gists_url":"https://api.github.com/users/jmesserly/gists{/gist_id}","starred_url":"https://api.github.com/users/jmesserly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmesserly/subscriptions","organizations_url":"https://api.github.com/users/jmesserly/orgs","repos_url":"https://api.github.com/users/jmesserly/repos","events_url":"https://api.github.com/users/jmesserly/events{/privacy}","received_events_url":"https://api.github.com/users/jmesserly/received_events","type":"User","site_admin":false},"created_at":"2015-09-26T01:45:38Z","updated_at":"2015-09-26T01:45:38Z","body":"@vsmenon and I can confirm this is fixed by https://codereview.chromium.org/1370793002/"}}