-
Notifications
You must be signed in to change notification settings - Fork 803
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
Implementing interface method returning byref<'t> cannot just throw #5776
Comments
Thanks, that definitely looks like a bug. |
It's by design. You can record a language suggestion if you like |
We'll have to strongly consider doing work here. Since both interface Ii<T>
{
int GetSpan(ReadOnlySpan<T> sp);
}
struct Y : Ii<int>
{
public int GetSpan(ReadOnlySpan<int> sp)
{
throw new Exception("Nope");
}
} |
Yes, it would make sense to do something here, though it is a bit of a corner case. It's shame .NET generics have this limitation on byref instanatiations. |
Could the 'something' also encompass the pipe operator? (like #5286) |
No. I'm very loathe to go down that long slippery slope since it's a bug farm. Anything we do here would be for |
Fair enough :-) |
@dsyme Do you still think a language suggestion is necessary, or should we just use this to track and update the RFC? |
We can use this to track I suppose, special casing |
For an interface method with a
byref<'t>
return, it's not possible to provide an implementation that just throws an exceptionRepro steps
Expected behavior
Compiles
Actual behavior
The line
reports the error
FS0412 A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
Known workarounds
Include an unreachable dummy return value
Related information
Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: 39fd7b8.
The text was updated successfully, but these errors were encountered: