Class: Jade::Error
- Inherits:
-
Object
- Object
- Jade::Error
- 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::DuplicateImplementation, 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::PlaceholderNotAllowed, 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::PortNotEncodable, Frontend::TypeChecking::Error::TypeMismatch, Frontend::TypeChecking::Error::UnresolvedConstraint, Parsing::Error
Instance Attribute Summary collapse
-
#entry ⇒ Object
readonly
Returns the value of attribute entry.
-
#span ⇒ Object
readonly
Returns the value of attribute span.
Instance Method Summary collapse
- #candidates ⇒ Object
-
#initialize(entry:, span:, **rest) ⇒ Error
constructor
A new instance of Error.
- #label ⇒ Object
- #message ⇒ Object
- #notes ⇒ Object
- #queried_name ⇒ Object
- #secondary ⇒ Object
- #to_diagnostic(registry = nil, source: nil) ⇒ Object
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 (readonly)
Returns the value of attribute entry.
5 6 7 |
# File 'lib/jade/error.rb', line 5 def entry @entry end |
#span ⇒ Object (readonly)
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
32 33 34 |
# File 'lib/jade/error.rb', line 32 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 fail NotImplementedError end |
#notes ⇒ Object
20 21 22 |
# File 'lib/jade/error.rb', line 20 def notes [] end |
#queried_name ⇒ Object
28 29 30 |
# File 'lib/jade/error.rb', line 28 def queried_name nil end |
#secondary ⇒ Object
24 25 26 |
# File 'lib/jade/error.rb', line 24 def secondary [] end |
#to_diagnostic(registry = nil, source: nil) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/jade/error.rb', line 36 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( , primary: Jade::Diagnostics::Label[source, span, label], secondary: secondary.map { |sp, text| Jade::Diagnostics::Label[source, sp, text] }, annotations: notes + did_you_mean_notes, ) end |