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
I'm new to F#, so apologies if this was raised before or if I'm doing something wrong in the pattern matching construction.
I have a simple AST for expressions. Nothing fancy, Binary/Unary expressions and each expression has an operator and operands.
Now, I'm attempting a pattern match, where I want to match on binary expressions where the operand is say Divide and remainder, I'm doing something like this
Now op in this branch should only be Divide or Remainder, so further matching on it should be exhaustive, but for some reason I'm getting a warning about incomplete pattern.
The text was updated successfully, but these errors were encountered:
I would need to see the definition of IR_Ast.BinaryOperator, but if it has more cases than just Divide and Remainder, then that explains what you are seeing. If you are expecting the outer match on (Divide | Remainder) to narrow the typing for the inner match, F# does not do that (unlike, say, TypeScript). Any given match on a union will need to handle all cases.
Hi team,
I'm new to F#, so apologies if this was raised before or if I'm doing something wrong in the pattern matching construction.
I have a simple AST for expressions. Nothing fancy, Binary/Unary expressions and each expression has an operator and operands.
Now, I'm attempting a pattern match, where I want to match on binary expressions where the operand is say Divide and remainder, I'm doing something like this
Now op in this branch should only be Divide or Remainder, so further matching on it should be exhaustive, but for some reason I'm getting a warning about incomplete pattern.
The text was updated successfully, but these errors were encountered: