A Message
contains all semantic information necessary to easily comprehend what caused the message to be logged. Each message can be turned into a Diagnostic
which contains the log level and can later be consumed by a subclass of Reporter
. However, the error position is only part of Diagnostic
, not Message
.
NOTE: you should not persist a message directly, because most messages take an implicit Context
and these contexts weigh in at about 4mb per instance. Therefore, persisting these will result in a memory leak.
Instead use the persist
method to create an instance that does not keep a reference to these contexts.
Value parameters
- errorId
-
a unique id identifying the message, this will be used to reference documentation online Messages modify the rendendering of interpolated strings in several ways:
- The size of the printed code is limited with a MessafeLimiter. If the message would get too large or too deeply nested, a
...
is printed instead. - References to module classes are prefixed with
object
for better recogniability. - A where clause is sometimes added which contains the following additional explanations:
- Rerences are disambiguated: If a message contains occurrences of the same identifier representing different symbols, the duplicates are printed with superscripts and the where-clause explains where each symbol is located.
- Uninstantiated variables are explained in the where-clause with additional info about their bounds.
- Skolems are explained with additional info about their underlying type. Messages inheriting from the NoDisambiguation trait or returned from the
noDisambiguation()
method skip point (3) above. This makes sense if the message already exolains where different occurrences of the same identifier are located. Examples are NamingMsgs such as double definition errors, overriding errors, and ambiguous implicit errors. We consciously made the design decision to disambiguate by default and disable disambiguation as an opt-in. The reason is that one usually does not consider all fine-grained details when writing an error message. If disambiguation is the default, some tests will show where clauses that look too noisy and that then can be disabled when needed. But if silence is the default, one usually does not realize that better info could be obtained by turning disambiguation on.
- The size of the printed code is limited with a MessafeLimiter. If the message would get too large or too deeply nested, a
Attributes
- Companion
- object
- Graph
-
- Supertypes
- Known subtypes
-
class CyclicMsgclass CyclicReferenceInvolvingclass DeclarationMsgclass IllegalSuperAccessorclass OverloadInRefinementclass OverrideErrorclass OverridesNothingclass UnapplyInvalidReturnTypeclass MatchCaseUnreachableclass NamingMsgclass AlreadyDefinedclass CannotHaveSameNameAsclass DoubleDefinitionclass DuplicateBindclass PkgDuplicateSymboltrait NoDisambiguationclass AmbiguousExtensionMethodclass AmbiguousOverloadclass AmbiguousReferenceclass ConstrProxyShadowsclass NoExplanationclass NotFoundMsgclass MissingIdentclass NotAMemberclass PatternMatchExhaustivityclass PatternMatchMsgclass MatchCaseOnlyNullWarningclass UncheckedTypePatternclass ProperDefinitionNotFoundclass ReferenceMsgclass BadSymbolicReferenceclass CannotBeAccessedclass SuperQualMustBeParenttrait ShowMatchTraceclass MissingImplicitArgumentclass NotClassTypeclass NotConstantclass TypeMismatchMsgclass DoesNotConformToBoundclass DoesNotConformToSelfTypeclass IllegalParameterInitclass TypeMismatchclass SyntaxMsgclass CannotExtendAnyValclass CannotExtendJavaEnumclass CaseClassInInlinedCodeclass ClassCannotExtendEnumclass CyclicInheritanceclass DeprecatedWithOperatorclass EmptyCatchOrFinallyBlockclass EmptyCatchBlockclass ExpectedTokenButFoundclass ExtendFinalClassclass ExtensionCanOnlyHaveDefsclass IdentifierExpectedclass IllegalLiteralclass IllegalStartOfStatementclass IllegalStartSimpleExprclass ImplicitCaseClassclass ImportedTwiceclass InterpolatedStringErrorclass LazyStaticFieldclass MissingEmptyArgumentListclass MissingReturnTypeclass MissingTypeParameterForclass NoExtensionMethodAllowedclass NoReturnFromInlineableclass NotAnExtractorclass ObjectMayNotHaveSelfTypeclass OnlyClassesCanBeAbstractclass ParamsNoInlineclass RedundantModifierclass RepeatedModifierclass SeqWildcardPatternPosclass TailrecNotApplicableclass TopLevelImplicitClassclass TraitIsExpectedclass TraitsMayNotBeFinalclass TypeTestAlwaysDivergesclass UnableToEmitSwitchclass UnboundWildcardTypeclass UnimportedAndImportedclass VarArgsParamMustComeLastclass WrongNumberOfParametersclass WrongNumberOfTypeArgsclass TypeMsgclass JavaEnumParentArgsclass JavaSymbolIsNotAValueclass MatchTypeNoCasesclass MatchableWarningclass MissingArgumentclass MissingArgumentListclass NoMatchingOverloadclass NotAPathclass ReassignmentToValclass SkolemInInferredclass StableIdentPatternclass UnreducibleApplicationclass UnusedNonUnitValueclass ValueDiscarding
- Self type