internal void ComputeReturnType() { if (_lazyReturnTypeAndDiagnostics != null) { return; } var diagnostics = DiagnosticBag.GetInstance(); RefKind refKind; TypeSyntax returnTypeSyntax = _syntax.ReturnType.SkipRef(out refKind); TypeSymbol returnType = _binder.BindType(returnTypeSyntax, diagnostics); if (IsAsync && returnType.SpecialType != SpecialType.System_Void && !returnType.IsNonGenericTaskType(_binder.Compilation) && !returnType.IsGenericTaskType(_binder.Compilation)) { // The return type of an async method must be void, Task or Task<T> diagnostics.Add(ErrorCode.ERR_BadAsyncReturn, this.Locations[0]); } if (refKind != RefKind.None && returnType.SpecialType == SpecialType.System_Void) { Debug.Assert(returnTypeSyntax.HasErrors); } var value = new ReturnTypeAndDiagnostics(returnType, diagnostics.ToReadOnlyAndFree()); Interlocked.CompareExchange(ref _lazyReturnTypeAndDiagnostics, value, null); }