lib/raap/value/variable.rb in raap-0.3.0 vs lib/raap/value/variable.rb in raap-0.4.0

- old
+ new

@@ -2,10 +2,19 @@ module Value class Variable < BasicObject attr_reader :type def initialize(type) - @type = type + @type = + if type.respond_to?(:to_sym) + # @type var type: String | Symbol + ::RBS::Types::Variable.new(name: type.to_sym, location: nil) + else + type + end + unless @type.instance_of?(::RBS::Types::Variable) + ::Kernel.raise ::TypeError, "not a variable type: #{@type}" + end end def inspect = "#<var #{type}>" def class = Variable end