dry-rb / dry-types

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

Zeitwerk fixes #444

Closed robhanlon22 closed 2 years ago

robhanlon22 commented 2 years ago

When using Dry::Types.loader.eager_load, Zeitwerk raises more than one error:

Zeitwerk::NameError:
  expected file .../dry-types/lib/dry/types/compat.rb to define constant Dry::Types::Compat, but didn't

NameError: uninitialized constant Dry::Types::Extensions
  .../dry-core/lib/dry/core/deprecations.rb:227:in `block (2 levels) in deprecate_constant'

NameError: uninitialized constant RSpec
  from .../dry-types/lib/dry/types/spec/types.rb:3:in `<top (required)>'

Add some ignores to prevent this error; add a test that ensures eager loading works.

robhanlon22 commented 2 years ago

An alternative would be to remove compat.rb, since it's empty; but, with a name like compat.rb I'm sure there's a reason it exists :D

flash-gordon commented 2 years ago

There is, it's probably kept to avoid a breaking change on a minor version update. It's a guess, though.

Thank you!

solnic commented 2 years ago

compat.rb was added prior 1.0 when we removed a bunch of build in types (form stuff). It should be OK to remove this file now.