lib/tapioca/compilers/symbol_table/symbol_generator.rb in tapioca-0.4.3 vs lib/tapioca/compilers/symbol_table/symbol_generator.rb in tapioca-0.4.4
- old
+ new
@@ -563,11 +563,11 @@
params += signature.kwarg_types.to_a
params << [signature.rest_name, signature.rest_type] if signature.has_rest
params << [signature.block_name, signature.block_type] if signature.block_name
params = params.compact.map { |name, type| "#{name}: #{type}" }.join(", ")
- returns = signature.return_type.to_s
+ returns = type_of(signature.return_type)
type_parameters = (params + returns).scan(TYPE_PARAMETER_MATCHER).flatten.uniq.map { |p| ":#{p}" }.join(", ")
type_parameters = ".type_parameters(#{type_parameters})" unless type_parameters.empty?
mode = case signature.mode
@@ -780,9 +780,14 @@
sig { params(method: T.any(UnboundMethod, Method)).returns(T.untyped) }
def signature_of(method)
T::Private::Methods.signature_for_method(method)
rescue LoadError, StandardError
nil
+ end
+
+ sig { params(constant: Module).returns(String) }
+ def type_of(constant)
+ constant.to_s.gsub(/\bAttachedClass\b/, "T.attached_class")
end
sig { params(constant: Module, other: BasicObject).returns(T::Boolean).checked(:never) }
def are_equal?(constant, other)
BasicObject.instance_method(:equal?).bind(constant).call(other)