Closed zelenij closed 2 years ago
This is a tricky thing, maybe we should report it to the F# compiler. The problem is that the F# compiler assigns the same name to the generic automatically inferred for the unused argument and this confuses Fable. If you explicitly type the generic argument the problem is solved.
static member inline RouteBuilder (_: 'b) m =
Unfortunately I'm afraid I cannot easily fix this in Fable but I will add a warning to the next version so users can fix the issue in their code. Thanks for reporting!
I see, interesting...
Any idea why it actually works in Fable 3.7.0 and below?
This might be a regression in F#. In VS 2019 the signature of RouteBuilder
is 'a0 -> string ->string
when hovering over it.
But it doesn't look like we updated FCS after 3.7.0, so probably not?
Yes, unfortunately we don't keep real control of the FCS version, because we just make custom builds of ncave's fork whenever is rebased with dotnet/fsharp 😅
Actually I found a work-around, see last part of this comment. If you upgrade to Fable 3.7.11 it should work without the explicit annotations.
Nice one! 👍
@alfonsogarciacaro Do we want to revert this work-around, now that dotnet/fsharp#13062 is supposedly fixed?
@ncave Unfortunately this still seems to be a problem. With latest Fable version (which should contain latest FCS bits) in this code:
type MyRecord<'a> =
{ Value: 'a }
// F# automatically still assigns 'a name to argument's generic type
static member Stringify v = string v
The Stringify
method gets compiled in Dart as follows, which causes an error because the name of the generics is the same:
String MyRecord$1_Stringify_2B595<$a, $a>($a v) => v.toString();
@alfonsogarciacaro That's ok, for Rust it is the other way (generating an unnecessary type param), so I removed the work-around for Rust only.
This code
when run in the online tool with fable 3.7.9 produces
Expected:
And with version 3.7.0 it does that.