-
Notifications
You must be signed in to change notification settings - Fork 463
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
Hide Stdlib in output #7305
Hide Stdlib in output #7305
Conversation
1874293
to
7bf0b50
Compare
cc @cknitt |
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.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Syntax Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05
.
Benchmark suite | Current: 4524ad3 | Previous: 80744a5 | Ratio |
---|---|---|---|
Parse RedBlackTree.res - time/run |
2.1417238866666666 ms |
1.87223692 ms |
1.14 |
Print RedBlackTree.res - time/run |
3.3576086933333333 ms |
2.9391152133333334 ms |
1.14 |
Print RedBlackTreeNoComments.res - time/run |
3.0481397133333332 ms |
2.693127673333333 ms |
1.13 |
Parse Napkinscript.res - time/run |
69.52510789333333 ms |
60.98575317999999 ms |
1.14 |
Print Napkinscript.res - time/run |
113.42383125333333 ms |
102.03488166 ms |
1.11 |
Parse HeroGraphic.res - time/run |
8.305685073333333 ms |
7.62831228 ms |
1.09 |
Print HeroGraphic.res - time/run |
13.942951893333332 ms |
12.308145193333333 ms |
1.13 |
This comment was automatically generated by workflow using github-action-benchmark.
@@ -5,10 +5,10 @@ Definition src/Definition.res 10:23 | |||
{"uri": "Definition.res", "range": {"start": {"line": 6, "character": 7}, "end": {"line": 6, "character": 13}}} | |||
|
|||
Hover src/Definition.res 14:14 | |||
{"contents": {"kind": "markdown", "value": "```rescript\n(list<'a>, 'a => 'b) => list<'b>\n```\n---\n\n`map(list, f)` returns a new list with `f` applied to each element of `list`.\n\n## Examples\n\n```rescript\nlist{1, 2}->List.map(x => x + 1) // list{3, 4}\n```\n"}} | |||
{"contents": {"kind": "markdown", "value": "```rescript\n(List.t<'a>, 'a => 'b) => List.t<'b>\n```\n\n---\n\n```\n \n```\n```rescript\ntype List.t<'a> = list<'a>\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Stdlib_List.resi%22%2C36%2C0%5D)\n\n---\n\n`map(list, f)` returns a new list with `f` applied to each element of `list`.\n\n## Examples\n\n```rescript\nlist{1, 2}->List.map(x => x + 1) // list{3, 4}\n```\n"}} |
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 does list
change back to List.t
?
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 don't know, doesn't seem to happen locally for me. Will need to investigate if we decide to go this route.
compiler/ml/printtyp.ml
Outdated
@@ -571,8 +571,48 @@ let reset_and_mark_loops_list tyl = | |||
|
|||
(* Disabled in classic mode when printing an unification error *) | |||
|
|||
let remove_stdlib t = |
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 was wondering what's done for Pervasives, and there's some logic already around non_shadowed_pervasive
, which could be adapted.
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.
In general, I would do a search for the string "Pervasives"
in the codebase, and see where there is logic to be copied.
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.
Great lead, will have a look!
ef5af72
to
07ab10f
Compare
@cristianoc I changed approach to follow what's done for |
| Pdot (_, s, _pos) as path when non_shadowed_pervasive path -> Oide_ident s | ||
| Pdot (_, s, _pos) as path when non_shadowed_pervasive_or_stdlib path -> | ||
Oide_ident s | ||
| Pdot (p, s, _pos) when String.starts_with (Path.name p) ~prefix:"Stdlib_" -> | ||
let path_name = Path.name p in | ||
let ident_without_stdlib_prefix = | ||
String.sub path_name 7 (String.length path_name - 7) | ||
in | ||
Oide_dot (Oide_ident ident_without_stdlib_prefix, s) |
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 🤦 😄
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.
Looks great.
I guess this fixes error messages too?
This reverts commit 7bf0b50.
47fea5f
to
00a8f1c
Compare
This hides
Stdlib
prefixes in various outputs:This is just a PoC/exploration, not sure if tis is how we want to solve this. But worth discussing the pros and cons.
cc @cristianoc, thoughts?