Class: BELParser::Language::Semantics::SemanticsInvalidReturnTypeWarning

Inherits:
SemanticsWarning show all
Defined in:
lib/bel_parser/language/semantics_ast_warnings.rb

Instance Attribute Summary

Attributes inherited from SemanticsResult

#expression_node, #specification

Instance Method Summary collapse

Methods inherited from SemanticsWarning

#failure?, #success?

Methods inherited from SemanticsResult

#failure?, #msg, #success?

Constructor Details

#initialize(expression_node, spec, expected_return_types) ⇒ SemanticsInvalidReturnTypeWarning

Returns a new instance of SemanticsInvalidReturnTypeWarning.



122
123
124
125
# File 'lib/bel_parser/language/semantics_ast_warnings.rb', line 122

def initialize(expression_node, spec, expected_return_types)
  super(expression_node, spec)
  @expected_return_types = expected_return_types
end

Instance Method Details

#to_sObject



127
128
129
130
# File 'lib/bel_parser/language/semantics_ast_warnings.rb', line 127

def to_s
  function = @expression_node.string_literal
  %(Function of "#{function}" does not match return types: #{@expected_return_types.map(&:to_sym).join(', ')})
end