trait TypeDiagnostics extends SplainDiagnostics
An interface to enable higher configurability of diagnostic messages regarding type errors. This is barely a beginning as error messages are distributed far and wide across the codebase. The plan is to partition error messages into some broad groups and provide some mechanism for being more or less verbose on a selective basis. Possible groups include such examples as
arity errors kind errors variance errors ambiguity errors volatility/stability errors implementation restrictions
And more, and there is plenty of overlap, so it'll be a process.
- Self Type
- Analyzer with StdAttachments
- Source
- TypeDiagnostics.scala
- Alphabetic
- By Inheritance
- TypeDiagnostics
- SplainDiagnostics
- SplainFormatting
- SplainFormatters
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Type Members
- case class TypeDiag(tp: Global.Type, sym: Global.Symbol) extends Ordered[(TypeDiagnostics.this)#TypeDiag] with Product with Serializable
- trait TyperDiagnostics extends AnyRef
- class UnusedPrivates extends Global.Traverser
- class checkUnused extends AnyRef
- trait SpecialFormatter extends AnyRef
- Definition Classes
- SplainFormatters
- case class TypeParts(sym: Global.Symbol, tt: Global.Type) extends Product with Serializable
- Definition Classes
- SplainFormatting
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from TypeDiagnostics toany2stringadd[TypeDiagnostics] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ->[B](y: B): (TypeDiagnostics, B)
- Implicit
- This member is added by an implicit conversion from TypeDiagnostics toArrowAssoc[TypeDiagnostics] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def abstractVarMessage(sym: Global.Symbol): String
An explanatory note to be added to error messages when there's a problem with abstract var defs
- def alternatives(tree: Global.Tree): List[Global.Type]
- def alternativesString(tree: Global.Tree): String
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def bracket[A](params: List[A]): String
- Definition Classes
- SplainFormatting
- def breakInfix(types: List[Formatted]): TypeRepr
Break a list produced by flattenInfix into lines by taking two elements at a time, then appending the terminal.
Break a list produced by flattenInfix into lines by taking two elements at a time, then appending the terminal. If the expression's length is smaller than the threshold specified via plugin parameter, return a single line.
- Definition Classes
- SplainFormatting
- val breakInfixLength: Int
- Definition Classes
- SplainFormatting
- def builtinFoundReqMsg(found: Global.Type, req: Global.Type): String
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def ctorNames(tpe: Global.Type): List[String]
- Definition Classes
- SplainFormatting
- def dealias(tpe: Global.Type): Global.Type
- Definition Classes
- SplainFormatting
- def decideBreak(flat: FlatType, broken: => BrokenType): TypeRepr
- Definition Classes
- SplainFormatting
- def decodeWithKind(name: Global.Name, owner: Global.Symbol): String
- def deepestLevel(chain: List[(TypeDiagnostics.this)#ImplicitError]): Int
- Definition Classes
- SplainFormatting
- def disambiguate(ss: List[String]): collection.immutable.List[String]
- def ensuring(cond: (TypeDiagnostics) => Boolean, msg: => Any): TypeDiagnostics
- Implicit
- This member is added by an implicit conversion from TypeDiagnostics toEnsuring[TypeDiagnostics] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (TypeDiagnostics) => Boolean): TypeDiagnostics
- Implicit
- This member is added by an implicit conversion from TypeDiagnostics toEnsuring[TypeDiagnostics] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): TypeDiagnostics
- Implicit
- This member is added by an implicit conversion from TypeDiagnostics toEnsuring[TypeDiagnostics] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): TypeDiagnostics
- Implicit
- This member is added by an implicit conversion from TypeDiagnostics toEnsuring[TypeDiagnostics] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def exampleTuplePattern(names: List[Global.Name]): String
[a, b, c] => "(a, b, c)" [a, B] => "(param1, param2)" [a, B, c] => "(param1, ..., param2)"
- def existentialContext(tp: Global.Type): String
- def explainAlias(tp: Global.Type): String
- def explainAnyVsAnyRef(found: Global.Type, req: Global.Type): String
- def explainVariance(found: Global.Type, req: Global.Type): String
Look through the base types of the found type for any which might have been valid subtypes if given conformant type arguments.
Look through the base types of the found type for any which might have been valid subtypes if given conformant type arguments. Examine those for situations where the type error would have been eliminated if the variance were different. In such cases, append an additional explanatory message.
TODO: handle type aliases better.
- Annotations
- @nowarn()
- def extractArgs(tpe: Global.Type): collection.immutable.List[Global.Type]
- Definition Classes
- SplainFormatting
- def finalOwners(tpe: Global.Type): Boolean
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def flattenInfix(tpe: Infix): List[Formatted]
Turn a nested infix type structure into a flat list
Turn a nested infix type structure into a flat list
::[A, ::[B, C]]] => List(A, ::, B, ::, C)
- Definition Classes
- SplainFormatting
- def formatAuxSimple(tpe: Global.Type): (List[String], String)
- Definition Classes
- SplainFormatting
- def formatDiff(left: Global.Type, right: Global.Type, top: Boolean): Formatted
- Definition Classes
- SplainFormatting
- val formatDiffCache: FormatCache[(Global.Type, Global.Type, Boolean), Formatted]
- Definition Classes
- SplainFormatting
- def formatDiffImpl(found: Global.Type, req: Global.Type, top: Boolean): Formatted
- Definition Classes
- SplainFormatting
- def formatDiffInfix(left: Global.Type, right: Global.Type, top: Boolean): Formatted
- Definition Classes
- SplainFormatting
- def formatDiffSimple(left: Global.Type, right: Global.Type): Formatted
- Definition Classes
- SplainFormatting
- def formatDiffSpecial(left: Global.Type, right: Global.Type, top: Boolean): Option[Formatted]
- Definition Classes
- SplainFormatting
- def formatFunction(args: List[String]): String
- Definition Classes
- SplainFormatting
- def formatImplicitChain(chain: List[(TypeDiagnostics.this)#ImplicitError]): List[String]
- Definition Classes
- SplainFormatting
- def formatImplicitChainFlat(chain: List[(TypeDiagnostics.this)#ImplicitError]): List[String]
- Definition Classes
- SplainFormatting
- def formatImplicitChainTreeCompact(chain: List[(TypeDiagnostics.this)#ImplicitError]): Option[List[String]]
- Definition Classes
- SplainFormatting
- def formatImplicitChainTreeFull(chain: List[(TypeDiagnostics.this)#ImplicitError]): List[String]
- Definition Classes
- SplainFormatting
- def formatImplicitError(param: Global.Symbol, errors: List[(TypeDiagnostics.this)#ImplicitError], annotationMsg: String): String
- Definition Classes
- SplainFormatting
- def formatIndentTree(chain: List[(TypeDiagnostics.this)#ImplicitError], baseIndent: Int): List[String]
- Definition Classes
- SplainFormatting
- def formatInfix[A](path: List[String], simple: String, left: A, right: A, top: Boolean)(rec: (A, Boolean) => Formatted): Formatted
- Definition Classes
- SplainFormatting
- def formatNestedImplicit(err: (TypeDiagnostics.this)#ImplicitError): (String, List[String], Int)
- Definition Classes
- SplainFormatting
- def formatNestedImplicits(errors: List[(TypeDiagnostics.this)#ImplicitError]): collection.immutable.List[String]
Remove duplicates and special cases that should not be shown.
Remove duplicates and special cases that should not be shown. In some cases, candidates are reported twice, once as
Foo.f
and once asf
.ImplicitError.equals
checks the simple names for identity, which is suboptimal, but works for 99% of cases. Special cases are handled in hideImpError- Definition Classes
- SplainFormatting
- def formatNonConfBounds(err: NonconformantBounds): List[String]
- Definition Classes
- SplainFormatting
- def formatNormalSimple(tpe: Global.Type): (List[String], String)
- Definition Classes
- SplainFormatting
- def formatRefinement(sym: Global.Symbol): String
- Definition Classes
- SplainFormatting
- def formatSimpleType(tpe: Global.Type): (List[String], String)
- Definition Classes
- SplainFormatting
- def formatSpecial[A](tpe: Global.Type, simple: String, args: List[A], formattedArgs: => List[Formatted], top: Boolean)(rec: (A, Boolean) => Formatted): Option[Formatted]
- Definition Classes
- SplainFormatting
- def formatType(tpe: Global.Type, top: Boolean): Formatted
- Definition Classes
- SplainFormatting → SplainFormatters
- val formatTypeCache: FormatCache[(Global.Type, Boolean), Formatted]
- Definition Classes
- SplainFormatting
- def formatTypeImpl(tpe: Global.Type, top: Boolean): Formatted
- Definition Classes
- SplainFormatting
- def formatWithInfix[A](tpe: Global.Type, args: List[A], top: Boolean)(rec: (A, Boolean) => Formatted): Formatted
- Definition Classes
- SplainFormatting
- def formattedDiff(left: Formatted, right: Formatted): String
- Definition Classes
- SplainFormatting
- def foundReqMsg(found: Global.Type, req: Global.Type): String
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hideImpError(error: (TypeDiagnostics.this)#ImplicitError): Boolean
- Definition Classes
- SplainFormatting
- def implicitMessage(param: Global.Symbol, annotationMsg: String): List[String]
- Definition Classes
- SplainFormatting
- def indent(lines: List[String], n: Int = 1, prefix: String = " "): collection.immutable.List[String]
- Definition Classes
- SplainFormatting
- def indentLine(line: String, n: Int = 1, prefix: String = " "): String
- Definition Classes
- SplainFormatting
- def indentTree(tree: List[(String, List[String], Int)], baseIndent: Int): List[String]
- Definition Classes
- SplainFormatting
- def isAux(tpe: Global.Type): Boolean
- Definition Classes
- SplainFormatting
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isRefined(tpe: Global.Type): Boolean
- Definition Classes
- SplainFormatting
- def isSymbolic(tpe: Global.Type): Boolean
- Definition Classes
- SplainFormatting
- def linePrecedes(t1: Global.Tree, t2: Global.Tree): Boolean
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def pathPrefix: (List[String]) => String
- Definition Classes
- SplainFormatting
- def posPrecedes(p1: Global.Position, p2: Global.Position): Boolean
Does the positioned line assigned to t1 precede that of t2?
- def qualifiedName(path: List[String], name: FormattedName): String
- Definition Classes
- SplainFormatting
- final def recursivelyFinal(tpe: Global.Type): Boolean
- Annotations
- @tailrec()
- def restrictionError(pos: Global.Position, unit: Global.CompilationUnit, msg: String): Unit
- def restrictionWarning(pos: Global.Position, unit: Global.CompilationUnit, msg: String, category: WarningCategory, site: Global.Symbol): Unit
For errors which are artifacts of the implementation: such messages indicate that the restriction may be lifted in the future.
- def sanitizePath(path: List[String]): List[String]
- Definition Classes
- SplainFormatting
- def setAddendum(pos: Global.Position, msg: () => String): Unit
- def showFormatted(tpe: Formatted): String
- Definition Classes
- SplainFormatting
- def showFormattedL(tpe: Formatted, break: Boolean): TypeRepr
- Definition Classes
- SplainFormatting
- val showFormattedLCache: FormatCache[(Formatted, Boolean), TypeRepr]
- Definition Classes
- SplainFormatting
- def showFormattedLImpl(tpe: Formatted, break: Boolean): TypeRepr
- Definition Classes
- SplainFormatting
- def showFormattedQualified(path: List[String], name: FormattedName): TypeRepr
- Definition Classes
- SplainFormatting
- def showFuncParams(args: List[String]): String
- Definition Classes
- SplainFormatting
- def showRefined(parents: List[String], decls: List[String]): String
- Definition Classes
- SplainFormatting
- def showTuple(args: List[String]): String
- Definition Classes
- SplainFormatting
- def showType(tpe: Global.Type): String
- Definition Classes
- SplainFormatting
- def showTypeApply(cons: String, args: List[TypeRepr], break: Boolean): TypeRepr
If the args of an applied type constructor are multiline, create separate lines for the constructor name and the closing bracket; else return a single line.
If the args of an applied type constructor are multiline, create separate lines for the constructor name and the closing bracket; else return a single line.
- Definition Classes
- SplainFormatting
- def showTypeBreakL(tpe: Global.Type): List[String]
- Definition Classes
- SplainFormatting
- val specialFormatters: List[(TypeDiagnostics.this)#SpecialFormatter]
- Definition Classes
- SplainFormatting
- def splainFoundReqMsg(found: Global.Type, req: Global.Type): String
- Definition Classes
- SplainDiagnostics
- def splitChains(errors: List[(TypeDiagnostics.this)#ImplicitError]): List[List[(TypeDiagnostics.this)#ImplicitError]]
- Definition Classes
- SplainFormatting
- def stripModules(path: List[String], name: FormattedName): String
- Definition Classes
- SplainFormatting
- def stripType(tpe: Global.Type): (List[String], String)
- Definition Classes
- SplainFormatting
- def symbolPath(sym: Global.Symbol): List[String]
- Definition Classes
- SplainFormatting
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def treeSymTypeMsg(tree: Global.Tree): String
- def truncateDecls(decls: List[Formatted]): Boolean
- Definition Classes
- SplainFormatting
- def typePatternAdvice(sym: Global.Symbol, ptSym: Global.Symbol): String
- def typingInPattern[T](body: => T): T
Devising new ways of communicating error info out of desperation to work on error messages.
Devising new ways of communicating error info out of desperation to work on error messages. This is used by typedPattern to wrap its business so we can generate a sensible error message when things go south.
- def underlyingSymbol(member: Global.Symbol): Global.Symbol
The symbol which the given accessor represents (possibly in part).
The symbol which the given accessor represents (possibly in part). This is used for error messages, where we want to speak in terms of the actual declaration or definition, not in terms of the generated setters and getters.
TODO: is it wise to create new symbols simply to generate error message? is this safe in interactive/resident mode?
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def withAddendum(pos: Global.Position): (String) => String
- def withDisambiguation[T](locals: List[Global.Symbol], types: Global.Type*)(op: => T): T
Given any number of types, alters the name information in the symbols until they can be distinguished from one another: then executes the given code.
Given any number of types, alters the name information in the symbols until they can be distinguished from one another: then executes the given code. The names are restored and the result is returned.
- def wrapParens(expr: String, top: Boolean): String
- Definition Classes
- SplainFormatting
- def wrapParensRepr(tpe: TypeRepr, top: Boolean): TypeRepr
- Definition Classes
- SplainFormatting
- object UnusedPrivates
- object checkDead
- object ByNameFormatter extends Analyzer.SpecialFormatter
- Definition Classes
- SplainFormatters
- object FunctionFormatter extends Analyzer.SpecialFormatter
- Definition Classes
- SplainFormatters
- object Refined
- Definition Classes
- SplainFormatters
- object RefinedFormatter extends Analyzer.SpecialFormatter
- Definition Classes
- SplainFormatters
- object TupleFormatter extends Analyzer.SpecialFormatter
- Definition Classes
- SplainFormatters
Deprecated Value Members
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from TypeDiagnostics toStringFormat[TypeDiagnostics] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (TypeDiagnostics, B)
- Implicit
- This member is added by an implicit conversion from TypeDiagnostics toArrowAssoc[TypeDiagnostics] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.
The Scala compiler and reflection APIs.