Class: Jade::Frontend::SemanticAnalysis::Error::ConstructorNotFound

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

Instance Attribute Summary collapse

Attributes inherited from Error

#entry, #span

Instance Method Summary collapse

Methods inherited from Error

#notes, #to_diagnostic

Constructor Details

#initialize(entry, span, name:, exposed_type_module: nil, candidates: []) ⇒ ConstructorNotFound

Returns a new instance of ConstructorNotFound.



8
9
10
11
12
13
# File 'lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb', line 8

def initialize(entry, span, name:, exposed_type_module: nil, candidates: [])
  @name = name
  @exposed_type_module = exposed_type_module
  @candidates = candidates
  super(entry:, span:)
end

Instance Attribute Details

#candidatesObject (readonly)

Returns the value of attribute candidates.



6
7
8
# File 'lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb', line 6

def candidates
  @candidates
end

Instance Method Details

#labelObject



23
24
25
# File 'lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb', line 23

def label
  "not found"
end

#messageObject



15
16
17
18
19
20
21
# File 'lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb', line 15

def message
  base = "I cannot find a `#{@name}` constructor"
  return base unless @exposed_type_module

  "#{base}. The type `#{@name}` is exposed by `#{@exposed_type_module}` but its " \
    "constructor is private — add `#{@name}(..)` to that module's `exposing` list."
end

#queried_nameObject



27
28
29
# File 'lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb', line 27

def queried_name
  @name
end