Scala Compiler 2.13.16 - scala.tools.nsc.typechecker.TypeDiagnostics
Keywords: Scala Compiler 2.13.16 scala.tools.nsc.typechecker.TypeDiagnostics

Scala Compiler2.13.16 < Back


# Packages

-  package root

  The Scala compiler and reflection APIs.

  The Scala compiler and reflection APIs.

  Definition Classes
    root
-  package scala
  Definition Classes
    root
-  package tools
  Definition Classes
    scala
-  package nsc
  Definition Classes
    tools
-  package typechecker
  Definition Classes
    nsc
-  package splain
  Definition Classes
    typechecker
- Adaptations
- Analyzer
- AnalyzerPlugins
- Checkable
- ConstantFolder
- ContextErrors
- ContextMode
- Contexts
- DestructureTypes
- Duplicators
- EtaExpansion
- Fingerprint
- Implicits
- ImplicitsStats
- ImportTracking
- Infer
- MacroAnnotationAttachments
- MacroAnnotationNamers
- Macros
- MacrosStats
- MethodSynthesis
- Namers
- NamesDefaults
- PatternTypers
- RefChecks
- StdAttachments
- StructuredTypeStrings
- SuperAccessors
- SyntheticMethods
- Tags
- TreeCheckers
- TypeDiagnostics
- TypeStrings
- Typers
- TypersStats
- TypersTracking
- Unapplies

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

Linear Supertypes
SplainDiagnostics, SplainFormatting, SplainFormatters, AnyRef, Any
Known Subclasses
erasure, treeChecker, ScaladocAnalyzer, InteractiveAnalyzer, Erasure, Duplicator, SpecializationDuplicator, Analyzer, Duplicators, TreeCheckers
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 ImplicitErrorLink(fromTree: Analyzer.ImplicitError, fromHistory: Analyzer.DivergentImplicitTypeError) extends Product with Serializable
   Definition Classes
     SplainFormatting
7.  case class ImplicitErrorTree(error: Analyzer.ImplicitError, children: collection.immutable.Seq[Analyzer.ImplicitErrorTree] = Nil) extends Product with Serializable
   Definition Classes
     SplainFormatting
8.  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.  implicit def asSimpleName(s: String): SimpleName
    Definition Classes
      SplainFormatters
11.  def bracket[A](params: collection.immutable.List[A]): String
    Definition Classes
      SplainFormatting
12.  def breakInfix(types: collection.immutable.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
13.  val breakInfixLength: Int
    Definition Classes
      SplainFormatting
14.  def builtinFoundReqMsg(found: Global.Type, req: Global.Type): String
15.  def clone(): AnyRef
    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.CloneNotSupportedException]) @native()
16.  def ctorNames(tpe: Global.Type): collection.immutable.List[String]
    Definition Classes
      SplainFormatting
17.  def dealias(tpe: Global.Type): Global.Type
    Definition Classes
      SplainFormatting
18.  def decideBreak(flat: FlatType, broken: => BrokenType): TypeRepr
    Definition Classes
      SplainFormatting
19.  def decodeWithKind(name: Global.Name, owner: Global.Symbol): String
20.  def deepestLevel(chain: collection.immutable.List[(TypeDiagnostics.this)#ImplicitError]): Int
    Definition Classes
      SplainFormatting
21.  def disambiguate(ss: List[String]): collection.immutable.List[String]
22.  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
23.  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
24.  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
25.  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
26.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
27.  def equals(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef → Any
28.  final def exampleTuplePattern(names: List[Global.Name]): String

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

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

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

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

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

108.  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?

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

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

### 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