Can anyone help me understand this type error?

12 wyświetleń
Przejdź do pierwszej nieodczytanej wiadomości

Laurens Van Houtven

nieprzeczytany,
15 wrz 2015, 19:50:0115.09.2015
do core.typed
I'm getting the following error:

```
Domains:
    t/Any (t/HMap :optional {:key-fn (t/Fn [t/Any -> String])})

Arguments:
    (t/HMap :mandatory {:kwargs (IPersistentMap t/Symbol t/Any), :retries t/Any, :id t/Any, :task String} :optional {:args (t/Seq t/Any)}) (t/HMap :mandatory {:key-fn [(t/U t/Kw String) -> String]} :complete? true)

Ranges:
    String
```

`(t/HMap :mandatory {:kwargs (IPersistentMap t/Symbol t/Any), :retries t/Any, :id t/Any, :task String} :optional {:args (t/Seq t/Any)})` definitely matches `t/Any`, and `(t/HMap :mandatory {:key-fn [(t/U t/Kw String) -> String]} :complete? true)` seems like it should match ` (t/HMap :optional {:key-fn (t/Fn [t/Any -> String])`; that is, an argument HMap with a mandatory key should be passable to something that doesn’t care about that key. I've tried making the :optional HMap entry :mandatory; that didn't work. I've tried making the Fn Any->Any, that didn't work.

thanks in advance!
lvh

Ambrose Bonnaire-Sergeant

nieprzeczytany,
15 wrz 2015, 19:52:5115.09.2015
do core.typed
Your domain says :key-fn is a function that accepts Any, but a function that only
accepts (U Kw String) is provided.

Thanks.
Ambrose
Odpowiedz wszystkim
Odpowiedz autorowi
Przekaż
Nowe wiadomości: 0