{"action":"opened","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/32903","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/32903/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/32903/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/32903/events","html_url":"https://github.com/dart-lang/sdk/issues/32903","id":314900683,"number":32903,"title":"Dartanalyzer 2.0 incorrectly throws type_argument_not_matching_bounds error for super-bounded types in preview-dart-2 mode","user":{"login":"iarkh","id":3447532,"avatar_url":"https://avatars0.githubusercontent.com/u/3447532?v=4","gravatar_id":"","url":"https://api.github.com/users/iarkh","html_url":"https://github.com/iarkh","followers_url":"https://api.github.com/users/iarkh/followers","following_url":"https://api.github.com/users/iarkh/following{/other_user}","gists_url":"https://api.github.com/users/iarkh/gists{/gist_id}","starred_url":"https://api.github.com/users/iarkh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iarkh/subscriptions","organizations_url":"https://api.github.com/users/iarkh/orgs","repos_url":"https://api.github.com/users/iarkh/repos","events_url":"https://api.github.com/users/iarkh/events{/privacy}","received_events_url":"https://api.github.com/users/iarkh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-17T04:26:00Z","updated_at":"2018-04-17T04:26:00Z","closed_at":null,"author_association":"NONE","body":"Dart SDK Version: `2.0.0-dev.48.0 `\r\nOS: `Windows 10`\r\n\r\nDart 2.0 Super Bounded Types Spec  reads:\r\n\r\n> The feature described here, super-bounded types, consists in allowing an actual type argument to be a supertype of the declared bound, as long as a consistent replacement of `Object`, `dynamic`, and `void `by `Null `produces a traditional, well-bounded type. For example, if a class `C` takes a type argument `X` which must extend` C<X>`, `C<Object>`, `C<dynamic>`, and `C<void>` are correct super-bounded types.\r\n> We extend covariance for generic class types such that it can be used also in cases where a type argument violates the corresponding bound.\r\n> For instance, assuming the classes `C` and `D` as declared in the Motivation section, `C<D>` is a subtype of `C<Object>`. This is new because` C<Object>` used to be a compile-time error, which means that no questions could be asked about its properties. Note that this is a straightforward application of the usual covariance rule: `C<D> <: C<Object>` because `D <: Object`. We need this relaxation of the rules in order to be able to define which violations of the declared bounds are admissible.\r\n\r\nThis means that constructions like `C<dynamic> c0 = ...` now should be allowed in strong mode for bounded types like `class C<X extends C<X>>`.\r\n\r\nHowever, this is not so. For example, the following code sample:\r\n```\r\nclass C<X extends C<X>> {}\r\nclass D extends C<D> {}\r\nmain() { C<dynamic> c = new D(); }\r\n```\r\nproduces `type_argument_not_matching_bounds` error:\r\n```\r\n$> dartanalyzer --preview-dart-2 test.dart\r\nAnalyzing test.dart...\r\n  error - 'dynamic' doesn't extend 'C' at test.dart:3:12 - type_argument_not_matching_bounds\r\n  hint - The value of the local variable 'c' isn't used at test.dart:3:21 - unused_local_variable\r\n1 error and 1 hint found.\r\n```\r\n"}}
{"actor":{"display_login":"iarkh"}}