Exception: Emfrp::Typing::TypeMatchingError

Inherits:
CompileError
  • Object
show all
Defined in:
lib/emfrp/typing/typing_error.rb

Instance Attribute Summary

Attributes inherited from CompileError

#factors, #message

Instance Method Summary collapse

Methods inherited from CompileError

#collect_factor_tags, #factor_name, #find_factor_file_name, #print_lexical_factor, #tag_comp

Constructor Details

#initialize(code, expected_utype, real_utype, place, *factors) ⇒ TypeMatchingError

Returns a new instance of TypeMatchingError.



7
8
9
10
11
12
13
# File 'lib/emfrp/typing/typing_error.rb', line 7

def initialize(code, expected_utype, real_utype, place, *factors)
  @code = code
  @expected_utype = expected_utype
  @real_utype = real_utype
  @place = place
  @factors = factors
end

Instance Method Details

#codeObject



15
16
17
# File 'lib/emfrp/typing/typing_error.rb', line 15

def code
  @code
end


19
20
21
22
23
24
25
26
# File 'lib/emfrp/typing/typing_error.rb', line 19

def print_error(output_io, file_loader)
  output_io << "[Type Matching Error]".colorize(:red) + ": For #{@place}:\n"
  output_io << "Expected: " + "#{@expected_utype.inspect}".colorize(:green) + "\n"
  output_io << "Real: " + "#{@real_utype.inspect}".colorize(:green) + "\n"
  @factors.each do |factor|
    print_lexical_factor(factor, output_io, file_loader)
  end
end