-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Two fixes to handling of abstract types with cap bounds #22838
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # compiler/src/dotty/tools/dotc/cc/Setup.scala
ff6f4b8
to
a94efa4
Compare
Simplifies previous too convoluted logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some comment about new withCapAsRoot
calls
@@ -426,7 +426,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling | |||
if (tp1.prefix.isStable) return tryLiftedToThis1 | |||
case _ => | |||
if isCaptureVarComparison then | |||
return subCaptures(tp1.captureSet, tp2.captureSet).isOK | |||
return CCState.withCapAsRoot: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should leave a comment to make sure we don't introduce unsoundness
@@ -575,7 +576,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling | |||
&& (isBottom(tp1) || GADTusage(tp2.symbol)) | |||
|
|||
if isCaptureVarComparison then | |||
return subCaptures(tp1.captureSet, tp2.captureSet).isOK | |||
return CCState.withCapAsRoot: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should leave a comment to make sure we don't introduce unsoundness
@@ -1875,7 +1904,9 @@ class CheckCaptures extends Recheck, SymTransformer: | |||
def traverse(t: Tree)(using Context) = t match | |||
case tree: InferredTypeTree => | |||
case tree: New => | |||
case tree: TypeTree => checkAppliedTypesIn(tree.withType(tree.nuType)) | |||
case tree: TypeTree => | |||
CCState.withCapAsRoot: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should leave a comment to make sure we don't introduce unsoundness
Strip implied cap.rd sets from Capability types in extends and bounds
I.e. We do not add an implicit cap.rd in
class C extends Capability
type T <: C
Don't map CapSet^ to CapSet^{fresh}. Assume
^
is root in some comparisons with CapSet.