Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.typed by
h1. Problem

Predicate generation for HVec's do not support uniform variable parameters.


((t/pred (t/HVec [(t/Value :foo) t/Keyword *])) [:foo :bar])
CompilerException clojure.lang.ExceptionInfo: Internal Error (*cider-repl service*:97:17) :Protocol not supported in type->pred: * {:type-error :clojure.core.typed.errors/internal-error, :env {:line 97, :column 17, :file "*cider-repl service*", :ns spark.dev.repl}}, compiling:(*cider-repl service*:97:17)


h1. Solution

This seems to be a symptom of {{*}} not being parsed correctly.

First, {{HVec}}'s clearly ignores the variable parameters [when they are parsed|https://github.com/clojure/core.typed/blob/0947387913babb0e8db52b560a3c0e42b45cb40b/module-rt/src/main/clojure/clojure/core/typed/parse_ast.clj#L249-L275].

This is actually correctly done for quoted HVec types like '[Foo Bar *] [here|https://github.com/clojure/core.typed/blob/0947387913babb0e8db52b560a3c0e42b45cb40b/module-rt/src/main/clojure/clojure/core/typed/parse_ast.clj#L344-L345].

This change should fix things; the contract generation already works for quoted HVec's since it expects a [rest entry|https://github.com/clojure/core.typed/blob/0947387913babb0e8db52b560a3c0e42b45cb40b/module-rt/src/main/clojure/clojure/core/typed/type_contract.clj#L81-L86],

*Pull request*:
*Commit*:
*Version*:

3 Answers

0 votes
by

Comment made by: ambrosebs

The error is a bit odd. It may be that {{t/Keyword}} is the thing that's failing here.

Please try and isolate this error.

0 votes
by

Comment made by: ambrosebs

Oh I see the issue. Cannot resolve Protocol called **!

0 votes
by
Reference: https://clojure.atlassian.net/browse/CTYP-306 (reported by alex+import)
...