Class: Jade::Frontend::ForwardDeclaration::Error::TupleArityOverflow

Inherits:
Error
  • Object
show all
Defined in:
lib/jade/frontend/forward_declaration/error/tuple_arity_overflow.rb

Constant Summary collapse

MAX_ARITY =
4

Instance Attribute Summary

Attributes inherited from Error

#entry, #span

Instance Method Summary collapse

Methods inherited from Error

#candidates, #notes, #queried_name, #to_diagnostic

Constructor Details

#initialize(entry, span, arity:) ⇒ TupleArityOverflow

Returns a new instance of TupleArityOverflow.



8
9
10
11
# File 'lib/jade/frontend/forward_declaration/error/tuple_arity_overflow.rb', line 8

def initialize(entry, span, arity:)
  super(entry:, span:)
  @arity = arity
end

Instance Method Details

#labelObject



18
19
20
# File 'lib/jade/frontend/forward_declaration/error/tuple_arity_overflow.rb', line 18

def label
  "#{@arity}-tuple"
end

#messageObject



13
14
15
16
# File 'lib/jade/frontend/forward_declaration/error/tuple_arity_overflow.rb', line 13

def message
  "Tuple of #{@arity} items is too big — tuples cap at #{MAX_ARITY}. " \
    "Use a record or a struct."
end