Code Review for a sales tax problem solved using Elixir

For the issue on line 56, dialzyer is telling you what the problem is: ShoppingCart.initialize_cart_product/2 takes a number/0 as the first argument, but you’re giving it the return value of SalesTaxCalculator.calculate_total_sales_tax/1 which is a float/0 per the specs you defined.

Regarding the “no local return” error, this often means that the body of the function can raise an error (in which case no return value would be provided). To find out what the issue is, try commenting lines (or replacing them with dummy lines that ensure the types work in your code) to find the line causing triggering the dialyzer issue. Then, either fix your code/specs, or add no_return as a possible return value.