{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/33119","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/33119/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/33119/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/33119/events","html_url":"https://github.com/dart-lang/sdk/issues/33119","id":323000051,"node_id":"MDU6SXNzdWUzMjMwMDAwNTE=","number":33119,"title":"Raw type signatures are scary in Dart2","user":{"login":"matanlurey","id":168174,"node_id":"MDQ6VXNlcjE2ODE3NA==","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":[{"id":219928175,"node_id":"MDU6TGFiZWwyMTk5MjgxNzU=","url":"https://api.github.com/repos/dart-lang/sdk/labels/area-language","name":"area-language","color":"c7def8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2018-05-14T22:11:35Z","updated_at":"2018-06-12T16:29:46Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"_Tangentially related to https://github.com/dart-lang/sdk/issues/31410._\r\n\r\nWhile migrating swaths of internal code (probably in the tens-of-thousands-of-lines, _myself_), one of the most common errors users are running into when migrating to Dart2 are so-called ~~\"naked\"~~ raw types ~~(is there a better name?)~~. For example:\r\n\r\n```dart\r\n// Works as the user intended.\r\n// List<int> x = <int>[1];\r\nvar x = [1];\r\n```\r\n\r\n```dart\r\n// Does _not_ work as the user intended.\r\n// List<dynamic> x = <dynamic>[1];\r\nList x = [1];\r\n```\r\n\r\nHere is a more extreme example:\r\n\r\n```dart\r\ntypedef Iterable<CacheEntry<K, V>> CacheEvictionFunction<K, V>(\r\n  List<CacheEntry<K, V>> entries, \r\n  int entriesToBeTrimmed,\r\n);\r\n\r\nclass CacheConfig {\r\n  // In Dart1 this was \"fine\".\r\n  // In Dart2 this fails, quite late, at runtime:\r\n  // \r\n  // CacheEvictionFunction<dynamic, dynamic> \"inferred\"\r\n  final CacheEvictionFunction _evictionImpl;\r\n\r\n  CacheConfig(this._evictionImpl);\r\n}\r\n```\r\n\r\n-----\r\n\r\nMy 🔥 take: In Dart 2 + some flag, \"raw\" types that are implicitly dynamic should:\r\n\r\n* Be a compile-time error (\"You must specify a type or <dynamic>\")\r\n* Work similar to Java's `<?>` (wildcard operator). That would mean:\r\n\r\n```dart\r\n// --no-implicit-dynamic\r\n//\r\n// List<int> x = <int>[1];\r\nList x = [1];\r\n```\r\n\r\n```dart\r\n// --no-implicit-dynamic\r\n//\r\n// Compile-time error: Must specify a type 'T' for List<T>\r\nList x;\r\n```\r\n\r\n```dart\r\n// --no-implicit-dynamic\r\n//\r\n// OK.\r\nList<dynamic> x;\r\n```\r\n\r\n... if we are accepting name nominations, I nominate `--strict-raw-types`."},"comment":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/comments/396652448","html_url":"https://github.com/dart-lang/sdk/issues/33119#issuecomment-396652448","issue_url":"https://api.github.com/repos/dart-lang/sdk/issues/33119","id":396652448,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjY1MjQ0OA==","user":{"login":"jonahwilliams","id":8975114,"node_id":"MDQ6VXNlcjg5NzUxMTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8975114?v=4","gravatar_id":"","url":"https://api.github.com/users/jonahwilliams","html_url":"https://github.com/jonahwilliams","followers_url":"https://api.github.com/users/jonahwilliams/followers","following_url":"https://api.github.com/users/jonahwilliams/following{/other_user}","gists_url":"https://api.github.com/users/jonahwilliams/gists{/gist_id}","starred_url":"https://api.github.com/users/jonahwilliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonahwilliams/subscriptions","organizations_url":"https://api.github.com/users/jonahwilliams/orgs","repos_url":"https://api.github.com/users/jonahwilliams/repos","events_url":"https://api.github.com/users/jonahwilliams/events{/privacy}","received_events_url":"https://api.github.com/users/jonahwilliams/received_events","type":"User","site_admin":false},"created_at":"2018-06-12T16:29:46Z","updated_at":"2018-06-12T16:29:46Z","author_association":"NONE","body":"Another case of a Flutter user hitting this: https://github.com/flutter/flutter/issues/18357"}}
{"actor":{"display_login":"jonahwilliams"}}