From 8cad123d71b44c42d1ef3efed83ebe6bf2b31e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Sun, 7 Apr 2024 23:40:08 +0300 Subject: [PATCH] refactor: fix type piracy --- src/UDEComponents.jl | 5 ++++- src/hacks.jl | 4 ---- test/qa.jl | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 src/hacks.jl diff --git a/src/UDEComponents.jl b/src/UDEComponents.jl index 7c3e812..f33ccd9 100644 --- a/src/UDEComponents.jl +++ b/src/UDEComponents.jl @@ -11,7 +11,6 @@ using ComponentArrays: ComponentArray export create_ude_component, multi_layer_feed_forward include("utils.jl") -include("hacks.jl") # this should be removed / upstreamed """ create_ude_component(n_input = 1, n_output = 1; @@ -42,4 +41,8 @@ function create_ude_component(n_input = 1, return ude_comp end +function lazyconvert(T, x::Symbolics.Arr) + Symbolics.array_term(convert, T, x, size = size(x)) +end + end diff --git a/src/hacks.jl b/src/hacks.jl deleted file mode 100644 index 3f5c568..0000000 --- a/src/hacks.jl +++ /dev/null @@ -1,4 +0,0 @@ -lazyconvert(x, y) = convert(x, y) -lazyconvert(x, y::Symbolics.Arr) = Symbolics.array_term(convert, x, y) -Symbolics.propagate_ndims(::typeof(convert), x, y) = ndims(y) -Symbolics.propagate_shape(::typeof(convert), x, y) = Symbolics.shape(y) diff --git a/test/qa.jl b/test/qa.jl index b25881e..49f7662 100644 --- a/test/qa.jl +++ b/test/qa.jl @@ -7,8 +7,7 @@ using JET Aqua.find_persistent_tasks_deps(UDEComponents) Aqua.test_ambiguities(UDEComponents, recursive = false) Aqua.test_deps_compat(UDEComponents) - # TODO: fix type piracy in propagate_ndims and propagate_shape - Aqua.test_piracies(UDEComponents, broken = true) + Aqua.test_piracies(UDEComponents) Aqua.test_project_extras(UDEComponents) Aqua.test_stale_deps(UDEComponents, ignore = Symbol[]) Aqua.test_unbound_args(UDEComponents)