You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From: @cston
Sent: Friday, January 19, 2018 2:32 PM
Subject: RE: Lookup of custom AsyncMethodBuilder members should check type parameter constraints
After several hallway discussions, we’re converging on the following approach:
For well-known generic types and methods introduced in the compiler for C#7.0 or later, the compiler will check any and all constraints when substituting type arguments at each use-site. The compiler will not require any specific constraints for well-known types or methods though. There will be no change for well-known types and methods added to the compiler before C#7.0 – that is, the compiler will continue to ignore any constraints at the use-site for those types and methods.
Generic types and methods from C#7.0 or later:
Generic types:
System.ValueTuple<T1, …>
Custom Task method builder
Span
ReadOnlySpan
Generic methods:
5. Custom Task and Task method builders:
a. Start(ref TStateMachine)
b. AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter, ref TStateMachine)
c. AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter, ref TStateMachine)
For 15.6, I’ll look at checking constraints for #5 only since we have an existing bug (#21500). For the other cases, the generic types, I’ll open 15.7 bugs to check constraints. And for any well-known types or members added to future releases of the compiler, constraint checking should be added at the time the well-known member is added to the compiler.
The text was updated successfully, but these errors were encountered:
Associated with #24322, the following new guidelines should be documented in https://github.com/dotnet/roslyn/tree/master/docs/compilers/Design
The text was updated successfully, but these errors were encountered: