{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/27070","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/27070/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/27070/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/27070/events","html_url":"https://github.com/dart-lang/sdk/issues/27070","id":170964286,"node_id":"MDU6SXNzdWUxNzA5NjQyODY=","number":27070,"title":"Allow abstract getters/setters to override fields","user":{"login":"stereotype441","id":306375,"node_id":"MDQ6VXNlcjMwNjM3NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/306375?v=4","gravatar_id":"","url":"https://api.github.com/users/stereotype441","html_url":"https://github.com/stereotype441","followers_url":"https://api.github.com/users/stereotype441/followers","following_url":"https://api.github.com/users/stereotype441/following{/other_user}","gists_url":"https://api.github.com/users/stereotype441/gists{/gist_id}","starred_url":"https://api.github.com/users/stereotype441/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stereotype441/subscriptions","organizations_url":"https://api.github.com/users/stereotype441/orgs","repos_url":"https://api.github.com/users/stereotype441/repos","events_url":"https://api.github.com/users/stereotype441/events{/privacy}","received_events_url":"https://api.github.com/users/stereotype441/received_events","type":"User","site_admin":false},"labels":[{"id":334171875,"node_id":"MDU6TGFiZWwzMzQxNzE4NzU=","url":"https://api.github.com/repos/dart-lang/sdk/labels/P2%20medium","name":"P2 medium","color":"fbca04","default":false},{"id":334529063,"node_id":"MDU6TGFiZWwzMzQ1MjkwNjM=","url":"https://api.github.com/repos/dart-lang/sdk/labels/Type:%20bug","name":"Type: bug","color":"ededed","default":false},{"id":269672814,"node_id":"MDU6TGFiZWwyNjk2NzI4MTQ=","url":"https://api.github.com/repos/dart-lang/sdk/labels/analyzer-strong-mode","name":"analyzer-strong-mode","color":"d4c5f9","default":false},{"id":219928186,"node_id":"MDU6TGFiZWwyMTk5MjgxODY=","url":"https://api.github.com/repos/dart-lang/sdk/labels/area-analyzer","name":"area-analyzer","color":"c7def8","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-12T21:39:06Z","updated_at":"2018-06-21T13:29:51Z","closed_at":"2018-06-21T13:29:51Z","author_association":"MEMBER","body":"I recently tried to write some code like this:\n\n``` dart\n    class Base {\n      bool b = false;\n    }\n\n    abstract class Mixin {\n      bool get b;\n      void f() {\n        useValueOf(b);\n      }\n    }\n\n    class Derived extends Base with Mixin {\n      void g() {\n        b = true;\n        f();\n      }\n    }\n```\n\nThis resulted in a strong mode error, since the abstract getter `bool get b` technically overrides the field `bool b = false`.\n\nI think in this particular case it would be ok to permit this, since the purpose of the error is to ensure that DDC can safely compile code that accesses the field directly, without danger that a derived class will override the field with getters/setters.  In this case there's no danger, because the \"overriding\" getter is abstract, so code in Derived that refers to `b` is still referring to the field.\n\nWould it be possible to change the rule from \"fields can't be overridden\" to \"fields can't be concretely overridden\"?\n"},"comment":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/comments/399103854","html_url":"https://github.com/dart-lang/sdk/issues/27070#issuecomment-399103854","issue_url":"https://api.github.com/repos/dart-lang/sdk/issues/27070","id":399103854,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTEwMzg1NA==","user":{"login":"srawlins","id":103167,"node_id":"MDQ6VXNlcjEwMzE2Nw==","avatar_url":"https://avatars3.githubusercontent.com/u/103167?v=4","gravatar_id":"","url":"https://api.github.com/users/srawlins","html_url":"https://github.com/srawlins","followers_url":"https://api.github.com/users/srawlins/followers","following_url":"https://api.github.com/users/srawlins/following{/other_user}","gists_url":"https://api.github.com/users/srawlins/gists{/gist_id}","starred_url":"https://api.github.com/users/srawlins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srawlins/subscriptions","organizations_url":"https://api.github.com/users/srawlins/orgs","repos_url":"https://api.github.com/users/srawlins/repos","events_url":"https://api.github.com/users/srawlins/events{/privacy}","received_events_url":"https://api.github.com/users/srawlins/received_events","type":"User","site_admin":false},"created_at":"2018-06-21T13:29:51Z","updated_at":"2018-06-21T13:29:51Z","author_association":"MEMBER","body":"The dartanalyzer no longer produces an error for the above code:\r\n\r\n```\r\n$ dartanalyzer --version\r\ndartanalyzer version 2.0.0-dev.63.0\r\n$ cat 27070.dart \r\nclass Base {\r\n      bool b = false;\r\n    }\r\n\r\n    abstract class Mixin {\r\n      bool get b;\r\n      void f() {\r\n        useValueOf(b);\r\n      }\r\n\r\n      useValueOf(bool bb) { }\r\n    }\r\n\r\n    class Derived extends Base with Mixin {\r\n      void g() {\r\n        b = true;\r\n        f();\r\n      }\r\n    }\r\n$ dartanalyzer --preview-dart-2 27070.dart \r\nAnalyzing 27070.dart...\r\nNo issues found!\r\n$ dartanalyzer --preview-dart-2 --strong 27070.dart \r\nAnalyzing 27070.dart...\r\nNo issues found!"}}
{"actor":{"display_login":"srawlins"}}