-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Change retains annotation from using term arguments to using type arguments #22909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0bff38f
04097cd
ffa04cb
ef7146e
384eab4
c4482f1
11fd151
cc28c91
e0c3a02
cc2b60a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -806,7 +806,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI: | |
case CapturingType(_, refs) => | ||
!refs.isAlwaysEmpty | ||
case RetainingType(parent, refs) => | ||
!refs.isEmpty | ||
!refs.retainedElements.isEmpty | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering if we should massage the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
case tp: (TypeRef | AppliedType) => | ||
val sym = tp.typeSymbol | ||
if sym.isClass | ||
|
@@ -852,7 +852,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI: | |
&& !refs.isUniversal // if refs is {cap}, an added variable would not change anything | ||
case RetainingType(parent, refs) => | ||
needsVariable(parent) | ||
&& !refs.tpes.exists: | ||
&& !refs.retainedElements.exists: | ||
case ref: TermRef => ref.isCapRef | ||
case _ => false | ||
case AnnotatedType(parent, _) => | ||
|
@@ -947,19 +947,13 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI: | |
* @param tpt the tree for which an error or warning should be reported | ||
*/ | ||
private def checkWellformed(parent: Type, ann: Tree, tpt: Tree)(using Context): Unit = | ||
noti0na1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
capt.println(i"checkWF post $parent ${ann.retainedElems} in $tpt") | ||
var retained = ann.retainedElems.toArray | ||
for i <- 0 until retained.length do | ||
val refTree = retained(i) | ||
val refs = | ||
try refTree.toCapabilities | ||
catch case ex: IllegalCaptureRef => | ||
report.error(em"Illegal capture reference: ${ex.getMessage}", refTree.srcPos) | ||
Nil | ||
for ref <- refs do | ||
capt.println(i"checkWF post $parent ${ann.retainedSet} in $tpt") | ||
try | ||
var retained = ann.retainedSet.retainedElements.toArray | ||
for i <- 0 until retained.length do | ||
val ref = retained(i) | ||
def pos = | ||
if refTree.span.exists then refTree.srcPos | ||
else if ann.span.exists then ann.srcPos | ||
if ann.span.exists then ann.srcPos | ||
else tpt.srcPos | ||
|
||
def check(others: CaptureSet, dom: Type | CaptureSet): Unit = | ||
|
@@ -976,13 +970,14 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI: | |
val others = | ||
for | ||
j <- 0 until retained.length if j != i | ||
r <- retained(j).toCapabilities | ||
r = retained(j) | ||
if !r.isTerminalCapability | ||
yield r | ||
val remaining = CaptureSet(others*) | ||
check(remaining, remaining) | ||
end for | ||
end for | ||
catch case ex: IllegalCaptureRef => | ||
report.error(em"Illegal capture reference: ${ex.getMessage}", tpt.srcPos) | ||
end checkWellformed | ||
|
||
/** Check well formed at post check time. We need to wait until after | ||
|
Uh oh!
There was an error while loading. Please reload this page.