Skip to content

[BUG] Link from external hash to external hash doesn't compile #546

@jost-s

Description

@jost-s

Steps to reproduce

$ hc-scaffold link-type
✔ Link from which entry type? · ExternalHash
✔ What name should be given to the link for this hash? · some
✔ Link to which entry type? · Agent
✔ Which role does this agent play in the relationship ? (eg. "creator", "invitee") · other
✔ Should the link be bidirectional? · yes
✔ Can the link be deleted? · yes

Link type scaffolded!

$ npm t

> test
> npm run build:happ && cargo test


> build:happ
> npm run build:zomes && hc app pack workdir --recursive


> build:zomes
> RUSTFLAGS='--cfg getrandom_backend="custom"' cargo build --release --target wasm32-unknown-unknown
...
error[E0308]: mismatched types
  --> dnas/dena/zomes/coordinator/zoma/src/some_to_others.rs:98:47
   |
98 |         if link.target.clone().into_hash() == input.base_some.clone().into_hash() {
   |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `HoloHash<AnyLinkable>`, found `HoloHash<External>`
   |
   = note: expected struct `HoloHash<AnyLinkable>`
              found struct `HoloHash<hdk::prelude::hash_type::External>`
help: call `Into::into` on this expression to convert `HoloHash<hdk::prelude::hash_type::External>` into `HoloHash<AnyLinkable>`
   |
98 |         if link.target.clone().into_hash() == input.base_some.clone().into_hash().into() {
   |                                                                                   +++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `zoma` (lib) due to 1 previous error

Tasks:

  • Fix bug and simplify comparison:
if link.target == input.base_some.clone().into() {

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Ready for refinement

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions