Prepending a module can cause `tapioca dsl` to produce an untyped signature
Los mantenedores suelen responder en 3 días
@KaanOzkan ya está trabajando en esto.
Desde el 25/8/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
A prepended module can cause Tapioca to not find the signature for a method, leading to it generating an untyped signature. Worse yet, this can cause a difference between how tapioca dsl and tapioca dsl Foo work:
tapioca dsldoes an eager load, which can load the Ruby file which prepends the module ontoFoo. The RBI will have an untyped signature.tapioca dsl Foodoesn't eager load, so it might not load the file which has the prepended module. The RBI will have a typed signature.
Cause
This stems from the behaviour of T::Utils.signature_for_method, which looks up a signature for a given owner_id/method_name pair. If a prepended module doesn't have a sig, it'll return nil` (even if the method it overrides does have a sig).
require "sorbet-runtime"
class Foo
extend T::Sig
sig { returns(String) }
def foo = "original"
end
p T::Utils.signature_for_instance_method(Foo, :foo) # => the real sig
module M
def foo = "prepended"
end
Foo.prepend(M)
p T::Utils.signature_for_instance_method(Foo, :foo) # => nil
Potential solutions
Keep searching until we find a sig
#: (UnboundMethod) -> [UnboundMethod, T::Private::Methods::Signature]
def first_signature(method)
while method
signature = T::Utils.signature_for_method(method)
return [method, signature] if signature
method = method.super_method
end
nil
end
method, sig = first_signature(Foo.instance_method(:foo))
p sig
This might be desirable in this case, but cause weirdness in other cases (e.g. when an method override doesn't have a sig, but its method parameter declaration differs from that of its parent method). Needs investigation.
- Lenguaje dominante
- Ruby
- Estrellas
- 873
- Forks
- 164
- Merge medio
- 4 d 19 h
- PR fusionados (30 d)
- 8
Preparar el entorno
Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Shopify/tapioca
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Shopify/tapioca#2662 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Improve `check-shims` performancePosiblemente ocupada @KaanOzkan la tomó hoy. Abierto
Shopify/tapioca#2728 · 1 asignado ·
Los mantenedores suelen responder en 3 días
-
ActiveRecordRelations cannot generate an RBI for an Active Record model with a composite primary keyAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 76/100
Los mantenedores suelen responder en 3 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
Los mantenedores suelen responder en 3 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Shopify/tapioca#2663 · 2 comentarios ·
Los mantenedores suelen responder en 3 días
Todos los issues de Shopify/tapioca
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
mastodon/mastodon#40755 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
L: docker L: elm L: github:actions L: helm L: ruby:bundler
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
dependabot/dependabot-core#16425 ·
Los mantenedores suelen responder en 2 días