diff --git a/spec/std/enumerable_spec.cr b/spec/std/enumerable_spec.cr index 8847959d9aa8..5c66ddf55062 100644 --- a/spec/std/enumerable_spec.cr +++ b/spec/std/enumerable_spec.cr @@ -1373,9 +1373,9 @@ describe "Enumerable" do require "prelude" [1, 10000000000_u64].sum CRYSTAL - "Enumerable#sum and #product do not support Union types. Instead, " + - "use Enumerable#sum/product(initial) with an initial value of " + - "the expected type of the call." + "Enumerable#sum() and #product() do not support Union types. " + + "Instead, use Enumerable#sum and #product(initial), respectively, " + + "with an initial value of the intended type of the call." end it "uses additive_identity from type" do @@ -1427,9 +1427,9 @@ describe "Enumerable" do require "prelude" [1, 10000000000_u64].product CRYSTAL - "Enumerable#sum and #product do not support Union types. Instead, " + - "use Enumerable#sum/product(initial) with an initial value of " + - "the expected type of the call." + "Enumerable#sum() and #product() do not support Union types. " + + "Instead, use Enumerable#sum and #product(initial), respectively, " + + "with an initial value of the intended type of the call." end end diff --git a/src/enumerable.cr b/src/enumerable.cr index 2ec4b7456ae1..fb78d5c569ce 100644 --- a/src/enumerable.cr +++ b/src/enumerable.cr @@ -2299,9 +2299,10 @@ module Enumerable(T) def self.first {% if X.union? %} {{ - raise("Enumerable#sum and #product do not support Union types. " + - "Instead, use Enumerable#sum/product(initial) with an " + - "initial value of the expected type of the call.") + raise("Enumerable#sum() and #product() do not support Union types. " + + "Instead, use Enumerable#sum and #product(initial), " + + "respectively, with an initial value of the intended type " + + "of the call.") }} {% else %} X