Class: Jade::Error
- Inherits:
-
Object
show all
- Defined in:
- lib/jade/error.rb
Direct Known Subclasses
Frontend::ForwardDeclaration::Error::BadImport, Frontend::ForwardDeclaration::Error::ExposedTypeNotFound, Frontend::ForwardDeclaration::Error::ExposedValueNotFound, Frontend::ForwardDeclaration::Error::ModuleNotFound, Frontend::ForwardDeclaration::Error::PrivateTypeExpansion, Frontend::ForwardDeclaration::Error::TupleArityOverflow, Frontend::ForwardDeclaration::Error::TypeNotFound, Frontend::ForwardDeclaration::Error::TypeNotLowerable, Frontend::ForwardDeclaration::Error::UnknownExtendsInterface, Frontend::SemanticAnalysis::Error::CircularExtends, Frontend::SemanticAnalysis::Error::ConstantNotCallable, Frontend::SemanticAnalysis::Error::ConstructorNotFound, Frontend::SemanticAnalysis::Error::ConstructorPatternArityMismatch, Frontend::SemanticAnalysis::Error::DuplicateField, Frontend::SemanticAnalysis::Error::DuplicateFunctionDeclaration, Frontend::SemanticAnalysis::Error::DuplicateRecordField, Frontend::SemanticAnalysis::Error::InvalidListRestPattern, Frontend::SemanticAnalysis::Error::KwargsOnNonConstructor, Frontend::SemanticAnalysis::Error::MissingExposingClause, Frontend::SemanticAnalysis::Error::MissingExtendsImplementation, Frontend::SemanticAnalysis::Error::MissingField, Frontend::SemanticAnalysis::Error::MissingImplementationFunction, Frontend::SemanticAnalysis::Error::ModuleNotFound, Frontend::SemanticAnalysis::Error::NestedTaskPort, Frontend::SemanticAnalysis::Error::NonTaskPort, Frontend::SemanticAnalysis::Error::OrphanImplementation, Frontend::SemanticAnalysis::Error::PredicateMustReturnBool, Frontend::SemanticAnalysis::Error::PredicateNameNotAllowed, Frontend::SemanticAnalysis::Error::ShadowingError, Frontend::SemanticAnalysis::Error::TypeArgsMismatch, Frontend::SemanticAnalysis::Error::TypeParamRequired, Frontend::SemanticAnalysis::Error::UnboundTypeVariable, Frontend::SemanticAnalysis::Error::UndefinedVariable, Frontend::SemanticAnalysis::Error::UnknownField, Frontend::SemanticAnalysis::Error::UnknownImplementationFunction, Frontend::SemanticAnalysis::Error::UnusedInterfaceTypeParam, Frontend::SemanticAnalysis::Error::ValueNotExposed, Frontend::SemanticAnalysis::Error::VariableNotFound, Frontend::TypeChecking::Error::DerivationFailed, Frontend::TypeChecking::Error::MissingImplementation, Frontend::TypeChecking::Error::MissingPatterns, Frontend::TypeChecking::Error::PortNotDecodable, Frontend::TypeChecking::Error::TypeMismatch, Frontend::TypeChecking::Error::UnresolvedConstraint, Parsing::Error
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(entry:, span:, **rest) ⇒ Error
Returns a new instance of Error.
7
8
9
10
|
# File 'lib/jade/error.rb', line 7
def initialize(entry:, span:, **rest)
@entry = entry
@span = span
end
|
Instance Attribute Details
#entry ⇒ Object
Returns the value of attribute entry.
5
6
7
|
# File 'lib/jade/error.rb', line 5
def entry
@entry
end
|
#span ⇒ Object
Returns the value of attribute span.
5
6
7
|
# File 'lib/jade/error.rb', line 5
def span
@span
end
|
Instance Method Details
#candidates ⇒ Object
28
29
30
|
# File 'lib/jade/error.rb', line 28
def candidates
[]
end
|
#label ⇒ Object
16
17
18
|
# File 'lib/jade/error.rb', line 16
def label
nil
end
|
#message ⇒ Object
12
13
14
|
# File 'lib/jade/error.rb', line 12
def message
fail NotImplementedError
end
|
#notes ⇒ Object
20
21
22
|
# File 'lib/jade/error.rb', line 20
def notes
[]
end
|
#queried_name ⇒ Object
24
25
26
|
# File 'lib/jade/error.rb', line 24
def queried_name
nil
end
|
#to_diagnostic(registry = nil, source: nil) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/jade/error.rb', line 32
def to_diagnostic(registry = nil, source: nil)
source ||=
case entry
when String then registry&.get(entry)&.source
else entry&.source
end
Jade::Diagnostics::Diagnostic.error(
message,
primary: Jade::Diagnostics::Label[source, span, label],
annotations: notes + did_you_mean_notes,
)
end
|