Merge pull request #10381 from jonchang/fix-version-type

version: fix type signature
This commit is contained in:
Jonathan Chang 2021-01-22 17:33:21 +11:00 committed by GitHub
commit 3c84e1fef3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
# typed: true # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "pkg_version"
require "version/null" require "version/null"
# A formula's version. # A formula's version.
@ -509,7 +510,7 @@ class Version
end end
private_class_method :_parse private_class_method :_parse
sig { params(val: T.any(String, Version), detected_from_url: T::Boolean).void } sig { params(val: T.any(PkgVersion, String, Version), detected_from_url: T::Boolean).void }
def initialize(val, detected_from_url: false) def initialize(val, detected_from_url: false)
raise TypeError, "Version value must be a string; got a #{val.class} (#{val})" unless val.respond_to?(:to_str) raise TypeError, "Version value must be a string; got a #{val.class} (#{val})" unless val.respond_to?(:to_str)