-
Notifications
You must be signed in to change notification settings - Fork 470
PoC of let? #7582
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
Merged
Merged
PoC of let? #7582
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
64b4c6b
PoC of let.unwrap
zth cf870da
support let unwrap syntax (`let?`) (#7586)
tsnobip 5122f18
fix loc and put error case first for better errors
zth a284c86
changed test output
zth f286bce
fix
zth f6083fa
support let? on Error and None as well
zth 480fd04
add feature for shipping experimental features
zth 4be8578
error test for not enabled feature
zth 4160452
fix
zth 712249b
error handling
zth 3255d10
move to more correct place
zth 17b18db
comment
zth 6b1d196
tweaks
zth 9d93ede
Update rewatch/src/config.rs
zth 2fb657c
hint about when appropriate
zth 89ee32a
fix
zth af9c0a4
add another error message test
zth 1080871
fix lint
zth 6ddf320
try to improve error message
zth 15b1855
more work on error messages
zth 5386466
changelog
zth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,23 @@ | ||||||||||||||||||||||||||
type feature = LetUnwrap | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
let to_string (f : feature) : string = | ||||||||||||||||||||||||||
match f with | ||||||||||||||||||||||||||
| LetUnwrap -> "LetUnwrap" | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
let from_string (s : string) : feature option = | ||||||||||||||||||||||||||
match s with | ||||||||||||||||||||||||||
| "LetUnwrap" -> Some LetUnwrap | ||||||||||||||||||||||||||
| _ -> None | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
module FeatureSet = Set.Make (struct | ||||||||||||||||||||||||||
type t = feature | ||||||||||||||||||||||||||
let compare = compare | ||||||||||||||||||||||||||
end) | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
let enabled_features : FeatureSet.t ref = ref FeatureSet.empty | ||||||||||||||||||||||||||
let enable_from_string (s : string) = | ||||||||||||||||||||||||||
match from_string s with | ||||||||||||||||||||||||||
| Some f -> enabled_features := FeatureSet.add f !enabled_features | ||||||||||||||||||||||||||
| None -> () | ||||||||||||||||||||||||||
Comment on lines
+18
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
let is_enabled (f : feature) = FeatureSet.mem f !enabled_features |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type feature = LetUnwrap | ||
|
||
val enable_from_string : string -> unit | ||
val is_enabled : feature -> bool | ||
val to_string : feature -> string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I can imagine this might grow in the future.
Should this be a list to be future proof?
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.
It is a list, just that you pass it multiple times. Or are you referring to making it
-enable-experimental FeatureX,FeatureY
instead of-enable-experimental FeatureX -enable-experimental FeatureY
?