Module: Jade::Frontend::TypeChecking::Inference::Literal

Extended by:
Helpers, Literal
Included in:
Literal
Defined in:
lib/jade/frontend/type_checking/inference/literal.rb

Instance Method Summary collapse

Methods included from Helpers

check, generalize, instantiate, type_from_symbol, unify

Instance Method Details

#infer(node, registry, state, _) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/jade/frontend/type_checking/inference/literal.rb', line 9

def infer(node, registry, state, _)
  symbol =
    case node
    in AST::Literal | AST::CharLiteral
      node.symbol
    end

  type_from_symbol(symbol, registry, state.env.var_gen)
    .then { [state, Result.init(*it)] }
end