-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Debug Assertion error ConversionsBase.ClassifyImplicitExtensionMethodThisArgConversion #73342
Comments
@jaredpar can't we simply change: (object)sourceExpressionOpt.Type == sourceType to: TypeSymbol.Equals(sourceExpressionOpt.Type, sourceType) And if not - why? |
Agreed with Jared. We need to actually investigate this, not just casually change the assert. |
I've stumbled upon this as well during the first-class span work: #74002 (comment) - I needed to change to TypeSymbol.Equals as well but then I reverted that when no longer needed due to other changes. The problem I had seems the same as here - NullableWalker passes equivalent types but not the same instances. We could try changing NullableWalker instead. In general, I don't see why this assert should be |
Not sure if it helps, but here you can see all allocations of For me I see no reason why object-identity is guaranteed for substited type symbols or type symbols in general (NamedTypeSymbol.Construct calls would need to look for an already instantiated version - which would require synchronization...)
|
On the other hand: using System;
using System.Collections.Generic;
var buffer = new Buffer<int>().Fill(5).Fill(3);
public struct Buffer<T>
{
private T _element0;
public IEnumerator<T> GetEnumerator()
{
yield return _element0;
}
public T this[int i]
{
get { return _element0; }
set { _element0 = value; }
}
}
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;
}
} this code does not trigger the assert... |
Any progress here? |
This is on the backlog without an assignee. No one has done any further investigation on this. |
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: