{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/27622","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/27622/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/27622/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/27622/events","html_url":"https://github.com/dart-lang/sdk/issues/27622","id":184089092,"number":27622,"title":"implicit-downcasts in analysis_options doesn't work","user":{"login":"nex3","id":188,"avatar_url":"https://avatars.githubusercontent.com/u/188?v=3","gravatar_id":"","url":"https://api.github.com/users/nex3","html_url":"https://github.com/nex3","followers_url":"https://api.github.com/users/nex3/followers","following_url":"https://api.github.com/users/nex3/following{/other_user}","gists_url":"https://api.github.com/users/nex3/gists{/gist_id}","starred_url":"https://api.github.com/users/nex3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nex3/subscriptions","organizations_url":"https://api.github.com/users/nex3/orgs","repos_url":"https://api.github.com/users/nex3/repos","events_url":"https://api.github.com/users/nex3/events{/privacy}","received_events_url":"https://api.github.com/users/nex3/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dart-lang/sdk/labels/analyzer-command","name":"analyzer-command","color":"d4c5f9"},{"url":"https://api.github.com/repos/dart-lang/sdk/labels/analyzer-strong-mode","name":"analyzer-strong-mode","color":"d4c5f9"},{"url":"https://api.github.com/repos/dart-lang/sdk/labels/area-analyzer","name":"area-analyzer","color":"c7def8"},{"url":"https://api.github.com/repos/dart-lang/sdk/labels/P2%20medium","name":"P2 medium","color":"fbca04"},{"url":"https://api.github.com/repos/dart-lang/sdk/labels/Type:%20bug","name":"Type: bug","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-10-19T22:21:04Z","updated_at":"2016-10-19T23:11:49Z","closed_at":null,"body":"If I have the following `.analysis_options` file:\r\n\r\n```yaml\r\nanalyzer:\r\n  strong-mode:\r\n  - implicit-downcasts: false\r\n  - implicit-dynamic: false\r\n```\r\n\r\nand the following Dart file (taken from [this example](https://www.dartlang.org/guides/language/analysis-options)):\r\n\r\n```dart\r\n// test.dart\r\n\r\nvoid main() {\r\n  Object o = new Object();\r\n  String s = o;  // Implicit downcast\r\n  String s2 = s.substring(1);\r\n}\r\n```\r\n\r\nand I run `dartanalyzer test.dart`, it only reports:\r\n\r\n```\r\n[hint] The value of the local variable 's2' is not used\r\n```\r\n\r\nThe same is true if I run `dartanalyzer --strong --no-implicit-casts test.dart`. However, if I delete `.analysis_options` and run `dartanalyzer --strong --no-implicit-casts test.dart`, I get:\r\n\r\n```\r\n[error] A value of type 'Object' cannot be assigned to a variable of type 'String'\r\n[hint] The value of the local variable 's2' is not used\r\n```\r\n\r\nI've tested this against Dart 1.20.1 and 1.19.0. I think the `implicit-dynamic` flag has the same issue, but I don't know of a simple file to test it on."},"comment":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/comments/254967338","html_url":"https://github.com/dart-lang/sdk/issues/27622#issuecomment-254967338","issue_url":"https://api.github.com/repos/dart-lang/sdk/issues/27622","id":254967338,"user":{"login":"nex3","id":188,"avatar_url":"https://avatars.githubusercontent.com/u/188?v=3","gravatar_id":"","url":"https://api.github.com/users/nex3","html_url":"https://github.com/nex3","followers_url":"https://api.github.com/users/nex3/followers","following_url":"https://api.github.com/users/nex3/following{/other_user}","gists_url":"https://api.github.com/users/nex3/gists{/gist_id}","starred_url":"https://api.github.com/users/nex3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nex3/subscriptions","organizations_url":"https://api.github.com/users/nex3/orgs","repos_url":"https://api.github.com/users/nex3/repos","events_url":"https://api.github.com/users/nex3/events{/privacy}","received_events_url":"https://api.github.com/users/nex3/received_events","type":"User","site_admin":false},"created_at":"2016-10-19T23:11:49Z","updated_at":"2016-10-19T23:11:49Z","body":"> ```dart\r\n> class C {\r\n>   int x() => 0;\r\n> }\r\n> class D extends C {\r\n>   Object x() => 'hi'; // strong mode: invalid override\r\n> }\r\n> ```\r\n\r\nIf I analyze this with `dartanalyzer` and the `.analysis_options` file listed above, it emits no errors. Same if I replace `implicit-downcasts` with `implicit-casts`."}}
{"actor":{"display_login":"nex3"}}