File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ internal TypedAsynchronicityHandling(
113113 ITypeSymbol type ,
114114
115115 // dependencies
116- WellKnownTypes wellKnownTypes ) : base ( ReturnTypeStatus . Ordinary , AsyncAwaitStatus . No )
116+ WellKnownTypes wellKnownTypes ) : base ( ReturnTypeStatus . Ordinary , AsyncAwaitStatus . Yes )
117117 {
118118 _type = type ;
119119 _wellKnownTypes = wellKnownTypes ;
@@ -175,7 +175,7 @@ internal sealed class VoidAsynchronicityHandling : AsynchronicityHandlingBase
175175
176176 internal VoidAsynchronicityHandling (
177177 // dependencies
178- WellKnownTypes wellKnownTypes ) : base ( ReturnTypeStatus . Ordinary , AsyncAwaitStatus . No )
178+ WellKnownTypes wellKnownTypes ) : base ( ReturnTypeStatus . Ordinary , AsyncAwaitStatus . Yes )
179179 {
180180 _wellKnownTypes = wellKnownTypes ;
181181 _valueTaskExisting = wellKnownTypes . ValueTask is not null ;
@@ -230,7 +230,7 @@ internal SomeTaskAsynchronicityHandling(
230230 INamedTypeSymbol someTaskType ,
231231
232232 // dependencies
233- WellKnownTypes wellKnownTypes ) : base ( ReturnTypeStatus . Ordinary , AsyncAwaitStatus . No )
233+ WellKnownTypes wellKnownTypes ) : base ( ReturnTypeStatus . Ordinary , AsyncAwaitStatus . Yes )
234234 {
235235 _someTaskType = someTaskType ;
236236 ReturnTypeStatus = wellKnownTypes . ValueTask1 is { } valueTaskType &&
Original file line number Diff line number Diff line change @@ -190,11 +190,14 @@ public override void Build(PassedContext passedContext)
190190 }
191191
192192 var asyncCallNodes = new List < IWrappedAsyncFunctionCallNode > ( ) ;
193+ var potentialTaskBasedEntryFunctions = new List < IFunctionNode > ( ) ;
193194 while ( BuildQueue . Count != 0 && BuildQueue . Dequeue ( ) is { } buildJob )
194195 {
195196 buildJob . Node . Build ( buildJob . PassedContext ) ;
196197 if ( buildJob . Node is IWrappedAsyncFunctionCallNode call )
197198 asyncCallNodes . Add ( call ) ;
199+ if ( buildJob . Node is IFunctionNode function and ( IEntryFunctionNode or ILocalFunctionNode ) )
200+ potentialTaskBasedEntryFunctions . Add ( function ) ;
198201 }
199202
200203 _currentExecutionPhaseSetter . Value = ExecutionPhase . ResolutionValidation ;
@@ -220,6 +223,13 @@ public override void Build(PassedContext passedContext)
220223
221224 foreach ( var delegateBaseNode in _delegateBaseNodes )
222225 delegateBaseNode . CheckSynchronicity ( ) ;
226+
227+ foreach ( var potentialTaskBasedEntryFunction in potentialTaskBasedEntryFunctions )
228+ {
229+ var returnTypeStatus = potentialTaskBasedEntryFunction . ReturnTypeStatus ;
230+ if ( returnTypeStatus . HasFlag ( ReturnTypeStatus . Task ) || returnTypeStatus . HasFlag ( ReturnTypeStatus . ValueTask ) )
231+ potentialTaskBasedEntryFunction . MakeTaskBasedToo ( ) ;
232+ }
223233 }
224234
225235 public override string ? ContainerReference => null ;
You can’t perform that action at this time.
0 commit comments