t

scala.tools.nsc.typechecker

TypeDiagnostics

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
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TypeDiagnostics
  2. SplainDiagnostics
  3. SplainFormatting
  4. SplainFormatters
  5. AnyRef
  6. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. case class TypeDiag(tp: Global.Type, sym: Global.Symbol) extends Ordered[(TypeDiagnostics.this)#TypeDiag] with Product with Serializable
  2. trait TyperDiagnostics extends AnyRef
  3. class UnusedPrivates extends Global.Traverser
  4. class checkUnused extends AnyRef
  5. trait SpecialFormatter extends AnyRef
    Definition Classes
    SplainFormatters
  6. case class TypeParts(sym: Global.Symbol, tt: Global.Type) extends Product with Serializable
    Definition Classes
    SplainFormatting

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. 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
  4. 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()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. def abstractVarMessage(sym: Global.Symbol): String

    An explanatory note to be added to error messages when there's a problem with abstract var defs

  7. def alternatives(tree: Global.Tree): List[Global.Type]
  8. def alternativesString(tree: Global.Tree): String
  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. def bracket[A](params: List[A]): String
    Definition Classes
    SplainFormatting
  11. 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
  12. val breakInfixLength: Int
    Definition Classes
    SplainFormatting
  13. def builtinFoundReqMsg(found: Global.Type, req: Global.Type): String
  14. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  15. def ctorNames(tpe: Global.Type): List[String]
    Definition Classes
    SplainFormatting
  16. def dealias(tpe: Global.Type): Global.Type
    Definition Classes
    SplainFormatting
  17. def decideBreak(flat: FlatType, broken: => BrokenType): TypeRepr
    Definition Classes
    SplainFormatting
  18. def decodeWithKind(name: Global.Name, owner: Global.Symbol): String
  19. def deepestLevel(chain: List[(TypeDiagnostics.this)#ImplicitError]): Int
    Definition Classes
    SplainFormatting
  20. def disambiguate(ss: List[String]): collection.immutable.List[String]
  21. 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
  22. 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
  23. 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
  24. 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
  25. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  26. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  27. final def exampleTuplePattern(names: List[Global.Name]): String

    [a, b, c] => "(a, b, c)" [a, B] => "(param1, param2)" [a, B, c] => "(param1, ..., param2)"

  28. def existentialContext(tp: Global.Type): String
  29. def explainAlias(tp: Global.Type): String
  30. def explainAnyVsAnyRef(found: Global.Type, req: Global.Type): String
  31. 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()
  32. def extractArgs(tpe: Global.Type): collection.immutable.List[Global.Type]
    Definition Classes
    SplainFormatting
  33. def finalOwners(tpe: Global.Type): Boolean
  34. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  35. 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
  36. def formatAuxSimple(tpe: Global.Type): (List[String], String)
    Definition Classes
    SplainFormatting
  37. def formatDiff(left: Global.Type, right: Global.Type, top: Boolean): Formatted
    Definition Classes
    SplainFormatting
  38. val formatDiffCache: FormatCache[(Global.Type, Global.Type, Boolean), Formatted]
    Definition Classes
    SplainFormatting
  39. def formatDiffImpl(found: Global.Type, req: Global.Type, top: Boolean): Formatted
    Definition Classes
    SplainFormatting
  40. def formatDiffInfix(left: Global.Type, right: Global.Type, top: Boolean): Formatted
    Definition Classes
    SplainFormatting
  41. def formatDiffSimple(left: Global.Type, right: Global.Type): Formatted
    Definition Classes
    SplainFormatting
  42. def formatDiffSpecial(left: Global.Type, right: Global.Type, top: Boolean): Option[Formatted]
    Definition Classes
    SplainFormatting
  43. def formatFunction(args: List[String]): String
    Definition Classes
    SplainFormatting
  44. def formatImplicitChain(chain: List[(TypeDiagnostics.this)#ImplicitError]): List[String]
    Definition Classes
    SplainFormatting
  45. def formatImplicitChainFlat(chain: List[(TypeDiagnostics.this)#ImplicitError]): List[String]
    Definition Classes
    SplainFormatting
  46. def formatImplicitChainTreeCompact(chain: List[(TypeDiagnostics.this)#ImplicitError]): Option[List[String]]
    Definition Classes
    SplainFormatting
  47. def formatImplicitChainTreeFull(chain: List[(TypeDiagnostics.this)#ImplicitError]): List[String]
    Definition Classes
    SplainFormatting
  48. def formatImplicitError(param: Global.Symbol, errors: List[(TypeDiagnostics.this)#ImplicitError], annotationMsg: String): String
    Definition Classes
    SplainFormatting
  49. def formatIndentTree(chain: List[(TypeDiagnostics.this)#ImplicitError], baseIndent: Int): List[String]
    Definition Classes
    SplainFormatting
  50. def formatInfix[A](path: List[String], simple: String, left: A, right: A, top: Boolean)(rec: (A, Boolean) => Formatted): Formatted
    Definition Classes
    SplainFormatting
  51. def formatNestedImplicit(err: (TypeDiagnostics.this)#ImplicitError): (String, List[String], Int)
    Definition Classes
    SplainFormatting
  52. 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 as f. 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
  53. def formatNonConfBounds(err: NonconformantBounds): List[String]
    Definition Classes
    SplainFormatting
  54. def formatNormalSimple(tpe: Global.Type): (List[String], String)
    Definition Classes
    SplainFormatting
  55. def formatRefinement(sym: Global.Symbol): String
    Definition Classes
    SplainFormatting
  56. def formatSimpleType(tpe: Global.Type): (List[String], String)
    Definition Classes
    SplainFormatting
  57. 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
  58. def formatType(tpe: Global.Type, top: Boolean): Formatted
    Definition Classes
    SplainFormattingSplainFormatters
  59. val formatTypeCache: FormatCache[(Global.Type, Boolean), Formatted]
    Definition Classes
    SplainFormatting
  60. def formatTypeImpl(tpe: Global.Type, top: Boolean): Formatted
    Definition Classes
    SplainFormatting
  61. def formatWithInfix[A](tpe: Global.Type, args: List[A], top: Boolean)(rec: (A, Boolean) => Formatted): Formatted
    Definition Classes
    SplainFormatting
  62. def formattedDiff(left: Formatted, right: Formatted): String
    Definition Classes
    SplainFormatting
  63. def foundReqMsg(found: Global.Type, req: Global.Type): String
  64. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  65. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  66. def hideImpError(error: (TypeDiagnostics.this)#ImplicitError): Boolean
    Definition Classes
    SplainFormatting
  67. def implicitMessage(param: Global.Symbol, annotationMsg: String): List[String]
    Definition Classes
    SplainFormatting
  68. def indent(lines: List[String], n: Int = 1, prefix: String = " "): collection.immutable.List[String]
    Definition Classes
    SplainFormatting
  69. def indentLine(line: String, n: Int = 1, prefix: String = " "): String
    Definition Classes
    SplainFormatting
  70. def indentTree(tree: List[(String, List[String], Int)], baseIndent: Int): List[String]
    Definition Classes
    SplainFormatting
  71. def isAux(tpe: Global.Type): Boolean
    Definition Classes
    SplainFormatting
  72. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  73. def isRefined(tpe: Global.Type): Boolean
    Definition Classes
    SplainFormatting
  74. def isSymbolic(tpe: Global.Type): Boolean
    Definition Classes
    SplainFormatting
  75. def linePrecedes(t1: Global.Tree, t2: Global.Tree): Boolean
  76. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  77. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  78. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  79. def pathPrefix: (List[String]) => String
    Definition Classes
    SplainFormatting
  80. def posPrecedes(p1: Global.Position, p2: Global.Position): Boolean

    Does the positioned line assigned to t1 precede that of t2?

  81. def qualifiedName(path: List[String], name: FormattedName): String
    Definition Classes
    SplainFormatting
  82. final def recursivelyFinal(tpe: Global.Type): Boolean
    Annotations
    @tailrec()
  83. def restrictionError(pos: Global.Position, unit: Global.CompilationUnit, msg: String): Unit
  84. 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.

  85. def sanitizePath(path: List[String]): List[String]
    Definition Classes
    SplainFormatting
  86. def setAddendum(pos: Global.Position, msg: () => String): Unit
  87. def showFormatted(tpe: Formatted): String
    Definition Classes
    SplainFormatting
  88. def showFormattedL(tpe: Formatted, break: Boolean): TypeRepr
    Definition Classes
    SplainFormatting
  89. val showFormattedLCache: FormatCache[(Formatted, Boolean), TypeRepr]
    Definition Classes
    SplainFormatting
  90. def showFormattedLImpl(tpe: Formatted, break: Boolean): TypeRepr
    Definition Classes
    SplainFormatting
  91. def showFormattedQualified(path: List[String], name: FormattedName): TypeRepr
    Definition Classes
    SplainFormatting
  92. def showFuncParams(args: List[String]): String
    Definition Classes
    SplainFormatting
  93. def showRefined(parents: List[String], decls: List[String]): String
    Definition Classes
    SplainFormatting
  94. def showTuple(args: List[String]): String
    Definition Classes
    SplainFormatting
  95. def showType(tpe: Global.Type): String
    Definition Classes
    SplainFormatting
  96. 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
  97. def showTypeBreakL(tpe: Global.Type): List[String]
    Definition Classes
    SplainFormatting
  98. val specialFormatters: List[(TypeDiagnostics.this)#SpecialFormatter]
    Definition Classes
    SplainFormatting
  99. def splainFoundReqMsg(found: Global.Type, req: Global.Type): String
    Definition Classes
    SplainDiagnostics
  100. def splitChains(errors: List[(TypeDiagnostics.this)#ImplicitError]): List[List[(TypeDiagnostics.this)#ImplicitError]]
    Definition Classes
    SplainFormatting
  101. def stripModules(path: List[String], name: FormattedName): String
    Definition Classes
    SplainFormatting
  102. def stripType(tpe: Global.Type): (List[String], String)
    Definition Classes
    SplainFormatting
  103. def symbolPath(sym: Global.Symbol): List[String]
    Definition Classes
    SplainFormatting
  104. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  105. def toString(): String
    Definition Classes
    AnyRef → Any
  106. def treeSymTypeMsg(tree: Global.Tree): String
  107. def truncateDecls(decls: List[Formatted]): Boolean
    Definition Classes
    SplainFormatting
  108. def typePatternAdvice(sym: Global.Symbol, ptSym: Global.Symbol): String
  109. 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.

  110. 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?

  111. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  112. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  113. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  114. def withAddendum(pos: Global.Position): (String) => String
  115. 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.

  116. def wrapParens(expr: String, top: Boolean): String
    Definition Classes
    SplainFormatting
  117. def wrapParensRepr(tpe: TypeRepr, top: Boolean): TypeRepr
    Definition Classes
    SplainFormatting
  118. object UnusedPrivates
  119. object checkDead
  120. object ByNameFormatter extends Analyzer.SpecialFormatter
    Definition Classes
    SplainFormatters
  121. object FunctionFormatter extends Analyzer.SpecialFormatter
    Definition Classes
    SplainFormatters
  122. object Refined
    Definition Classes
    SplainFormatters
  123. object RefinedFormatter extends Analyzer.SpecialFormatter
    Definition Classes
    SplainFormatters
  124. object TupleFormatter extends Analyzer.SpecialFormatter
    Definition Classes
    SplainFormatters

Deprecated Value Members

  1. 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 of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

  2. 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.

Inherited from SplainDiagnostics

Inherited from SplainFormatting

Inherited from SplainFormatters

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd fromTypeDiagnostics to any2stringadd[TypeDiagnostics]

Inherited by implicit conversion StringFormat fromTypeDiagnostics to StringFormat[TypeDiagnostics]

Inherited by implicit conversion Ensuring fromTypeDiagnostics to Ensuring[TypeDiagnostics]

Inherited by implicit conversion ArrowAssoc fromTypeDiagnostics to ArrowAssoc[TypeDiagnostics]

Ungrouped