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
Before resorting to this error message, check if the left hand side can be statically cast to the type on the right, and if so, use a "consider using the :> operator" error message instead.
@isaksky Just a thought - C# does have two keywords - as (which doesn't exist in F# AFAIK) and (). It's more that in C# the "safe upcast" happens implicitly whereas in F# you need to be explicit - although I can't remember if this is only for co/contravariant conversions.
"The conversion from <type A> to <type B> is a compile-time safe upcast, not a downcast. Considering using the :> (upcast) operator instead of the :?> (downcast) operator."
Activity
forki commentedon May 3, 2016
first WIP PR: #1149
isaacabraham commentedon May 3, 2016
@isaksky Just a thought - C# does have two keywords -
as(which doesn't exist in F# AFAIK) and(). It's more that in C# the "safe upcast" happens implicitly whereas in F# you need to be explicit - although I can't remember if this is only for co/contravariant conversions.isaacabraham commentedon May 3, 2016
In fact here's another whole host of example cases...
isaacabraham commentedon May 3, 2016
I propose the error message to say: -
"The conversion from <type A> to <type B> is a compile-time safe upcast, not a downcast. Considering using the :> (upcast) operator instead of the :?> (downcast) operator."forki commentedon May 9, 2016
PR in #1149
5 remaining items
Merge pull request #1149 from forki/downcast