Skip to content

Commit

Permalink
fix parameters with UoM break linking to precompiledLib
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Dunets committed May 21, 2024
1 parent 8c28beb commit 5982ea2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/Fable.Transforms/FSharp2Fable.Util.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,19 @@ module TypeHelpers =
// TODO: Check it's effectively measure?
// TODO: Raise error if we cannot get the measure fullname?
match tryDefinition genArgs[0] with
| Some(_, Some fullname) -> fullname
| Some(_, Some fullname) ->
// Not sure why, but when precompiling F# changes measure types to MeasureProduct<'M, MeasureOne>
match fullname with
| Types.measureProduct2 ->
match
(nonAbbreviatedType genArgs[0]).GenericArguments
|> Seq.map (tryDefinition >> Option.bind snd)
|> List.ofSeq
with
// TODO: generalize it to support aggregate units such as <m/s> or more complex
| [ Some measure; Some Types.measureOne ] -> measure
| _ -> fullname
| _ -> fullname
| _ -> Naming.unknown
else
Naming.unknown
Expand Down
4 changes: 3 additions & 1 deletion src/Fable.Transforms/OverloadSuffix.fs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ let rec private getTypeFastFullName (genParams: IDictionary<_, _>) (t: Fable.Typ
let genArgs = genArgs |> Seq.mapToList (getTypeFastFullName genParams)
// Not sure why, but when precompiling F# changes measure types to MeasureProduct<'M, MeasureOne>
match tdef.FullName, genArgs with
| Types.measureProduct2, [ measure; Types.measureOne ] -> measure
| Types.measureProduct2, [ measure; Types.measureOne ] ->
// TODO: generalize it to support aggregate units such as <m/s> or more complex
measure
| _ ->
let genArgs = String.concat "," genArgs

Expand Down

0 comments on commit 5982ea2

Please sign in to comment.