-
Notifications
You must be signed in to change notification settings - Fork 789
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
[FS-1140] add Boolean-returning and return-type-directed partial active patterns #16473
Conversation
add an option to control visibility of `remarks`
This will need a small RFC, describing the approach and codegen, so we don't lose it, since it's a change to spec. |
|
❗ Release notes required
|
tests/fsharp/Compiler/Language/BoolPartialActivePatternTests.fs
Outdated
Show resolved
Hide resolved
Could someone fix the test |
@Tangent-90 maybe this helps. |
Is this still WIP as title suggests, or ready for review? |
It may need the RFC to be accepted first? |
@vzarytovskii Title changed, it's now ready |
@Tangent-90 I just want to say that this is awesome, the idea is awesome, you are awesome, and I can't wait to use this. |
tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/StructActivePatterns.fs
Outdated
Show resolved
Hide resolved
@Tangent-90 thanks a lot for this contribution! |
FSharp """let (|IsA|_|) x = x = "A" | ||
|
||
match "A" with | ||
| IsA result -> "A" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we try to resolve result
to another symbol here (see the error on line 101)? Lowercase names at argument positions are never being resolved to any other symbol in patterns and always create new local values (or are ignored during recovery).
This is very inconsistent to the rest of the language. It should probably be an error about an extra arg instead, definitely not the 'unresolved name' one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because active pattern returning _ option
or _ voption
can capture return value by the last argument, but active pattern returning bool
doesn't. The test is to check it works.
New error added, see #16846.
Description
Implements this
Current progress:
Checklist
RFC added
Test cases added
Performance benchmarks added in case of performance changes
Release notes entry updated: