Skip to content
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

Enum in class is not working: lead.proto.fs(251, 13): [FS0001] No overloads match for method 'OfJson'. #160

Open
rstradling opened this issue Jul 29, 2019 · 1 comment

Comments

@rstradling
Copy link

rstradling commented Jul 29, 2019

Snippet like the below

enum SourceEnum {
  FACEBOOK = 0;
  OTHER = 1;
}
message Source {
/* Only used if the source_type = OTHER */
  string other = 1;
  SourceEnum source = 2;
}

generates code

[<CLIMutable>]
type Source =
    { mutable other : string option
      mutable source : SourceEnum option }

    static member JsonObjCodec =
        (fun other source ->
        { other = other
          source = source }) <!> Operators.jopt<Source, String> ("other") (fun x -> x.other)
        <*> Operators.jopt<Source, SourceEnum> ("source") (fun x -> x.source)

which generates error

lead.proto.fs(251, 13): [FS0001] No overloads match for method 'OfJson'. The available overloads are shown below.

Which seems to be referring to this line

<*> Operators.jopt<Source, SourceEnum> ("source") (fun x -> x.source)

as the problem

@gusty
Copy link
Contributor

gusty commented Jul 29, 2019

This seems to be a duplicate (or at least a consequence) of #131
If you read there, a fix was applied to Fleece already.
I'll be publishing a new nuget for Fleece this week, keep tuned in #131

deviousasti pushed a commit that referenced this issue Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants