Class: Jade::Frontend::SemanticAnalysis::Error::ConstructorNotFound
- Defined in:
- lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb
Defined Under Namespace
Classes: Hint
Instance Attribute Summary collapse
-
#candidates ⇒ Object
readonly
Returns the value of attribute candidates.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(entry, span, name:, hint: nil, candidates: []) ⇒ ConstructorNotFound
constructor
A new instance of ConstructorNotFound.
- #label ⇒ Object
- #message ⇒ Object
- #queried_name ⇒ Object
Methods inherited from Error
Constructor Details
#initialize(entry, span, name:, hint: nil, candidates: []) ⇒ ConstructorNotFound
Returns a new instance of ConstructorNotFound.
13 14 15 16 17 18 |
# File 'lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb', line 13 def initialize(entry, span, name:, hint: nil, candidates: []) @name = name @hint = hint @candidates = candidates super(entry:, span:) end |
Instance Attribute Details
#candidates ⇒ Object (readonly)
Returns the value of attribute candidates.
11 12 13 |
# File 'lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb', line 11 def candidates @candidates end |
Instance Method Details
#label ⇒ Object
38 39 40 |
# File 'lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb', line 38 def label "not found" end |
#message ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb', line 20 def base = "I cannot find a `#{@name}` constructor" case @hint in nil base in Hint(module_name:, type_name:, fix: :expose) "#{base}. The type `#{type_name}` is exposed by `#{module_name}` but its " \ "constructor is private — add `#{type_name}(..)` to that module's " \ "`exposing` list." in Hint(module_name:, type_name:, fix: :import) "#{base}. `#{module_name}` exposes it — add `#{type_name}(..)` to this " \ "module's `import #{module_name} exposing (...)`." end end |
#queried_name ⇒ Object
42 43 44 |
# File 'lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb', line 42 def queried_name @name end |