Skip to content

Commit

Permalink
Existential Capabilities (#20566)
Browse files Browse the repository at this point in the history
The design has changed quite a bit relative to
#20470. It is written up as a doc
comment on object cc.Existentials.
  • Loading branch information
bracevac authored Jul 19, 2024
2 parents 6363df8 + fac643a commit af933c4
Show file tree
Hide file tree
Showing 134 changed files with 3,010 additions and 924 deletions.
11 changes: 8 additions & 3 deletions compiler/src/dotty/tools/dotc/ast/untpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,17 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
def captureRoot(using Context): Select =
Select(scalaDot(nme.caps), nme.CAPTURE_ROOT)

def captureRootIn(using Context): Select =
Select(scalaDot(nme.caps), nme.capIn)

def makeRetaining(parent: Tree, refs: List[Tree], annotName: TypeName)(using Context): Annotated =
Annotated(parent, New(scalaAnnotationDot(annotName), List(refs)))

def makeCapsOf(id: Ident)(using Context): Tree =
TypeApply(Select(scalaDot(nme.caps), nme.capsOf), id :: Nil)

def makeCapsBound()(using Context): Tree =
makeRetaining(
Select(scalaDot(nme.caps), tpnme.CapSet),
Nil, tpnme.retainsCap)

def makeConstructor(tparams: List[TypeDef], vparamss: List[List[ValDef]], rhs: Tree = EmptyTree)(using Context): DefDef =
DefDef(nme.CONSTRUCTOR, joinParams(tparams, vparamss), TypeTree(), rhs)

Expand Down
Loading

0 comments on commit af933c4

Please sign in to comment.