class TypeProf::Core::AST::SigFuncType::SigTyAliasNode::SigTyUnionNode::SigTyIntersectionNode::SigTySingletonNode::SigTyInstanceNode::SigTyTupleNode::SigTyRecordNode::SigTyVarNode::SigTyOptionalNode::SigTyLiteralNode
Attributes
Public Class Methods
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/sig_type.rb, line 871 def initialize(raw_decl, lenv) super(raw_decl, lenv) @lit = raw_decl.literal end
Calls superclass method
TypeProf::Core::AST::Node::new
Public Instance Methods
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/sig_type.rb, line 877 def attrs = { lit: } def get_type(genv) case @lit when ::Symbol Type::Symbol.new(genv, @lit) when ::Integer then genv.int_type when ::String then genv.str_type when ::TrueClass then genv.true_type when ::FalseClass then genv.false_type else raise "unknown RBS literal: #{ @lit.inspect }" end end def covariant_vertex0(genv, changes, vtx, subst) changes.add_edge(genv, Source.new(get_type(genv)), vtx) end def contravariant_vertex0(genv, changes, vtx, subst) changes.add_edge(genv, Source.new(get_type(genv)), vtx) end def typecheck(genv, changes, vtx, subst) if @lit.is_a?(::Symbol) changes.add_edge(genv, vtx, changes.target) vtx.each_type do |ty| case ty when Type::Symbol return true if ty.sym == @lit end end return false end f_mod = get_type(genv).mod AST.typecheck_for_module(genv, changes, f_mod, [], vtx, subst) end def show @lit.inspect end end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/sig_type.rb, line 896 def contravariant_vertex0(genv, changes, vtx, subst) changes.add_edge(genv, Source.new(get_type(genv)), vtx) end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/sig_type.rb, line 892 def covariant_vertex0(genv, changes, vtx, subst) changes.add_edge(genv, Source.new(get_type(genv)), vtx) end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/sig_type.rb, line 879 def get_type(genv) case @lit when ::Symbol Type::Symbol.new(genv, @lit) when ::Integer then genv.int_type when ::String then genv.str_type when ::TrueClass then genv.true_type when ::FalseClass then genv.false_type else raise "unknown RBS literal: #{ @lit.inspect }" end end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/sig_type.rb, line 915 def show @lit.inspect end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/sig_type.rb, line 900 def typecheck(genv, changes, vtx, subst) if @lit.is_a?(::Symbol) changes.add_edge(genv, vtx, changes.target) vtx.each_type do |ty| case ty when Type::Symbol return true if ty.sym == @lit end end return false end f_mod = get_type(genv).mod AST.typecheck_for_module(genv, changes, f_mod, [], vtx, subst) end