-
Notifications
You must be signed in to change notification settings - Fork 301
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
Erased types cannot implement abstract members #2295
Comments
Interesting, I didn't know you could declare a non-static type without a constructor 👀 Not sure if it's a regression. The error message is more or less correct, but it may happen it was not displayed in Fable 2. However, I think |
I'm just using the Fable.SignalR library, I did not write it. I raised the issue here as it was compiling with Fable 2. Maybe I should raise the issue to the owner repository. |
Ah, ok! Maybe @Shmew can help here? If it's not possible to update the library, we can try to remove the error message in this case. |
Yeah I like this a lot when I import them from JS over interfaces as I can directly implement my own overloads on that type via inlining.
I suspect this would regress because interfaces mangle by default now? Or was it decided they need a mangle attribute, don't remember. |
I see, interesting. Well, it's kind of a regression because doesn't allow this "hack" although the error message is correct. For example this code doesn't fail in Fable 2 but produces "undefined" in runtime unless you remove the open Fable.Core
type IFoo =
abstract Foo: string
[<Erase>]
type Foo =
| Foo of string
interface IFoo with
member this.Foo =
match this with Foo s -> "foo:" + s
let test (x: IFoo) =
printfn "%s" x.Foo
Foo "bar" |> test I think you shouldn't need to use |
That makes sense, this was mostly because if I can not rely on outside tooling to tree-shake to reduce bundle size I'd rather do that. Yeah, unions won't work because there's no way to "replace" all the functionality of the type via emit/inlining, so the error makes sense in that circumstance. |
Description
A project referencing Fable.SignalR is not compiling with fable 3 with the error "Erased types cannot implement abstract members"
Repro code
Please provide the F# code to reproduce the problem or a link to the REPL.
Ideally, it should be possible to easily turn this code into a unit test.
The code could be rewritten has this in the library with Fable 3 but is it a regression or an expected behavior ?
Expected and actual results
Code should compile
Related information
The text was updated successfully, but these errors were encountered: