From 27ade0735979d10019e5ac38f02d01440817aa4f Mon Sep 17 00:00:00 2001 From: "Brian J. Cardiff" Date: Sat, 22 Jan 2022 15:06:16 -0300 Subject: [PATCH] Add workaround for crystal-lang/crystal#9483 (#160) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add workaround for crystal-lang/crystal#9483 * Update src/db/begin_transaction.cr Co-authored-by: Johannes Müller Co-authored-by: Johannes Müller --- src/db/begin_transaction.cr | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/db/begin_transaction.cr b/src/db/begin_transaction.cr index 47eede8..58db073 100644 --- a/src/db/begin_transaction.cr +++ b/src/db/begin_transaction.cr @@ -13,7 +13,9 @@ module DB # can be called explicitly. # Returns the value of the block. def transaction(& : Transaction -> T) : T? forall T - tx = begin_transaction + # TODO: Cast to workaround crystal-lang/crystal#9483 + # begin_transaction returns a Tx where Tx < Transaction + tx = begin_transaction.as(Transaction) begin res = yield tx rescue DB::Rollback