Skip to content

Commit ac74be8

Browse files
committed
Enable takesCappedParam criterion for level ownership
1 parent 8fb8350 commit ac74be8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/cc/AddTryOwners.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class AddTryOwners extends Phase, IdentityDenotTransformer:
3333
case tree @ Try(expr, cases, finalizer) if Feature.enabled(Feature.saferExceptions) =>
3434
val tryOwner = newSymbol(ctx.owner, nme.TRY_BLOCK, SyntheticMethod, MethodType(Nil, defn.UnitType))
3535
ccState.tryBlockOwner(tree) = tryOwner
36+
ccState.isLevelOwner(tryOwner) = true
3637
expr.changeOwnerAfter(ctx.owner, tryOwner, thisPhase)
3738
inContext(ctx.withOwner(tryOwner)):
3839
traverse(expr)

compiler/src/dotty/tools/dotc/cc/CaptureOps.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ private val constrainRootsWhenMapping = true
3131
/** If true, most vals can be level owners. If false, only vals defined by a
3232
* closure as RHS can be level owners
3333
*/
34-
private val valsCanBeLevelOwners = false
34+
private val valsCanBeLevelOwners = true
3535

3636
/** If true, only vals, defs, and classes with a universal capability in a parameter
3737
* or self type are considered as level owners.
3838
*/
39-
private val levelOwnersNeedCapParam = false
39+
private val levelOwnersNeedCapParam = true
4040

4141
def allowUniversalInBoxed(using Context) =
4242
Feature.sourceVersion.isAtLeast(SourceVersion.`3.3`)

0 commit comments

Comments
 (0)