SepCheck

dotty.tools.dotc.cc.SepCheck
See theSepCheck companion object
class SepCheck(checker: CheckerAPI) extends TreeTraverser

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def checkConsumedRefs(refsToCheck: Refs, tpe: Type, role: TypeRole, descr: => String, pos: SrcPos)(using Context): Unit

Check validity of consumed references refsToCheck. The references are consumed because they are hidden in a Fresh result type or they are referred to in an argument to a @consume parameter or in a prefix of a @consume method -- which one applies is determined by the role parameter.

Check validity of consumed references refsToCheck. The references are consumed because they are hidden in a Fresh result type or they are referred to in an argument to a @consume parameter or in a prefix of a @consume method -- which one applies is determined by the role parameter.

This entails the following checks:

  • The reference must be defined in the same as method or class as the access.
  • If the reference is to a term parameter, that parameter must be marked as @consume as well.
  • If the reference is to a this type of the enclosing class, the access must be in a @consume method.

References that extend SharedCapability are excluded from checking. As a side effect, add all checked references with the given position pos to the global consumed map.

Value parameters

descr

a textual description of the type and its relationship with the checked reference

pos

position for error reporting

refsToCheck

the referencves to check

role

the role in which the type apears

tpe

the type containing those references

Attributes

def checkType(tpe: Type, pos: SrcPos, role: TypeRole)(using Context): Unit

Check separation conditions of type tpe that appears in role.

Check separation conditions of type tpe that appears in role.

  1. Check that the parts of type tpe are mutually separated, as defined in checkParts below.
  2. Check that validity of all references consumed by the type as defined in checkLegalRefs below

Attributes

def checkType(tpt: Tree, sym: Symbol)(using Context): Unit

Check the (result-) type of a definition of symbol sym

Check the (result-) type of a definition of symbol sym

Attributes

def checkUse(tree: Tree)(using Context): Unit
  1. Check that the capabilities used at tree don't overlap with capabilities hidden by a previous definition.
  2. Also check that none of the used capabilities was consumed before.

Attributes

Check (result-) type of tree for separation conditions using checkType. Excluded are parameters and definitions that have an =unsafeAssumeSeparate application as right hand sides. Hidden sets of checked definitions are added to defsShadow.

Check (result-) type of tree for separation conditions using checkType. Excluded are parameters and definitions that have an =unsafeAssumeSeparate application as right hand sides. Hidden sets of checked definitions are added to defsShadow.

Attributes

def consumeError(ref: CaptureRef, loc: SrcPos, pos: SrcPos)(using Context): Unit

Report a failure where a previously consumed capability is used again,

Report a failure where a previously consumed capability is used again,

Value parameters

loc

the position where the capability was consumed

pos

the position where the capability was used again

ref

the capability that is used after being consumed

Attributes

def consumeInLoopError(ref: CaptureRef, pos: SrcPos)(using Context): Unit

Report a failure where a capability is consumed in a loop.

Report a failure where a capability is consumed in a loop.

Value parameters

loc

the position where the capability was consumed

ref

the capability

Attributes

def explicitRefs(tp: Type)(using Context): Refs

If tp denotes some version of a singleton capture ref x.type the set {x, x*} otherwise the empty set.

If tp denotes some version of a singleton capture ref x.type the set {x, x*} otherwise the empty set.

Attributes

def inSection[T](op: => T)(using Context): T

Is tree an application of caps.unsafe.unsafeAssumeSeparate?

Is tree an application of caps.unsafe.unsafeAssumeSeparate?

Attributes

def overlapStr(hiddenSet: Refs, clashSet: Refs)(using Context): String
def pushDef(tree: ValOrDefDef, hiddenByDef: Refs)(using Context): Unit
def sepApplyError(fn: Tree, parts: List[Tree], polyArg: Tree, clashing: Tree)(using Context): Unit

Report a separation failure in an application fn(args)

Report a separation failure in an application fn(args)

Value parameters

clashing

the argument, function prefix, or entire function application result with which it clashes,

fn

the function

parts

the function prefix followed by the flattened argument list

polyArg

the clashing argument to a polymorphic formal

Attributes

def sepUseError(tree: Tree, clashingDef: ValOrDefDef | Null, used: Refs, hidden: Refs)(using Context): Unit

Report a use/definition failure, where a previously hidden capability is used again.

Report a use/definition failure, where a previously hidden capability is used again.

Value parameters

clashing

the tree where the capability is previously hidden, or emptyTree if none exists

hidden

the hidden set of the clashing def, or the global hidden set if no clashing def exists

tree

the tree where the capability is used

used

the uses of tree

Attributes

def sharedPeaksStr(shared: Refs)(using Context): String
def traverse(tree: Tree)(using Context): Unit

Traverse tree and perform separation checks everywhere

Traverse tree and perform separation checks everywhere

Attributes

def traverseSection[T](tree: Tree)(using Context): Unit

Inherited methods

def apply(x: Unit, tree: Tree)(using Context): Unit

Attributes

Inherited from:
TreeTraverser
def apply(x: Unit, trees: List[Tree])(using Context): Unit

Attributes

Inherited from:
TreeAccumulator
def foldMoreCases(x: Unit, tree: Tree)(using Context): Unit

Attributes

Inherited from:
TreeAccumulator
def foldOver(x: Unit, tree: Tree)(using Context): Unit

Attributes

Inherited from:
TreeAccumulator
def traverse(trees: List[Tree])(using Context): Unit

Attributes

Inherited from:
TreeTraverser
protected def traverseChildren(tree: Tree)(using Context): Unit

Attributes

Inherited from:
TreeTraverser