{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/26993","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/26993/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/26993/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/26993/events","html_url":"https://github.com/dart-lang/sdk/issues/26993","id":168472035,"number":26993,"title":"Strong mode error when constant has inferred type parameter bound","user":{"login":"stereotype441","id":306375,"avatar_url":"https://avatars.githubusercontent.com/u/306375?v=3","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":[{"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/P1%20high","name":"P1 high","color":"eb6420"},{"url":"https://api.github.com/repos/dart-lang/sdk/labels/Type:%20bug","name":"Type: bug","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"jmesserly","id":1081711,"avatar_url":"https://avatars.githubusercontent.com/u/1081711?v=3","gravatar_id":"","url":"https://api.github.com/users/jmesserly","html_url":"https://github.com/jmesserly","followers_url":"https://api.github.com/users/jmesserly/followers","following_url":"https://api.github.com/users/jmesserly/following{/other_user}","gists_url":"https://api.github.com/users/jmesserly/gists{/gist_id}","starred_url":"https://api.github.com/users/jmesserly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmesserly/subscriptions","organizations_url":"https://api.github.com/users/jmesserly/orgs","repos_url":"https://api.github.com/users/jmesserly/repos","events_url":"https://api.github.com/users/jmesserly/events{/privacy}","received_events_url":"https://api.github.com/users/jmesserly/received_events","type":"User","site_admin":false},"assignees":[{"login":"jmesserly","id":1081711,"avatar_url":"https://avatars.githubusercontent.com/u/1081711?v=3","gravatar_id":"","url":"https://api.github.com/users/jmesserly","html_url":"https://github.com/jmesserly","followers_url":"https://api.github.com/users/jmesserly/followers","following_url":"https://api.github.com/users/jmesserly/following{/other_user}","gists_url":"https://api.github.com/users/jmesserly/gists{/gist_id}","starred_url":"https://api.github.com/users/jmesserly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmesserly/subscriptions","organizations_url":"https://api.github.com/users/jmesserly/orgs","repos_url":"https://api.github.com/users/jmesserly/repos","events_url":"https://api.github.com/users/jmesserly/events{/privacy}","received_events_url":"https://api.github.com/users/jmesserly/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-07-30T15:15:43Z","updated_at":"2016-08-01T16:01:12Z","closed_at":null,"body":"The following code:\r\n```dart\r\n    class C<T extends num> {\r\n      final T x;\r\n      const C(this.x);\r\n    }\r\n    void f() {\r\n      const x = const C(0);\r\n    }\r\n```\r\nGenerates the strong mode error `The object type 'C<num>' cannot be assigned to a variable of type 'C<int>'`.  The problem may be worked around by specifying the type explicitly, e.g. `const x = const C<int>(0);`, or `const x = const C<num>(0);`."},"comment":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/comments/236624830","html_url":"https://github.com/dart-lang/sdk/issues/26993#issuecomment-236624830","issue_url":"https://api.github.com/repos/dart-lang/sdk/issues/26993","id":236624830,"user":{"login":"jmesserly","id":1081711,"avatar_url":"https://avatars.githubusercontent.com/u/1081711?v=3","gravatar_id":"","url":"https://api.github.com/users/jmesserly","html_url":"https://github.com/jmesserly","followers_url":"https://api.github.com/users/jmesserly/followers","following_url":"https://api.github.com/users/jmesserly/following{/other_user}","gists_url":"https://api.github.com/users/jmesserly/gists{/gist_id}","starred_url":"https://api.github.com/users/jmesserly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmesserly/subscriptions","organizations_url":"https://api.github.com/users/jmesserly/orgs","repos_url":"https://api.github.com/users/jmesserly/repos","events_url":"https://api.github.com/users/jmesserly/events{/privacy}","received_events_url":"https://api.github.com/users/jmesserly/received_events","type":"User","site_admin":false},"created_at":"2016-08-01T16:01:12Z","updated_at":"2016-08-01T16:01:12Z","body":"good catch. that's bonkers. It looks like an early stage of inference concluded `C<int>` which is correct, and then something later on blew that away and replaced it with the implicit `C<num>` instantiation. Off hand I have no idea what could cause that. Did it happen in an editing scenario or just straight up CLI?\r\n\r\nOne other guess is we're setting the inferred type in one place in the AST but not in some other place. For InstanceCreationExpression the type ends up in a bunch of places, so maybe there's some inconsistency in the resulting AST leading to some code to see one type and some other code to see a different type."}}
{"actor":{"display_login":"jmesserly"}}