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
type Incrementor(z) =
abstract member Increment : int byref * int byref -> unit
default this.Increment(i : int byref,j : int byref) =
i <- i + z
type Decrementor(z) =
inherit Incrementor(z)
override this.Increment(i, j) =
base.Increment(&i, &j)
i <- i - z
the error is:
error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
``
But this slight variation compiles fine:
```fsharp
type Incrementor(z) =
abstract member Increment : int byref * int byref -> unit
default this.Increment(i : int byref,j : int byref) =
i <- i + z
type Decrementor(z) =
inherit Incrementor(z)
override this.Increment(i, j) =
this.Increment(&i, &j)
i <- i - z
All I’ve done is to change the target of Increment in the override from base to this (so it will stack overflow at runtime), which shows that the compiler is somehow analyzing the base call and a normal call differently (and, I believe wrongly in the former case).
The text was updated successfully, but these errors were encountered:
Originally opened at CodePlex bykvb
Based on the problem reported here: http://stackoverflow.com/questions/24324547/f-method-with-byref-parameter-override.
This fails to compile
the error is:
All I’ve done is to change the target of Increment in the override from base to this (so it will stack overflow at runtime), which shows that the compiler is somehow analyzing the base call and a normal call differently (and, I believe wrongly in the former case).
The text was updated successfully, but these errors were encountered: