DidYouMean

dotty.tools.dotc.reporting.DidYouMean
object DidYouMean

A utility object to support "did you mean" hinting

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
DidYouMean.type

Members list

Type members

Classlikes

case class Binding(name: Name, sym: Symbol, site: Type)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def didYouMean(candidates: List[(Int, Binding)], proto: Type, prefix: String)(using Context): String
def distance(s1: String, s2: String): Int

The Levenshtein distance between two strings

The Levenshtein distance between two strings

Attributes

def inScopeCandidates(isType: Boolean, isApplied: Boolean, rootImportOK: Boolean)(using Context): Set[Binding]

The name, symbol, and prefix type of all non-synthetic declarations that are defined or imported in some enclosing scope and that are of the same type/term kind as the missing member.

The name, symbol, and prefix type of all non-synthetic declarations that are defined or imported in some enclosing scope and that are of the same type/term kind as the missing member.

Attributes

def kindOK(sym: Symbol, isType: Boolean, isApplied: Boolean)(using Context): Boolean
def memberCandidates(site: Type, isType: Boolean, isApplied: Boolean)(using Context): Set[Symbol]

The names of all non-synthetic, non-private members of site that are of the same type/term kind as the missing member.

The names of all non-synthetic, non-private members of site that are of the same type/term kind as the missing member.

Attributes

Extensions

Extensions

extension [S <: Symbol | Binding](candidates: Set[S])
def closestTo(str: String, maxDist: Int)(using Context): List[(Int, S)]

List of possible candidate names with their Levenstein distances to the name from of the missing member.

List of possible candidate names with their Levenstein distances to the name from of the missing member.

Value parameters

maxDist

Maximal number of differences to be considered for a hint A distance qualifies if it is at most maxDist, shorter than the lengths of both the candidate name and the missing member name and not greater than half the average of those lengths.

Attributes