Stream: contributing

Topic: Enforce abilities orphan rules


view this post on Zulip itmuckel (Apr 02 2023 at 15:26):

I need some help getting started with https://github.com/roc-lang/roc/issues/3296. Where would be the points of interest, abilities.rs, symbol.rs, derive.rs? The change will probably need to be in abilities.rs, but a bit of context of where the implementations are being canonicalized and module membership is checked would be nice, it's a lot of code for me to parse. :sweat_smile:

view this post on Zulip Ayaz Hafiz (Apr 02 2023 at 15:42):

the most relevant place would be canonicalize_opaque in can/src/def.rs

view this post on Zulip Ayaz Hafiz (Apr 02 2023 at 15:42):

In particular, as part of the logic that happens here: https://github.com/roc-lang/roc/blob/2910024be531ce9bedf135953799dc2fd0d1bb0d/crates/compiler/can/src/def.rs#L690

view this post on Zulip Ayaz Hafiz (Apr 02 2023 at 15:46):

oh, wait. I believe that issue is already resolved by the constraints of the language syntax. The reason being, the only way to declare an ability for an opaque type is inline, during the definition of the opaque type:

MyType := {} has [Hash, Eq]

you need that "has" clause to give an opaque type abilities, but also that has clause can only be specified at the place the opaque type is defined.

view this post on Zulip Ayaz Hafiz (Apr 02 2023 at 15:46):

Sorry about this. The reason I made that issue was that used to not be the case, and it used to be possible to give opaque types abilities outside of a "has" clause.

view this post on Zulip Ayaz Hafiz (Apr 02 2023 at 15:52):

here are a few actual existing feature improvements/bugs in the canonicalizer, if you are interested in any of them :sweat_smile:

view this post on Zulip itmuckel (Apr 02 2023 at 16:04):

lol, okay, I'll see if I find anything I want to do there. Otherwise I'll just play around with updating the language server to work with the newest version of the compiler :-)


Last updated: Jul 06 2025 at 12:14 UTC