{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/27284","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/27284/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/27284/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/27284/events","html_url":"https://github.com/dart-lang/sdk/issues/27284","id":175887148,"number":27284,"title":"generic method downwards inference doesn't preserve future-unions","user":{"login":"srawlins","id":103167,"avatar_url":"https://avatars.githubusercontent.com/u/103167?v=3","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},"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/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":2,"created_at":"2016-09-08T23:07:17Z","updated_at":"2016-09-09T00:26:56Z","closed_at":null,"body":"Please forgive my terminology in the title, and correct as needed.\r\n\r\nHere's an example:\r\n\r\n```dart\r\nimport 'dart:async';\r\n\r\n/*=T*/ x/*<T>*/(/*=T*/ f()) => f();\r\n\r\nmain() async {\r\n  Future<String> c() => new Future<String>.value('Hey');\r\n\r\n  // Srtong mode error here.\r\n  String s = await x(c);\r\n  print(s);\r\n\r\n  // But not here.\r\n  Future<String> temp = x(c);\r\n  String s2 = await temp;\r\n  print(s2);\r\n}\r\n```\r\n\r\nHere's analyzer output:\r\n\r\n```\r\n$ xcodebuild/ReleaseX64/dart-sdk/bin/dartanalyzer --strong b.dart\r\nAnalyzing [b.dart]...\r\n[error] Could not infer type parameter T, Future<String> must be of type String. (/Users/srawlins/code/dart-repo3/sdk/b.dart, line 9, col 20)\r\n[error] The argument type '() → Future<String>' cannot be assigned to the parameter type '() → String'. (/Users/srawlins/code/dart-repo3/sdk/b.dart, line 9, col 22)\r\n2 errors found.\r\n```\r\n\r\nSo analyzer says \"Hey `x` is going to return the same type as `c` (`Future<String>`), but you're assigning to String. Boo.\"\r\n\r\nThis is at this code: https://github.com/dart-lang/sdk/tree/e976e692be5fcd33a69d11269d9b0d59f14d2838"},"comment":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/comments/245783937","html_url":"https://github.com/dart-lang/sdk/issues/27284#issuecomment-245783937","issue_url":"https://api.github.com/repos/dart-lang/sdk/issues/27284","id":245783937,"user":{"login":"srawlins","id":103167,"avatar_url":"https://avatars.githubusercontent.com/u/103167?v=3","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":"2016-09-09T00:26:56Z","updated_at":"2016-09-09T00:26:56Z","body":"Interesting. I'm happy to let this close if that's the only possible action today (and I'm happy to leave open for others).\r\n\r\nI'll note though that the workaround doesn't look great. If I stumbled across `Future<A> fa = x(); A a = await fa;`, I would thoroughly furrow my brow.\r\n\r\nLooks like the union types issue is #4938."}}
{"actor":{"display_login":"srawlins"}}