dry-rb / dry-types

Flexible type system for Ruby with coercions and constraints
https://dry-rb.org/gems/dry-types
MIT License
859 stars 134 forks source link

Allows Default to return the right Result #475

Open elcuervo opened 3 months ago

elcuervo commented 3 months ago

Fixes instances when a Default type runs #try with a failing value.

Closes #469

Types::Integer.default(1).try("a")
# => #<Dry::Types::Result::Failure input="a" error=#<Dry::Types::ConstraintError: "a" violates constraints (type?(Integer, "a") failed)>>