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
[Fact]publicvoidTestDebugAssert(){varcode= """
using System;
var buffer = new Buffer<int>().Fill(5).Fill(3);
[System.Runtime.CompilerServices.InlineArray(10)]
public struct Buffer<T>
{
private T _element0;
}
public static class BufferExtension
{
public static Buffer<T> Fill<T>(this Buffer<T> buf, T i)
{
int k = 0;
foreach (var _ in buf)
{
buf[k++] = i;
}
return buf;
}
}
""";varcomp= CreateCompilation(new[]{ code,}, parseOptions: TestOptions.Regular12, targetFramework: TargetFramework.Net80);
CompileAndVerify(comp);}
The object identity is not the same - but they represent the same generic instantiation:
// Spec 7.6.5.2: "An extension method ... is eligible if ... [an] implicit identity, reference,// or boxing conversion exists from expr to the type of the first parameter"public Conversion ClassifyImplicitExtensionMethodThisArgConversion(BoundExpressionsourceExpressionOpt,TypeSymbolsourceType,TypeSymboldestination,refCompoundUseSiteInfo<AssemblySymbol>useSiteInfo){
Debug.Assert(sourceExpressionOpt isnull|| Compilation is not null);
Debug.Assert(sourceExpressionOpt==null||(object)sourceExpressionOpt.Type ==sourceType);
Debug.Assert((object)destination !=null);
The text was updated successfully, but these errors were encountered:
Version Used: current
Steps to Reproduce:
Create and execute a Test method like:
Expected Behavior:
No error
Actual Behavior:
Additional Info
The object identity is not the same - but they represent the same generic instantiation:
The text was updated successfully, but these errors were encountered: