dotty.tools.dotc.reporting
Members list
Type members
Classlikes
This class mixes in a few standard traits, so that it is easier to extend from Java.
This class mixes in a few standard traits, so that it is easier to extend from Java.
Attributes
- Supertypes
-
trait MessageRenderingtrait HideNonSensicalMessagestrait UniqueMessagePositionsclass Reportertrait ReporterResultclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class AbstractConsoleReporterclass ConsoleReporter
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class NamingMsgtrait NoDisambiguationclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait NoDisambiguationclass ReferenceMsgclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait NoDisambiguationclass ReferenceMsgclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait NoDisambiguationclass ReferenceMsgclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
Attributes
- Supertypes
Attributes
- Companion
- object
- Supertypes
-
class NamingMsgtrait NoDisambiguationclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
- Self type
-
CannotHaveSameNameAs.type
Attributes
- Supertypes
-
class NamingMsgtrait NoDisambiguationclass Messageclass Objecttrait Matchableclass AnyShow all
A representation of a code action / fix that can be used by tooling to apply a fix to their code.
A representation of a code action / fix that can be used by tooling to apply a fix to their code.
Value parameters
- description
-
An optional description of the fix.
- patches
-
The patches that this fix contains.
- title
-
The title of the fix, often showed to a user in their editor.
Attributes
- Supertypes
This class implements a Reporter that displays messages on a text console
This class implements a Reporter that displays messages on a text console
Attributes
- Companion
- object
- Supertypes
-
class AbstractConsoleReporterclass AbstractReportertrait MessageRenderingtrait HideNonSensicalMessagestrait UniqueMessagePositionsclass Reportertrait ReporterResultclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
- Self type
-
ConsoleReporter.type
Attributes
- Supertypes
-
trait NoDisambiguationclass ReferenceMsgclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
- Known subtypes
-
class CyclicReferenceInvolvingShow all
Attributes
- Supertypes
- Known subtypes
-
class IllegalSuperAccessorclass OverloadInRefinementclass OverrideErrorclass OverridesNothingclass UnapplyInvalidReturnTypeShow all
Attributes
- Companion
- class
- Supertypes
- Self type
-
Diagnostic.type
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
class Errorclass StickyErrorclass Infoclass Warningclass ConditionalWarningclass DeprecationWarningclass FeatureWarningclass UncheckedWarningclass MigrationWarningShow all
A utility object to support "did you mean" hinting
Attributes
- Supertypes
-
class TypeMismatchMsgtrait ShowMatchTraceclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class TypeMismatchMsgtrait ShowMatchTraceclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class TypeMismatchMsgtrait ShowMatchTraceclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class NamingMsgtrait NoDisambiguationclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class NamingMsgtrait NoDisambiguationclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class EmptyCatchOrFinallyBlockclass SyntaxMsgclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class EmptyCatchOrFinallyBlockclass SyntaxMsgclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
- Known subtypes
-
class EmptyCatchBlock
Unique IDs identifying the messages, this will be used to reference documentation online.
Unique IDs identifying the messages, this will be used to reference documentation online.
Value parameters
- isActive
-
Whether or not the compile still emits this ErrorMessageID
Attributes
- Companion
- object
- Supertypes
-
trait Enumtrait Producttrait Equalsclass Enum[ErrorMessageID]trait Serializabletrait Comparable[ErrorMessageID]class Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- enum
- Supertypes
- Self type
-
ErrorMessageID.type
A re-usable Reporter used in Contexts#test
A re-usable Reporter used in Contexts#test
Attributes
- Supertypes
-
class StoreReporterclass Reportertrait ReporterResultclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
Attributes
- Supertypes
This trait implements isHidden
so that we avoid reporting non-sensical messages.
This trait implements isHidden
so that we avoid reporting non-sensical messages.
Attributes
- Supertypes
- Known subtypes
Attributes
- Supertypes
-
class TypeMismatchMsgtrait ShowMatchTraceclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
Attributes
- Supertypes
Attributes
- Supertypes
Tips for error message generation
- You can use the
em
interpolator for error messages. It's defined in core.Decorators. - You can also use a simple string argument for
error
orwarning
(not for the other variants), but the string should not be interpolated or composed of objects that require a Context for evaluation. - When embedding interpolated substrings defined elsewhere in error messages, use
i
and make sure they are defined as def's instead of vals. That way, the possibly expensive interpolation will performed only in the case where the message is eventually printed. Note: At least during typer, it's common for messages to be discarded without being printed. Also, by making them defs, you ensure that they will be evaluated in the Message context, which makes formatting safer and more robust. - For common messages, or messages that might require explanation, prefer defining a new
Message
class in filemessages.scala
and use that instead. The advantage is that these messages have unique IDs that can be referenced elsewhere.
Attributes
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
.
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 MessageLimiter. 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 recognizability. - A where clause is sometimes added which contains the following additional explanations:
- References 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 MessageLimiter. If the message would get too large or too deeply nested, a
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
class CyclicMsgclass CyclicReferenceInvolvingclass DeclarationMsgclass IllegalSuperAccessorclass OverloadInRefinementclass OverrideErrorclass OverridesNothingclass UnapplyInvalidReturnTypeclass InlinedAnonClassWarningclass MatchCaseUnreachableclass NamingMsgclass AlreadyDefinedclass CannotHaveSameNameAsclass DoubleDefinitionclass DuplicateBindclass PkgDuplicateSymboltrait NoDisambiguationclass AmbiguousExtensionMethodclass AmbiguousOverloadclass AmbiguousReferenceclass ConstrProxyShadowsclass NoExplanationclass NotFoundMsgclass ExtractorNotFoundclass MissingIdentclass NotAMemberclass PatternMatchExhaustivityclass PatternMatchMsgclass MatchCaseOnlyNullWarningclass NotAnExtractorclass UncheckedTypePatternclass ProperDefinitionNotFoundclass PureUnitExpressionclass 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 FinalLocalDefclass IdentifierExpectedclass IllegalLiteralclass IllegalStartOfStatementclass IllegalStartSimpleExprclass ImplicitCaseClassclass ImportRenamedTwiceclass InterpolatedStringErrorclass LazyStaticFieldclass MissingEmptyArgumentListclass MissingReturnTypeclass MissingTypeParameterForclass NoExtensionMethodAllowedclass NoReturnFromInlineableclass ObjectMayNotHaveSelfTypeclass OnlyClassesCanBeAbstractclass ParamsNoInlineclass RedundantModifierclass RepeatedModifierclass SeqWildcardPatternPosclass TailrecNotApplicableclass TopLevelImplicitClassclass TraitIsExpectedclass TraitsMayNotBeFinalclass TypeTestAlwaysDivergesclass UnableToEmitSwitchclass UnboundWildcardTypeclass VarArgsParamMustComeLastclass VolatileOnValclass WrongNumberOfParametersclass WrongNumberOfTypeArgsclass TypeMsgclass JavaEnumParentArgsclass JavaSymbolIsNotAValueclass MatchableWarningclass MissingArgumentclass MissingArgumentListclass NoMatchingOverloadclass NotAPathclass ReassignmentToValclass SkolemInInferredclass StableIdentPatternclass UnreducibleApplicationclass UnusedNonUnitValueclass UnusedSymbolclass ValueDiscardingShow all
- Self type
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Message kinds that can be used in a Message. NOTE: Keep in mind that if you have a new message or a new ErrorMessageID that doesn't fit well into an existing kind, create a new one.
Message kinds that can be used in a Message. NOTE: Keep in mind that if you have a new message or a new ErrorMessageID that doesn't fit well into an existing kind, create a new one.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
- Known subtypes
Attributes
- Supertypes
Attributes
- Supertypes
Attributes
- Supertypes
- Known subtypes
-
class AlreadyDefinedclass CannotHaveSameNameAsclass DoubleDefinitionclass DuplicateBindclass PkgDuplicateSymbolShow all
A marker trait that suppresses generation of where
clause for disambiguations
A marker trait that suppresses generation of where
clause for disambiguations
Attributes
- Supertypes
- Known subtypes
-
class AmbiguousExtensionMethodclass AmbiguousOverloadclass AmbiguousReferenceclass ConstrProxyShadowsclass NamingMsgclass AlreadyDefinedclass CannotHaveSameNameAsclass DoubleDefinitionclass DuplicateBindclass PkgDuplicateSymbolclass OverrideErrorShow all
The extractor for NoExplanation
can be used to check whether any error lacks an explanation
The extractor for NoExplanation
can be used to check whether any error lacks an explanation
Attributes
- Companion
- class
- Supertypes
- Self type
-
NoExplanation.type
Attributes
- Supertypes
-
trait ShowMatchTraceclass NotFoundMsgclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
Attributes
- Supertypes
Attributes
- Supertypes
A simple not found message (either for idents, or member selection. Messages of this class are sometimes dropped in favor of other, more specific messages.
A simple not found message (either for idents, or member selection. Messages of this class are sometimes dropped in favor of other, more specific messages.
Attributes
- Supertypes
- Known subtypes
Attributes
- Supertypes
Attributes
- Supertypes
-
trait NoDisambiguationclass DeclarationMsgclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
Attributes
- Supertypes
Attributes
- Supertypes
-
class NamingMsgtrait NoDisambiguationclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
- Known subtypes
Attributes
- Supertypes
-
class NamingMsgtrait NoDisambiguationclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
class ActiveProfileobject NoProfile
Attributes
- Supertypes
- Known subtypes
-
class AmbiguousExtensionMethodclass AmbiguousOverloadclass AmbiguousReferenceclass BadSymbolicReferenceclass CannotBeAccessedclass ConstrProxyShadowsclass SuperQualMustBeParentShow all
This interface provides methods to issue information, warning and error messages.
This interface provides methods to issue information, warning and error messages.
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
class AbstractReporterclass AbstractConsoleReporterclass ConsoleReportertrait HideNonSensicalMessagesobject NoReporterclass StoreReporterclass ExploringReporterclass TestingReporterclass ThrowingReportertrait UniqueMessagePositionsShow all
Attributes
- Supertypes
- Known subtypes
-
class MissingImplicitArgumentclass NotAMemberclass NotClassTypeclass NotConstantclass TypeMismatchMsgclass DoesNotConformToBoundclass DoesNotConformToSelfTypeclass IllegalParameterInitclass TypeMismatchShow all
This class implements a Reporter that stores all messages
This class implements a Reporter that stores all messages
Beware that this reporter can leak memory, and force messages in two scenarios:
- During debugging
config.Printers.typr
is set fromnoPrinter
tonew Printer
, which forces the message - The reporter is not flushed and the message containers capture a
Context
(about 4MB)
Attributes
- Supertypes
- Known subtypes
-
class ExploringReporterclass TestingReporter
Attributes
- Supertypes
Attributes
- Supertypes
The role of messages is to provide the necessary details for a simple to understand diagnostic event. Each message can be turned into a message container (one of the above) by calling the appropriate method on them. For instance:
Messages
The role of messages is to provide the necessary details for a simple to understand diagnostic event. Each message can be turned into a message container (one of the above) by calling the appropriate method on them. For instance:
EmptyCatchBlock(tree).error(pos) // res: Error
EmptyCatchBlock(tree).warning(pos) // res: Warning
Attributes
- Supertypes
- Known subtypes
-
class CannotExtendAnyValclass CannotExtendJavaEnumclass CaseClassInInlinedCodeclass ClassCannotExtendEnumclass CyclicInheritanceclass DeprecatedWithOperatorclass EmptyCatchOrFinallyBlockclass EmptyCatchBlockclass ExpectedTokenButFoundclass ExtendFinalClassclass ExtensionCanOnlyHaveDefsclass FinalLocalDefclass IdentifierExpectedclass IllegalLiteralclass IllegalStartOfStatementclass IllegalStartSimpleExprclass ImplicitCaseClassclass ImportRenamedTwiceclass InterpolatedStringErrorclass LazyStaticFieldclass MissingEmptyArgumentListclass MissingReturnTypeclass MissingTypeParameterForclass NoExtensionMethodAllowedclass NoReturnFromInlineableclass ObjectMayNotHaveSelfTypeclass OnlyClassesCanBeAbstractclass ParamsNoInlineclass RedundantModifierclass RepeatedModifierclass SeqWildcardPatternPosclass TailrecNotApplicableclass TopLevelImplicitClassclass TraitIsExpectedclass TraitsMayNotBeFinalclass TypeTestAlwaysDivergesclass UnableToEmitSwitchclass UnboundWildcardTypeclass VarArgsParamMustComeLastclass VolatileOnValclass WrongNumberOfParametersclass WrongNumberOfTypeArgsShow all
A re-usable Reporter used in Contexts#test
A re-usable Reporter used in Contexts#test
Attributes
- Supertypes
-
class StoreReporterclass Reportertrait ReporterResultclass Objecttrait Matchableclass AnyShow all
This class implements a Reporter that throws all errors as UnhandledError exceptions and sends warnings and other info to the underlying reporter.
This module is carefully optimized to give zero overhead if Config.tracingEnabled is false. The trace
operation is called in various hotspots, so every tiny bit of overhead is unacceptable: boxing, closures, additional method calls are all out.
This module is carefully optimized to give zero overhead if Config.tracingEnabled is false. The trace
operation is called in various hotspots, so every tiny bit of overhead is unacceptable: boxing, closures, additional method calls are all out.
Attributes
- Supertypes
- Known subtypes
Attributes
- Supertypes
Attributes
- Supertypes
-
class TypeMismatchMsgtrait ShowMatchTraceclass Messageclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
- Known subtypes
-
class DoesNotConformToBoundclass DoesNotConformToSelfTypeclass IllegalParameterInitclass TypeMismatch
Attributes
- Supertypes
- Known subtypes
-
class JavaEnumParentArgsclass JavaSymbolIsNotAValueclass MatchableWarningclass MissingArgumentclass MissingArgumentListclass MissingImplicitArgumentclass NoMatchingOverloadclass NotAPathclass NotClassTypeclass NotConstantclass ReassignmentToValclass SkolemInInferredclass StableIdentPatternclass UnreducibleApplicationShow all
Attributes
- Supertypes
Attributes
- Supertypes
Attributes
- Supertypes
This trait implements isHidden
so that multiple messages per position are suppressed, unless they are of increasing severity.
This trait implements isHidden
so that multiple messages per position are suppressed, unless they are of increasing severity.
Attributes
- Supertypes
- Known subtypes
Attributes
- Supertypes
Attributes
- Companion
- class
- Supertypes
- Self type
-
UnusedSymbol.type
Attributes
- Companion
- object
- Supertypes
Exposes the
Exposes the
trace("question") { op }
syntax.
Traced operations will print indented messages if enabled. Tracing depends on Config.tracingEnabled and dotty.tools.dotc.config.ScalaSettings.Ylog. Tracing can be forced by replacing trace with trace.force or trace.log (see below).
Attributes
- Supertypes
- Self type
-
trace.type