-
Notifications
You must be signed in to change notification settings - Fork 469
Format docstrings with the new format tools command #7623
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
Open
zth
wants to merge
16
commits into
master
Choose a base branch
from
format-stdlib-docstrings
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,250
−2,249
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4459254
format docstrings with the new format tools command
zth 7633422
handle piped assertEqual
zth f52f6d5
compiled files
zth 8c9e810
add extraction command for code blocks
zth 2f283ce
change transform to only work on structure items
zth 6df0c01
refactor
zth d1e1256
change code block extraction approach to use the typed artifacts inst…
zth 0aae7d7
add ExtractCodeBlocks to RescriptTools for simplicity
zth 77bf1a5
integrate code block extraction into doctests script
zth 699b892
only include code blocks with tests in them
zth cba8253
update analysis examples
zth c7eab25
fix last remaining format issues in runtime docstrings
zth 2cc3a22
update analysis test files
zth 242dfa6
more test output
zth 4a971c0
changelog
zth f8a5a71
fix 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,10 @@ | |
|
||
let Docgen; | ||
|
||
let ExtractCodeBlocks; | ||
|
||
export { | ||
Docgen, | ||
ExtractCodeBlocks, | ||
} | ||
/* No side effect */ |
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 @@ | ||
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ |
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 @@ | ||
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ |
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 |
---|---|---|
|
@@ -130,16 +130,15 @@ let letters = ["a", "b", "c"] | |
let a = letters[0] | ||
// Use a switch statement: | ||
let capitalA = | ||
switch a { | ||
| Some(a) => Some(Js.String.toUpperCase(a)) | ||
| None => None | ||
} | ||
let capitalA = switch a { | ||
| Some(a) => Some(Js.String.toUpperCase(a)) | ||
| None => None | ||
} | ||
let k = letters[10] // k == None | ||
``` | ||
With that little bit of tweaking, our code now compiles successfully and is 100% free of runtime errors! | ||
With that little bit of tweaking, our code now compiles successfully and is 100% free of runtime errors\! | ||
### A Special Encoding for Collection Safety | ||
|
@@ -150,31 +149,25 @@ We use a phantom type to solve the problem: | |
## Examples | ||
```rescript | ||
module Comparable1 = | ||
Belt.Id.MakeComparable( | ||
{ | ||
type t = (int, int) | ||
let cmp = ((a0, a1), (b0, b1)) => | ||
switch Pervasives.compare(a0, b0) { | ||
| 0 => Pervasives.compare(a1, b1) | ||
| c => c | ||
} | ||
module Comparable1 = Belt.Id.MakeComparable({ | ||
type t = (int, int) | ||
let cmp = ((a0, a1), (b0, b1)) => | ||
switch Pervasives.compare(a0, b0) { | ||
| 0 => Pervasives.compare(a1, b1) | ||
| c => c | ||
} | ||
) | ||
}) | ||
let mySet1 = Belt.Set.make(~id=module(Comparable1)) | ||
module Comparable2 = | ||
Belt.Id.MakeComparable( | ||
{ | ||
type t = (int, int) | ||
let cmp = ((a0, a1), (b0, b1)) => | ||
switch Pervasives.compare(a0, b0) { | ||
| 0 => Pervasives.compare(a1, b1) | ||
| c => c | ||
} | ||
module Comparable2 = Belt.Id.MakeComparable({ | ||
type t = (int, int) | ||
let cmp = ((a0, a1), (b0, b1)) => | ||
switch Pervasives.compare(a0, b0) { | ||
| 0 => Pervasives.compare(a1, b1) | ||
| c => c | ||
} | ||
) | ||
}) | ||
let mySet2 = Belt.Set.make(~id=module(Comparable2)) | ||
``` | ||
|
@@ -184,8 +177,8 @@ Here, the compiler would infer `mySet1` and `mySet2` having different type, so e | |
## Examples | ||
```rescript | ||
let mySet1: t<(int, int), Comparable1.identity> | ||
let mySet2: t<(int, int), Comparable2.identity> | ||
let mySet1: t<(int, int), Comparable1.identity> = %todo | ||
let mySet2: t<(int, int), Comparable2.identity> = %todo | ||
Comment on lines
+180
to
+181
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. Did this so it could be parsed/compiled. |
||
``` | ||
`Comparable1.identity` and `Comparable2.identity` are not the same using our encoding scheme. | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.