We use typing heavily, type checked by Steep. We also use FFI as a dependency.
Previously we typed the minimum amount of FFI things and vendored our version of it with a plan to upstream, but we were ninja'd! See #1039 (comment)
Now, with ffi 1.17.0 packaging sig we'd be happy to use those, but there are some oddities that make Steep balk.
To wit:
sig/ffi/struct.rbs:23:29: [error] Type application of `::FFI::Type::Mapped` doesn't satisfy the constraints: ::FFI::Struct::ManagedStructConverter[::FFI::ManagedStruct[::FFI::AutoPointer, untyped], ::FFI::AutoPointer] <: ::FFI::_DataConverter[::FFI::Pointer, instance, untyped]
│ Diagnostic ID: RBS::UnsatisfiableTypeApplication
│
└ def self.auto_ptr: () -> Type::Mapped[
~~~~~~~~~~~~~
sig/ffi/struct.rbs:5:15: [error] Type application of `::FFI::Type::Mapped` doesn't satisfy the constraints: ::FFI::StructByReference[::FFI::Struct[::FFI::AbstractMemory, untyped], ::FFI::AbstractMemory] <: ::FFI::_DataConverter[::FFI::AbstractMemory, instance, untyped]
│ Diagnostic ID: RBS::UnsatisfiableTypeApplication
│
└ type ptr = Type::Mapped[
~~~~~~~~~~~~~
sig/ffi/auto_pointer.rbs:15:65: [error] Type application of `::FFI::AutoPointer::Releaser::_Proc` doesn't satisfy the constraints: self <: ::FFI::Pointer
│ Diagnostic ID: RBS::UnsatisfiableTypeApplication
│
└ def initialize: (Pointer pointer, Method | ^(self) -> void | Releaser::_Proc[self] callable) -> self
~~~~~~~~~~~~~~~~~~~~~
sig/ffi/library.rbs:36:45: [error] Type `::FFI::DataConverter` is generic but used as a non generic type
│ Diagnostic ID: RBS::InvalidTypeApplication
│
└ def typedef: [T < Type] (T old, Symbol | DataConverter add, ?untyped) -> T
~~~~~~~~~~~~~
Detected 4 problems from 3 files
These issues come from ffi itself, and can be reproduced with:
# add steep next to rbs
ruby -i -n -e "\$_ =~ /^(\s*gem 'rbs', '~> 3.0')/ and puts \"gem 'steep'\"; puts \$_" Gemfile
# install
bundle install
# set up steep
cat > Steepfile <<'STEEP'
target :lib do
signature "sig"
check "lib"
ignore "lib" # don't check rb, as it fails currently
end
STEEP
# run check, which will only process rbs due to the ignore above
bundle exec steep check
We use typing heavily, type checked by Steep. We also use FFI as a dependency.
Previously we typed the minimum amount of FFI things and vendored our version of it with a plan to upstream, but we were ninja'd! See #1039 (comment)
Now, with
ffi1.17.0 packagingsigwe'd be happy to use those, but there are some oddities that make Steep balk.To wit:
These issues come from
ffiitself, and can be reproduced with: