-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
WIP: Derive Inspect #5775
WIP: Derive Inspect #5775
Conversation
263fb56
to
720eaaf
Compare
f88ea97
to
c7fb2ac
Compare
Thank you for your contribution! Sometimes PRs end up staying open for a long time without activity, which can make the list of open PRs get long and time-consuming to review. To keep things manageable for reviewers, this bot automatically closes PRs that haven’t had activity in 60 days. This PR hasn’t had activity in 30 days, so it will be automatically closed if there is no more activity in the next 30 days. Keep in mind that PRs marked |
c1dd9f9
to
481dcea
Compare
710b395
to
30f9515
Compare
7474b25
to
3eb6f91
Compare
@@ -126,6 +130,11 @@ isEq = \xs, ys -> | |||
hashDict : hasher, Dict k v -> hasher where k implements Hash & Eq, v implements Hash, hasher implements Hasher | |||
hashDict = \hasher, dict -> Hash.hashUnordered hasher (toList dict) List.walk | |||
|
|||
toInspectorDict : Dict k v -> Inspector f where k implements Inspect & Hash & Eq, v implements Inspect, f implements InspectFormatter |
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.
toInspectorDict : Dict k v -> Inspector f where k implements Inspect & Hash & Eq, v implements Inspect, f implements InspectFormatter | |
toInspectorDict : Dict k v -> Inspector f where k implements Inspect, v implements Inspect, f implements InspectFormatter |
Those are redundant, right?
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 required for some reason:
This expression is used in an unexpected way:
133│ toInspectorDict : Dict k v -> Inspector f where k implements Inspect, v implements Inspect, f implements InspectFormatter
^
This argument to an opaque type has type:
k where k implements Inspect
But you are trying to use it as:
#a where #a implements Hash & Eq
Note: The type variable k says it can take on any value that
implements only the ability Inspect.
But, I see that it's also used as if it implements the abilities Hash
and Eq. Can you use k without those abilities? If not, consider adding
them to the implements clause of k.
# The current default formatter for inspect. | ||
# This just returns a simple string for debugging. | ||
# More powerful formatters will likely be wanted in the future. | ||
DbgFormatter := { data : Str } |
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.
Not important right now, but I wonder if we should split this out into a separate module.
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, I debated the same, but ultimately thought it would be nicer to just have Inspect.toDbgStr
. I am open to either, but that can be dealt with in follow up.
@@ -3289,3 +3289,150 @@ fn non_nullable_unwrapped_instead_of_nullable_wrapped() { | |||
"# | |||
) | |||
} | |||
|
|||
#[mono_test] | |||
#[ignore = "Hits an unimplemented for abilities, not sure why..."] |
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.
Is this still the case?
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.
Yes, still fails, also fails in a similar test for encode. Haven't dug into it much:
thread 'inspect_custom_type' panicked at '[Abilities] not yet implemented. Tracking issue: https://github.com/roc-lang/roc/issues/2463.
Additional information: Not reachable yet', crates/compiler/mono/src/layout.rs:511:55
crates/compiler/types/src/subs.rs
Outdated
@@ -1754,6 +1756,7 @@ impl Subs { | |||
symbol_names.push(Symbol::HASH_HASHER); | |||
symbol_names.push(Symbol::HASH_HASH_ABILITY); | |||
symbol_names.push(Symbol::BOOL_EQ); | |||
symbol_names.push(Symbol::INSPECT_INSPECT_ABILITY); | |||
// END INIT-SymbolNames |
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.
Curse of IFTTT... we should rename to "INIT-SymbolSubsSlice" ( sorry, I know it's not due to 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.
I don't truly follow, but renamed.
crates/compiler/uitest/tests/ability/specialize/inspect/opaque_derived.txt
Show resolved
Hide resolved
crates/compiler/uitest/tests/ability/specialize/inspect/opaque_custom_impl.txt
Show resolved
Hide resolved
I approved, but if possible, we should address the comments related to things introduced in this PR (the other stuff, which was introduced previously, I can fixup) |
`specialize/inspect/opaque_derived` does not yet pass.
e89265b
to
248976d
Compare
@rtfeldman, can we force merge this. Seems that the CI runner is just broken currently. This PR and a few other are just waiting in queue. I have run all the tests locally which is a nix macos apple silicon machine. Also, nothing was changed for any dev tools. |
No description provided.