{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/33121","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/33121/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/33121/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/33121/events","html_url":"https://github.com/dart-lang/sdk/issues/33121","id":323024753,"number":33121,"title":"Dart2: Accidental \"<dynamic>.map\" will not reify types","user":{"login":"matanlurey","id":168174,"avatar_url":"https://avatars2.githubusercontent.com/u/168174?v=4","gravatar_id":"","url":"https://api.github.com/users/matanlurey","html_url":"https://github.com/matanlurey","followers_url":"https://api.github.com/users/matanlurey/followers","following_url":"https://api.github.com/users/matanlurey/following{/other_user}","gists_url":"https://api.github.com/users/matanlurey/gists{/gist_id}","starred_url":"https://api.github.com/users/matanlurey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matanlurey/subscriptions","organizations_url":"https://api.github.com/users/matanlurey/orgs","repos_url":"https://api.github.com/users/matanlurey/repos","events_url":"https://api.github.com/users/matanlurey/events{/privacy}","received_events_url":"https://api.github.com/users/matanlurey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-05-15T00:20:14Z","updated_at":"2018-05-15T21:00:57Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"_Filing under \"please lets fix this in Dart 2.1+\"._\r\n\r\nMigrating internal code to Dart2, I hit the following fun error case:\r\n\r\n```dart\r\nclass Link {\r\n  static Link parse(Map<String, dynamic> linkData) {\r\n    var userIds = linkData['userIds'].map((id) => int.parse(id));\r\n     return new Link(userIds: userIds.toList());\r\n  }\r\n\r\n  final List<int> userIds;\r\n  const Link({this.userIds});\r\n}\r\n```\r\n\r\n... throws ...\r\n\r\n`type 'List<dynamic>' is not a subtype of type 'List<int>'`\r\n\r\nHuh? Shouldn't this work:\r\n\r\n```\r\n  .map((id) => int.parse(id));\r\n```\r\n\r\nIt turns out, no! `.map` is a dcall, because `linkData['userIds']` is `dynamic`. DOH!\r\n\r\nWould `--no-implicit-dynamic` fix this? It seems like its an \"explicit dynamic\" (the map is typed of having values of type `dynamic` explicitly). It sounds like we'd need something strong_er_, i.e .`--no-dynamic-calls`.\r\n\r\n/cc @leafpetersen @lrhn "},"comment":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/comments/389311943","html_url":"https://github.com/dart-lang/sdk/issues/33121#issuecomment-389311943","issue_url":"https://api.github.com/repos/dart-lang/sdk/issues/33121","id":389311943,"user":{"login":"matanlurey","id":168174,"avatar_url":"https://avatars2.githubusercontent.com/u/168174?v=4","gravatar_id":"","url":"https://api.github.com/users/matanlurey","html_url":"https://github.com/matanlurey","followers_url":"https://api.github.com/users/matanlurey/followers","following_url":"https://api.github.com/users/matanlurey/following{/other_user}","gists_url":"https://api.github.com/users/matanlurey/gists{/gist_id}","starred_url":"https://api.github.com/users/matanlurey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matanlurey/subscriptions","organizations_url":"https://api.github.com/users/matanlurey/orgs","repos_url":"https://api.github.com/users/matanlurey/repos","events_url":"https://api.github.com/users/matanlurey/events{/privacy}","received_events_url":"https://api.github.com/users/matanlurey/received_events","type":"User","site_admin":false},"created_at":"2018-05-15T21:00:57Z","updated_at":"2018-05-15T21:00:57Z","author_association":"CONTRIBUTOR","body":"@leafpetersen:\r\n\r\n> One note is that in the IDE semantic highlighting can already help with this\r\n\r\nYes, this is the answer I've gotten for almost 5 years now. I actually ave it enabled myself, but:\r\n\r\n* It doesn't work in VS Code\r\n* It doesn't work in Cider (Internal Editor)\r\n* It doesn't work in GitHub, Gerrit, Critique, or Code Search\r\n\r\nOf course, it also doesn't catch refactors. I've hit cases internally quite a bit where I *used* to get back a say, `Future<Bar>`, but for whatever reason it was downgraded to a `Future<dynamic>`. My code keeps working, until it doesn't."}}
{"actor":{"display_login":"matanlurey"}}