clj-commons / manifold

A compatibility layer for event-driven abstractions
1.02k stars 106 forks source link

Add clj-kondo support for internal macros #224

Closed cosineblast closed 1 year ago

cosineblast commented 1 year ago

This adds clj-kondo support for the problematic private macros in manifold. The def-type+ family was just aliased to their clojure.core counterparts as it is a group of simple wrappers.

The def-source family could be linted as deftype, but that would generate issues with the implied lock attribute. Instead, the approach taken was to provide a hook that expands calls to a deftype declaration containing the lock attribute/parameter. Additionally, it provides a -> constructor function that accepts the original parameters without the lock, just like the original def-source macro family does.

However, this causes a var redefinition warning, which is disabled for those macros since their real expansion really contains a var redefinition.

Support was also added for the both and success-error-unrealized macros in manifold.deferred.