Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow async methods to return Task-like types #12518

Merged
merged 1 commit into from Jul 19, 2016

Conversation

cston
Copy link
Member

@cston cston commented Jul 14, 2016

Allow async methods to return types other than void, Task, or Task<T>. Specifically allow Task-like types (and AsyncMethodBuilder types) if the types contain the expected set of members.

[Based on Lucian's prototype from features/async-return.]

Ported PR from master: #12434. I will follow up on existing feedback from that PR, making changes here.

@cston
Copy link
Member Author

cston commented Jul 14, 2016

@ljw1004, @dotnet/roslyn-compiler please review

case SymbolKind.ArrayType:
// PROTOTYPE(tasklike): Use VisitType or similar to cover all cases.
break;
{
Copy link
Contributor

@ljw1004 ljw1004 Jul 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think arrays, tuples and generics are the only constructed types. We'll have to make sure it works with Tuples. Whose job is that? (other than that, LGTM)

@jcouv
Copy link
Member

jcouv commented Jul 15, 2016

Starting review. Sorry for the delay.

@@ -660,6 +660,7 @@ Microsoft.CodeAnalysis.Semantics.UnaryOperationKind.UnsignedPrefixIncrement = 77
abstract Microsoft.CodeAnalysis.Diagnostics.OperationBlockStartAnalysisContext.RegisterOperationAction(System.Action<Microsoft.CodeAnalysis.Diagnostics.OperationAnalysisContext> action, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.OperationKind> operationKinds) -> void
abstract Microsoft.CodeAnalysis.Diagnostics.OperationBlockStartAnalysisContext.RegisterOperationBlockEndAction(System.Action<Microsoft.CodeAnalysis.Diagnostics.OperationBlockAnalysisContext> action) -> void
abstract Microsoft.CodeAnalysis.SemanticModel.GetOperationCore(Microsoft.CodeAnalysis.SyntaxNode node, System.Threading.CancellationToken cancellationToken) -> Microsoft.CodeAnalysis.IOperation
const Microsoft.CodeAnalysis.WellKnownMemberNames.CreateAsyncMethodBuilder = "CreateAsyncMethodBuilder" -> string
Copy link
Member

@jcouv jcouv Jul 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only const I can find in shipped.txt and unshipped.txt. Do we really need it public?
Nevermind, I see similar public constants in src\Compilers\Core\Portable\PublicAPI.Shipped.txt ;-)

@jcouv
Copy link
Member

jcouv commented Jul 15, 2016

LGTM

@cston cston force-pushed the tasklike-p4 branch 2 times, most recently from 12b5d0b to 6c5c666 Compare July 19, 2016 14:41
@cston
Copy link
Member Author

cston commented Jul 19, 2016

@jcouv, @ljw1004 thanks for reviewing. The latest commit should cover all feedback.

@dotnet/roslyn-compiler please provide an additional review.

@MattGertz for approval.

@MattGertz
Copy link
Contributor

Approved pending the usual signoffs.

[Based on features/async-return with tests ported from that branch.]
@cston cston merged commit b828f42 into dotnet:dev15-preview-4 Jul 19, 2016
@cston cston deleted the tasklike-p4 branch July 19, 2016 21:18
@jaredpar
Copy link
Member

jaredpar commented Jul 19, 2016

Nice!!! 🎈 🎆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants