-
Notifications
You must be signed in to change notification settings - Fork 469
Hide Stdlib in output #7305
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
Hide Stdlib in output #7305
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2f56758
hide Stdlib. and Stdlib_ in errors and editor type expr printing
zth 9ffe136
also change decl printing to get rid of Stdlib prefix
zth c37fc04
remove unecessary fn call
zth ce8f8b1
Revert "remove unecessary fn call"
zth a6eb1f7
commit more tests
zth 10665b8
change approach to roughly the same as Pervasives use
zth 5e89084
make diff clearer
zth 00a8f1c
update output
zth bb870e9
changelog
zth c3802a5
add fixture error demonstrating the stdlib parts being removed
zth 9d26252
format
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
16 changes: 16 additions & 0 deletions
16
tests/build_tests/super_errors/expected/stdlib_removed_in_error.res.expected
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,16 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/stdlib_removed_in_error.res[0m:[2m3:12-42[0m | ||
|
||
1 [2m│[0m type x = Stdlib.Promise.t<int> | ||
2 [2m│[0m | ||
[1;31m3[0m [2m│[0m let x: x = [1;31mStdlib.Promise.resolve("hello")[0m | ||
4 [2m│[0m | ||
|
||
This has type: [1;31mPromise.t<string>[0m [2m(defined as[0m [1;31mpromise<string>[0m[2m)[0m | ||
But it's expected to have type: [1;33mx[0m [2m(defined as[0m [1;33mpromise<int>[0m[2m)[0m | ||
|
||
The incompatible parts: | ||
[1;31mstring[0m vs [1;33mint[0m | ||
|
||
You can convert [1;33mstring[0m to [1;33mint[0m with [1;33mBelt.Int.fromString[0m. |
3 changes: 3 additions & 0 deletions
3
tests/build_tests/super_errors/fixtures/stdlib_removed_in_error.res
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,3 @@ | ||
type x = Stdlib.Promise.t<int> | ||
|
||
let x: x = Stdlib.Promise.resolve("hello") |
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 guess we could list all
Stdlib_*
with proper idents here if we wanted..? Instead of doing a string match.There's also the question of whether stdlib types should be dug to when possible (
Date.t -> date
), but that's probably a separate question from this PR.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.
And especially
Promise.t
->promise
as that's a built-in type.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.
Yeah, that's a much better example, especially since
date
does not exist 🤦 😄