Scala Compiler 2.13.16 - scala.tools.nsc.typechecker.Contexts.ImportContext
Keywords: Scala Compiler 2.13.16 scala.tools.nsc.typechecker.Contexts.ImportContext

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
-  trait Contexts extends AnyRef

  Definition Classes
    typechecker
- Context
- ContextReporter
- ImportContext
- ImportInfo
- NoContext

c

scala.tools.nsc.typechecker.Contexts

# ImportContext

###

#### final class ImportContext extends (Contexts.this)#Context

A `Context` focussed on an `Import` tree

Source
  Contexts.scala

Linear Supertypes
(Contexts.this)#Context, AnyRef, Any
Type Hierarchy

Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. ImportContext
2. Context
3. AnyRef
4. 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.  abstract class TryTwice extends AnyRef

   Try inference twice: once without views and once with views, unless views are already disabled.

   Try inference twice: once without views and once with views, unless views are already disabled.

   Definition Classes
     Context

### 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 (Contexts.this)#ImportContext toany2stringadd[(Contexts.this)#ImportContext] performed by method any2stringadd in scala.Predef.
   Definition Classes
     any2stringadd
4.  def ->[B](y: B): ((Contexts.this)#ImportContext, B)
   Implicit
     This member is added by an implicit conversion from (Contexts.this)#ImportContext toArrowAssoc[(Contexts.this)#ImportContext] performed by method ArrowAssoc in scala.Predef.
   Definition Classes
     ArrowAssoc
   Annotations
     @inline()
5.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
6.  def ambiguousErrors: Boolean
   Definition Classes
     Context
7.  def apply(mask: ContextMode): Boolean

   Is this context in all modes in the given `mask`?

   Is this context in all modes in the given `mask`?

   Definition Classes
     Context
8.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
9.  def bufferErrors: Boolean
   Definition Classes
     Context
10.  def clone(): AnyRef
    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.CloneNotSupportedException]) @native()
11.  var contextMode: ContextMode

    A bitmask containing all the boolean flags in a context, e.g.

    A bitmask containing all the boolean flags in a context, e.g. are implicit views enabled

    Definition Classes
      Context
12.  def defaultModeForTyped: Mode
    Definition Classes
      Context
13.  def defineByNameImplicit(tpe: Global.Type, result: (Contexts.this)#SearchResult): (Contexts.this)#SearchResult
    Definition Classes
      Context
14.  def deprecationWarning(pos: Global.Position, sym: Global.Symbol): Unit
    Definition Classes
      Context
15.  def deprecationWarning(pos: Global.Position, sym: Global.Symbol, msg: String, since: String, actions: List[CodeAction] = Nil): Unit
    Definition Classes
      Context
16.  val depth: Int
    Definition Classes
      Context
17.  def echo(pos: Global.Position, msg: String): Unit
    Definition Classes
      Context
18.  def emitImplicitDictionary(result: (Contexts.this)#SearchResult): (Contexts.this)#SearchResult
    Definition Classes
      Context
19.  var enclClass: (Contexts.this)#Context

    The next outer context whose tree is a template or package definition

    The next outer context whose tree is a template or package definition

    Definition Classes
      Context
20.  final def enclClassOrMethod: (Contexts.this)#Context

    The next enclosing context (potentially `this`) that is owned by a class or method

    The next enclosing context (potentially `this`) that is owned by a class or method

    Definition Classes
      Context
    Annotations
      @tailrec()
21.  var enclMethod: (Contexts.this)#Context

    The next (logical) outer context whose tree is a method.

    The next (logical) outer context whose tree is a method.

    NOTE: this is the "logical" enclosing method, which may not be the actual enclosing method when we synthesize a nested method, such as for lazy val getters (scala/bug#8245) or the methods that implement a PartialFunction literal (scala/bug#10291).

    Definition Classes
      Context
22.  def enclosingApply: (Contexts.this)#Context

    ...or an Apply.

    ...or an Apply.

    Definition Classes
      Context
23.  def enclosingCaseDef: (Contexts.this)#Context

    The next enclosing context (potentially `this`) that has a `CaseDef` as a tree

    The next enclosing context (potentially `this`) that has a `CaseDef` as a tree

    Definition Classes
      Context
24.  def enclosingContextChain: List[(Contexts.this)#Context]
    Definition Classes
      Context
25.  final def enclosingImport: (Contexts.this)#Context
    Definition Classes
      Context
    Annotations
      @tailrec()
26.  def enclosingNonImportContext: (Contexts.this)#Context
    Definition Classes
      Context
27.  def enclosingSubClassContext(clazz: Global.Symbol): (Contexts.this)#Context

    Return the closest enclosing context that defines a subclass of `clazz` or a companion object thereof, or `NoContext` if no such context exists.

    Return the closest enclosing context that defines a subclass of `clazz` or a companion object thereof, or `NoContext` if no such context exists.

    Definition Classes
      Context
28.  def enrichmentEnabled: Boolean
    Definition Classes
      Context
29.  def enrichmentEnabled_=(value: Boolean): Unit
    Definition Classes
      Context
30.  def ensuring(cond: ((Contexts.this)#ImportContext) => Boolean, msg: => Any): (Contexts.this)#ImportContext
    Implicit
      This member is added by an implicit conversion from (Contexts.this)#ImportContext toEnsuring[(Contexts.this)#ImportContext] performed by method Ensuring in scala.Predef.
    Definition Classes
      Ensuring
31.  def ensuring(cond: ((Contexts.this)#ImportContext) => Boolean): (Contexts.this)#ImportContext
    Implicit
      This member is added by an implicit conversion from (Contexts.this)#ImportContext toEnsuring[(Contexts.this)#ImportContext] performed by method Ensuring in scala.Predef.
    Definition Classes
      Ensuring
32.  def ensuring(cond: Boolean, msg: => Any): (Contexts.this)#ImportContext
    Implicit
      This member is added by an implicit conversion from (Contexts.this)#ImportContext toEnsuring[(Contexts.this)#ImportContext] performed by method Ensuring in scala.Predef.
    Definition Classes
      Ensuring
33.  def ensuring(cond: Boolean): (Contexts.this)#ImportContext
    Implicit
      This member is added by an implicit conversion from (Contexts.this)#ImportContext toEnsuring[(Contexts.this)#ImportContext] performed by method Ensuring in scala.Predef.
    Definition Classes
      Ensuring
34.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
35.  def equals(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef → Any
36.  def error(pos: Global.Position, msg: String, actions: List[CodeAction] = Nil): Unit

    Issue/throw the given error message according to the current mode for error reporting.

    Issue/throw the given error message according to the current mode for error reporting.

    Definition Classes
      Context
37.  def extractUndetparams(): List[Global.Symbol]

    Return and clear the undetermined type parameters

    Return and clear the undetermined type parameters

    Definition Classes
      Context
38.  def featureWarning(pos: Global.Position, featureName: String, featureDesc: String, featureTrait: Global.Symbol, construct: => String = "", required: Boolean): Unit
    Definition Classes
      Context
39.  def finalize(): Unit
    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.Throwable])
40.  final def firstImport: Some[(Contexts.this)#ImportInfo]

    Equivalent to `imports.headOption`, but more efficient

    Equivalent to `imports.headOption`, but more efficient

    Definition Classes
      ImportContext → Context
41.  def fixPosition(pos: Global.Position): Global.Position
    Definition Classes
      Context
42.  final def getClass(): Class[_ <: AnyRef]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
43.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
44.  final def implicitRootContext: (Contexts.this)#Context
    Definition Classes
      Context
    Annotations
      @tailrec()
45.  def implicitsEnabled: Boolean
    Definition Classes
      Context
46.  def implicitsEnabled_=(value: Boolean): Unit
    Definition Classes
      Context
47.  final def implicitss: List[List[(Contexts.this)#ImplicitInfo]]
    Definition Classes
      Context
48.  final def importOrNull: (Contexts.this)#ImportInfo
    Definition Classes
      ImportContext → Context
49.  final def imports: collection.immutable.List[(Contexts.this)#ImportInfo]

    The currently visible imports, from innermost to outermost.

    The currently visible imports, from innermost to outermost.

    Definition Classes
      ImportContext → Context
50.  def inAnnotation: Boolean
    Definition Classes
      Context
51.  def inConstructorSuffix: Boolean
    Definition Classes
      Context
52.  def inConstructorSuffix_=(value: Boolean): Unit
    Definition Classes
      Context
53.  def inPatAlternative: Boolean
    Definition Classes
      Context
54.  def inPatAlternative_=(value: Boolean): Unit
    Definition Classes
      Context
55.  def inReturnExpr: Boolean
    Definition Classes
      Context
56.  def inSecondTry: Boolean
    Definition Classes
      Context
57.  def inSecondTry_=(value: Boolean): Unit
    Definition Classes
      Context
58.  def inSelfSuperCall: Boolean
    Definition Classes
      Context
59.  def inSelfSuperCall_=(value: Boolean): Unit
    Definition Classes
      Context
60.  final def inSilentMode(expr: => Boolean): Boolean
    Definition Classes
      Context
    Annotations
      @inline()
61.  def inSuperInit: Boolean
    Definition Classes
      Context
62.  def inSuperInit_=(value: Boolean): Unit
    Definition Classes
      Context
63.  def inTypeConstructorAllowed: Boolean
    Definition Classes
      Context
64.  def initRootContext(throwing: Boolean = false, checking: Boolean = false): Unit

    Use reporter (possibly buffered) for errors/warnings and enable implicit conversion *

    Use reporter (possibly buffered) for errors/warnings and enable implicit conversion *

    Definition Classes
      Context
65.  def isAccessible(sym: Global.Symbol, pre: Global.Type, superAccess: Boolean = false): Boolean

    Is `sym` accessible as a member of `pre` in current context?

    Is `sym` accessible as a member of `pre` in current context?

    Definition Classes
      Context
66.  def isInPackageObject(sym: Global.Symbol, pkg: Global.Symbol): Boolean

    Must `sym` defined in package object of package `pkg`, if it selected from a prefix with `pkg` as its type symbol?

    Must `sym` defined in package object of package `pkg`, if it selected from a prefix with `pkg` as its type symbol?

    Definition Classes
      Context
67.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
68.  def isNameInScope(name: Global.Name): Boolean
    Definition Classes
      Context
69.  def isPackageOwnedInDifferentUnit(s: Global.Symbol): Boolean
    Definition Classes
      Context
70.  val isRootImport: Boolean

    A root import is never unused and always bumps context depth.

    A root import is never unused and always bumps context depth. (e.g scala._ / Predef._ and magic REPL imports)

    Definition Classes
      ImportContext → Context
71.  final def isSearchingForImplicitParam: Boolean
    Definition Classes
      Context
72.  final def javaFindMember(pre: Global.Type, name: Global.Name, qualifies: (Global.Symbol) => Boolean): (Global.Type, Global.Symbol)
    Definition Classes
      Context
73.  final def linkByNameImplicit(tpe: Global.Type): Global.Tree
    Definition Classes
      Context
74.  final def lookupCompanionInIncompleteOwner(original: Global.Symbol): Global.Symbol
    Definition Classes
      Context
75.  final def lookupSibling(original: Global.Symbol, name: Global.Name): Global.Symbol
    Definition Classes
      Context
76.  def lookupSymbol(name: Global.Name, qualifies: (Global.Symbol) => Boolean): Global.NameLookup
    Definition Classes
      Context
77.  def macrosEnabled: Boolean
    Definition Classes
      Context
78.  def macrosEnabled_=(value: Boolean): Unit
    Definition Classes
      Context
79.  def make(tree: Global.Tree, owner: Global.Symbol, scope: Global.Scope): (Contexts.this)#Context
    Definition Classes
      Context
80.  def make(tree: Global.Tree = tree, owner: Global.Symbol = owner, scope: Global.Scope = scope, unit: Global.CompilationUnit = unit, reporter: (Contexts.this)#ContextReporter = this.reporter): (Contexts.this)#Context

    Construct a child context.

    Construct a child context. The parent and child will share the report buffer. Compare with `makeSilent`, in which the child has a fresh report buffer.

    If `tree` is an `Import`, that import will be available at the head of `Context#imports`.

    Definition Classes
      Context
81.  def makeConstructorContext: (Contexts.this)#Context

    A context for typing constructor parameter ValDefs, super or self invocation arguments and default getters of constructors.

    A context for typing constructor parameter ValDefs, super or self invocation arguments and default getters of constructors. These expressions need to be type checked in a scope outside the class, cf. spec 5.3.1.

    This method is called by namer / typer where `this` is the context for the constructor DefDef. The owner of the resulting (new) context is the outer context for the Template, i.e. the context for the ClassDef. This means that class type parameters will be in scope. The value parameters of the current constructor are also entered into the new constructor scope. Members of the class however will not be accessible.

    Definition Classes
      Context
82.  def makeImplicit(reportAmbiguousErrors: Boolean): (Contexts.this)#Context

    Make a silent child context does not allow implicits.

    Make a silent child context does not allow implicits. Used to prevent chaining of implicit views.

    Definition Classes
      Context
83.  def makeImportContext(tree: Global.Import): (Contexts.this)#Context
    Definition Classes
      Context
84.  def makeNewScope(tree: Global.Tree, owner: Global.Symbol, reporter: (Contexts.this)#ContextReporter = this.reporter): (Contexts.this)#Context

    Make a child context that represents a new nested scope

    Make a child context that represents a new nested scope

    Definition Classes
      Context
85.  def makeNonSilent(newtree: Global.Tree): (Contexts.this)#Context
    Definition Classes
      Context
86.  def makeSilent(reportAmbiguousErrors: Boolean = ambiguousErrors, newtree: Global.Tree = tree): (Contexts.this)#Context

    Make a child context that buffers errors and warnings into a fresh report buffer.

    Make a child context that buffers errors and warnings into a fresh report buffer.

    Definition Classes
      Context
87.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
88.  final def nextEnclosing(p: ((Contexts.this)#Context) => Boolean): (Contexts.this)#Context
    Definition Classes
      Context
    Annotations
      @tailrec()
89.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
90.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
91.  var openImplicits: List[(Contexts.this)#OpenImplicit]

    Types for which implicit arguments are currently searched

    Types for which implicit arguments are currently searched

    Definition Classes
      Context
92.  final def outer: (Contexts.this)#Context
    Definition Classes
      Context
93.  def outerDepth: Int
    Attributes
      protected
    Definition Classes
      Context
94.  final def outermostContextAtCurrentPos: (Contexts.this)#Context
    Definition Classes
      Context
95.  val owner: Global.Symbol
    Definition Classes
      Context
96.  var pendingStabilizers: List[Global.Tree]
    Definition Classes
      Context
97.  var prefix: Global.Type
    Definition Classes
      Context
98.  def pushTypeBounds(sym: Global.Symbol): Unit
    Definition Classes
      Context
99.  final def refByNameImplicit(tpe: Global.Type): Global.Tree
    Definition Classes
      Context
100.  def reportErrors: Boolean
     Definition Classes
       Context
101.  def reporter: (Contexts.this)#ContextReporter
     Definition Classes
       Context
102.  final def resetCache(): Unit
     Definition Classes
       Context
     Annotations
       @tailrec()
103.  def restoreTypeBounds(tp: Global.Type): Global.Type
     Definition Classes
       Context
104.  def returnsSeen: Boolean
     Definition Classes
       Context
105.  def returnsSeen_=(value: Boolean): Unit
     Definition Classes
       Context
106.  def retyping: Boolean
     Definition Classes
       Context
107.  def retyping_=(value: Boolean): Unit
     Definition Classes
       Context
108.  var savedTypeBounds: List[(Global.Symbol, Global.Type)]

     Saved type bounds for type parameters which are narrowed in a GADT.

     Saved type bounds for type parameters which are narrowed in a GADT.

     Definition Classes
       Context
109.  def savingUndeterminedTypeParams[A](reportAmbiguous: Boolean = ambiguousErrors)(body: => A): A

     Run `body` with this context with no undetermined type parameters, restore the original the original list afterwards.

     Run `body` with this context with no undetermined type parameters, restore the original the original list afterwards.

     reportAmbiguous

       Should ambiguous errors be reported during evaluation of `body`?

     Definition Classes
       Context
110.  val scope: Global.Scope
     Definition Classes
       Context
111.  def set(enable: ContextMode = NOmode, disable: ContextMode = NOmode): ImportContext.this.type

     Set all modes in the mask `enable` to true, and all in `disable` to false.

     Set all modes in the mask `enable` to true, and all in `disable` to false.

     Definition Classes
       Context
112.  def siteString: String
     Definition Classes
       Context
113.  def starPatterns: Boolean
     Definition Classes
       Context
114.  def starPatterns_=(value: Boolean): Unit
     Definition Classes
       Context
115.  final def synchronized[T0](arg0: => T0): T0
     Definition Classes
       AnyRef
116.  final def toString(): String
     Definition Classes
       ImportContext → Context → AnyRef → Any
117.  val tree: Global.Tree
     Definition Classes
       Context
118.  def undetparams: List[Global.Symbol]

     Undetermined type parameters.

     Undetermined type parameters. See `Infer#{inferExprInstance, adjustTypeArgs}`. Not inherited to child contexts

     Definition Classes
       Context
119.  def undetparamsString: String
     Definition Classes
       Context
120.  def undetparams_=(ps: List[Global.Symbol]): Unit
     Definition Classes
       Context
121.  val unit: Global.CompilationUnit
     Definition Classes
       Context
122.  def update(mask: ContextMode, value: Boolean): Unit

     Update all modes in `mask` to `value`

     Update all modes in `mask` to `value`

     Definition Classes
       Context
123.  final def wait(): Unit
     Definition Classes
       AnyRef
     Annotations
       @throws(classOf[java.lang.InterruptedException])
124.  final def wait(arg0: Long, arg1: Int): Unit
     Definition Classes
       AnyRef
     Annotations
       @throws(classOf[java.lang.InterruptedException])
125.  final def wait(arg0: Long): Unit
     Definition Classes
       AnyRef
     Annotations
       @throws(classOf[java.lang.InterruptedException]) @native()
126.  def warning(pos: Global.Position, msg: String, category: WarningCategory, site: Global.Symbol): Unit
     Definition Classes
       Context
127.  def warning(pos: Global.Position, msg: String, category: WarningCategory, site: Global.Symbol, actions: List[CodeAction]): Unit
     Definition Classes
       Context
128.  def warning(pos: Global.Position, msg: String, category: WarningCategory, actions: List[CodeAction] = Nil): Unit

     Issue/throw the given error message according to the current mode for error reporting.

     Issue/throw the given error message according to the current mode for error reporting.

     Definition Classes
       Context
129.  final def withImplicits[T](enabled: Boolean)(op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
130.  final def withImplicitsDisabled[T](op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
131.  final def withImplicitsDisabledAllowEnrichment[T](op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
132.  final def withImplicitsEnabled[T](op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
133.  final def withMacros[T](enabled: Boolean)(op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
134.  final def withMacrosDisabled[T](op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
135.  final def withMacrosEnabled[T](op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
136.  final def withMode[T](enabled: ContextMode = NOmode, disabled: ContextMode = NOmode)(op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
137.  final def withOnlyStickyModes[T](op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
138.  final def withSuppressDeadArgWarning[T](suppress: Boolean)(op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
139.  final def withinAnnotation[T](op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
140.  final def withinPatAlternative[T](op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
141.  final def withinReturnExpr[T](op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
142.  final def withinSecondTry[T](op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
143.  final def withinStarPatterns[T](op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
144.  final def withinSuperInit[T](op: => T): T
     Definition Classes
       Context
     Annotations
       @inline()
145.  final def withinTypeConstructorAllowed[T](op: => T): T

     TypeConstructorAllowed is enabled when we are typing a higher-kinded type.

     TypeConstructorAllowed is enabled when we are typing a higher-kinded type. adapt should then check kind-arity based on the prototypical type's kind arity. Type arguments should not be inferred.

     Definition Classes
       Context
     Annotations
       @inline()

### Deprecated Value Members

1.  def formatted(fmtstr: String): String
   Implicit
     This member is added by an implicit conversion from (Contexts.this)#ImportContext toStringFormat[(Contexts.this)#ImportContext] 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): ((Contexts.this)#ImportContext, B)
   Implicit
     This member is added by an implicit conversion from (Contexts.this)#ImportContext toArrowAssoc[(Contexts.this)#ImportContext] 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 (Contexts.this)#Context

### Inherited from AnyRef

### Inherited from Any

### Inherited by implicit conversion any2stringadd from(Contexts.this)#ImportContext to any2stringadd[(Contexts.this)#ImportContext]

### Inherited by implicit conversion StringFormat from(Contexts.this)#ImportContext to StringFormat[(Contexts.this)#ImportContext]

### Inherited by implicit conversion Ensuring from(Contexts.this)#ImportContext to Ensuring[(Contexts.this)#ImportContext]

### Inherited by implicit conversion ArrowAssoc from(Contexts.this)#ImportContext to ArrowAssoc[(Contexts.this)#ImportContext]

### Ungrouped