-
Notifications
You must be signed in to change notification settings - Fork 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
Existential Capabilities #20566
Existential Capabilities #20566
Commits on Jul 17, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 0e71645 - Browse repository at this point
Copy the full SHA 0e71645View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b9d305 - Browse repository at this point
Copy the full SHA 5b9d305View commit details -
Generalize isAlwaysEmpty and streamline isBoxedCaptured
- isBoxedCaptured no longer requires the construction of intermediate capture sets. - isAlwaysEmpty is also true for solved variables that have no elements
Configuration menu - View commit details
-
Copy full SHA for b375d97 - Browse repository at this point
Copy the full SHA b375d97View commit details -
- Use a uniform criterion when to add them - Don't add them for @constructorOnly or @cc.untrackedCaptures arguments @untrackedCaptures is a new annotation
Configuration menu - View commit details
-
Copy full SHA for f9ddc71 - Browse repository at this point
Copy the full SHA f9ddc71View commit details -
Improve handling of no-cap-under-box/unbox errors
- Improve error messages - Better propagation of @uncheckedCaptures - -un-deprecacte caps.unsafeUnbox and friends.
Configuration menu - View commit details
-
Copy full SHA for 0458012 - Browse repository at this point
Copy the full SHA 0458012View commit details -
Go back to original no cap in box/unbox restrictions
We go back to the original lifetime restriction that box/unbox cannot apply to universal capture sets, and drop the later restriction that type variable instantiations may not deeply capture cap. The original restriction is proven to be sound and is probably expressive enough when we add reach capabilities. This required some changes in tests and also in the standard library. The original restriction is in place for source <= 3.2 and >= 3.5. Source 3.3 and 3.4 use the alternative restriction on type variable instances. Some neg tests have not been brought forward to 3.4. They are all in tests/neg-customargs/captures and start with //> using options -source 3.4 We need to look at these tests one-by-one and analyze whether the new 3.5 behavior is correct.
Configuration menu - View commit details
-
Copy full SHA for 24506ae - Browse repository at this point
Copy the full SHA 24506aeView commit details -
More robust scheme to re-check definitions once.
The previous scheme relied on subtle and unstated assumptions between symbol updates and re-checking. If they were violated some definitions could not be rechecked at all. The new scheme is more robust. We always re-check except when the checker implementation returns true for `skipRecheck`. And that test is based on an explicitly maintained set of completed symbols.
Configuration menu - View commit details
-
Copy full SHA for 1008a0d - Browse repository at this point
Copy the full SHA 1008a0dView commit details -
Configuration menu - View commit details
-
Copy full SHA for a30cf47 - Browse repository at this point
Copy the full SHA a30cf47View commit details -
Enable existential capabilities
Enabled from 3.5. There are still a number of open questions - Clarify type inference with existentials propagating into capture sets. Right now, no pos or run test exercises this. - Also map arguments of function to existentials (at least double flip ones). - Adapt reach capabilities and drop previous restrictions.
Configuration menu - View commit details
-
Copy full SHA for 20b8630 - Browse repository at this point
Copy the full SHA 20b8630View commit details -
Tighten rules against escaping local references
Fixes the problem in effect-swaps.scala
Configuration menu - View commit details
-
Copy full SHA for ca715e8 - Browse repository at this point
Copy the full SHA ca715e8View commit details -
Go back to expansion of capability class references at Setup
This gives us the necessary levers to switch to existential capabilities. # Conflicts: # compiler/src/dotty/tools/dotc/cc/CaptureOps.scala
Configuration menu - View commit details
-
Copy full SHA for b9c2109 - Browse repository at this point
Copy the full SHA b9c2109View commit details -
An expandedUniversalSet was the same as `{cap}` but not reference-equal to CaptureSet.universal. This construct was previously needed to avoid multiple expansions, but this does not seem to be the case any longer so the construct can be dropped.
Configuration menu - View commit details
-
Copy full SHA for 420f2cd - Browse repository at this point
Copy the full SHA 420f2cdView commit details -
Configuration menu - View commit details
-
Copy full SHA for e9474ff - Browse repository at this point
Copy the full SHA e9474ffView commit details -
Map capability classes to existentials
# Conflicts: # compiler/src/dotty/tools/dotc/cc/Setup.scala
Configuration menu - View commit details
-
Copy full SHA for 0161bb0 - Browse repository at this point
Copy the full SHA 0161bb0View commit details -
Change encoding of impure dependent function types
The encoding of (x: T) => U in capture checked code has changed. Previously: T => U' { def apply(x: T): U } Now: (T -> U' { def apply(x: T): U })^{cap} We often handle dependent functions by transforming the apply method and then mapping back to a function type using `.toFunctionType`. But that would always generate a pure function, so the impurity info could get lost.
Configuration menu - View commit details
-
Copy full SHA for 7296b40 - Browse repository at this point
Copy the full SHA 7296b40View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4add745 - Browse repository at this point
Copy the full SHA 4add745View commit details -
Let only value types derive from Capabilities
Fixes crash with opaque types reported by @natsukagami
Configuration menu - View commit details
-
Copy full SHA for d5c15dd - Browse repository at this point
Copy the full SHA d5c15ddView commit details -
Type inference for existentials
- Add existentials to inferred types - Map existentials in one compared type to existentials in the other - Also: Don't re-analyze existentials in mapCap.
Configuration menu - View commit details
-
Copy full SHA for d242e01 - Browse repository at this point
Copy the full SHA d242e01View commit details -
Configuration menu - View commit details
-
Copy full SHA for 687516e - Browse repository at this point
Copy the full SHA 687516eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b27b69 - Browse repository at this point
Copy the full SHA 9b27b69View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1d3ae88 - Browse repository at this point
Copy the full SHA 1d3ae88View commit details -
Fix existential mapping of non-dependent impure function aliases =>
There was a forgotten case.
Configuration menu - View commit details
-
Copy full SHA for 4ad9e3c - Browse repository at this point
Copy the full SHA 4ad9e3cView commit details -
Drop restrictions in widenReachCaptures
These should be no longer necessary with existentials.
Configuration menu - View commit details
-
Copy full SHA for b950c7d - Browse repository at this point
Copy the full SHA b950c7dView commit details -
Configuration menu - View commit details
-
Copy full SHA for adfb700 - Browse repository at this point
Copy the full SHA adfb700View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7bf8be7 - Browse repository at this point
Copy the full SHA 7bf8be7View commit details -
Refine parameter accessors that have nonempty deep capture sets
A parameter accessor with a nonempty deep capture set needs to be tracked in refinements even if it is pure, as long as it might contain captures that can be referenced using a reach capability.
Configuration menu - View commit details
-
Copy full SHA for cd78a9e - Browse repository at this point
Copy the full SHA cd78a9eView commit details -
More precise capture set unions
When we take `{elem} <: B ++ C` where `elem` is not yet included in `B ++ C`, B is a constant and C is a variable, propagate with `{elem} <: C`. Likewise if C is a constant and B is a variable. This tries to minimize the slack between a union and its operands. Note: Propagation does not happen very often in our test suite so far: Once in pos tests and 15 times in scala2-library-cc.
Configuration menu - View commit details
-
Copy full SHA for 28f4bb5 - Browse repository at this point
Copy the full SHA 28f4bb5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 04aa63d - Browse repository at this point
Copy the full SHA 04aa63dView commit details -
Reclassify maximal capabilities
Don't treat user-defined capabilities deriving from caps.Capability as maximal. That was a vestige from when we treated capability classes natively. It caused code that should compile to fail because if `x extends Capability` then `x` could not be widened to `x*`. As a consequence we have one missed error in effect-swaps again, which re-establishes the original (faulty) situation.
Configuration menu - View commit details
-
Copy full SHA for 9436f11 - Browse repository at this point
Copy the full SHA 9436f11View commit details -
We might want to treat it specially since a RefiningVar should ideally be closed for further additions when the constructor has been analyzed.
Configuration menu - View commit details
-
Copy full SHA for 7ac94c9 - Browse repository at this point
Copy the full SHA 7ac94c9View commit details -
Configuration menu - View commit details
-
Copy full SHA for aad3395 - Browse repository at this point
Copy the full SHA aad3395View commit details -
Improve printing of capture sets before cc
Use the syntactic sugar instead of expanding with capsOf
Configuration menu - View commit details
-
Copy full SHA for 1c11071 - Browse repository at this point
Copy the full SHA 1c11071View commit details -
Configuration menu - View commit details
-
Copy full SHA for 72462a7 - Browse repository at this point
Copy the full SHA 72462a7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0a1854d - Browse repository at this point
Copy the full SHA 0a1854dView commit details -
Configuration menu - View commit details
-
Copy full SHA for c965322 - Browse repository at this point
Copy the full SHA c965322View commit details -
Add option to avoid intersections for class refinements
Add an option to avoid the type intersection when we do a select of a parameter accessor that is mentioned in a class refinement type. It seems to give us a little bit if performance, but nothing significant. So the option is off by default.
Configuration menu - View commit details
-
Copy full SHA for 2cd685a - Browse repository at this point
Copy the full SHA 2cd685aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8b03405 - Browse repository at this point
Copy the full SHA 8b03405View commit details -
Configuration menu - View commit details
-
Copy full SHA for 520100b - Browse repository at this point
Copy the full SHA 520100bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7708276 - Browse repository at this point
Copy the full SHA 7708276View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2b04423 - Browse repository at this point
Copy the full SHA 2b04423View commit details -
Configuration menu - View commit details
-
Copy full SHA for 074be82 - Browse repository at this point
Copy the full SHA 074be82View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1640340 - Browse repository at this point
Copy the full SHA 1640340View commit details -
The condition on capturing types did not make sense. In a type T^{} with an empty capture set `T` can still be a type variable that's instantiated to a type with a capture set. Instead, T^cs is always pure if T is always pure. For instance `List[T]^{p}` is always pure. That's important in the context of the standard library, where such a type usually results from an instantiation of a type variable such as `C[T]^{p}`.
Configuration menu - View commit details
-
Copy full SHA for 4333d3e - Browse repository at this point
Copy the full SHA 4333d3eView commit details -
Fix special capture set handling in recheckApply, Step 1
Step1: refactor The logic was querying the original types of trees, but we want the rechecked types instead.
Configuration menu - View commit details
-
Copy full SHA for 90749ea - Browse repository at this point
Copy the full SHA 90749eaView commit details -
Fix special capture set handling in recheckApply, Step 2
Step 2: Change the logic. The previous one was unsound. The new logic is a bot too conservative. I left comments in tests where it could be improved.
Configuration menu - View commit details
-
Copy full SHA for bc818a9 - Browse repository at this point
Copy the full SHA bc818a9View commit details -
Refactor CaptureRef operations
Make all operations final methods on Type or CaptureRef
Configuration menu - View commit details
-
Copy full SHA for bb94805 - Browse repository at this point
Copy the full SHA bb94805View commit details -
Break out CaptureRef into a separate file
Move extension methods on CaptureRef into CaptureRef itself or into CaptureOps
Configuration menu - View commit details
-
Copy full SHA for cc95088 - Browse repository at this point
Copy the full SHA cc95088View commit details -
Don't box arguments of any form of type cast or test
Previously, only asInstanceOf was excluded.
Configuration menu - View commit details
-
Copy full SHA for 3667ab8 - Browse repository at this point
Copy the full SHA 3667ab8View commit details -
Revert "Fix special capture set handling in recheckApply, Step 2"
This reverts commit f1f5a05. # Conflicts: # compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala
Configuration menu - View commit details
-
Copy full SHA for d8ace30 - Browse repository at this point
Copy the full SHA d8ace30View commit details -
Fix special capture set handling in recheckApply, Step 2 revised
Step 2: Change the logic. The previous one was unsound. The new logic is makes use of the distinction between regular and unboxed parameters.
Configuration menu - View commit details
-
Copy full SHA for 7db1d43 - Browse repository at this point
Copy the full SHA 7db1d43View commit details -
Fix captureSet computations for false reach capabilities
Fix the capture set computation of a type T @reachCapability where T is not a singleton captureRef. Such types can be the results of typemaps. The capture set in this case should be the deep capture set of T.
Configuration menu - View commit details
-
Copy full SHA for c1036bf - Browse repository at this point
Copy the full SHA c1036bfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5a35160 - Browse repository at this point
Copy the full SHA 5a35160View commit details -
Make the unboxed parameter scheme standard
Drop the config option that enables it.
Configuration menu - View commit details
-
Copy full SHA for 082214e - Browse repository at this point
Copy the full SHA 082214eView commit details -
Configuration menu - View commit details
-
Copy full SHA for afcbdcb - Browse repository at this point
Copy the full SHA afcbdcbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0b22948 - Browse repository at this point
Copy the full SHA 0b22948View commit details -
Configuration menu - View commit details
-
Copy full SHA for 91cbca8 - Browse repository at this point
Copy the full SHA 91cbca8View commit details -
Also, fix Seq rechecking so that elements are always box adapted
Configuration menu - View commit details
-
Copy full SHA for 54828c7 - Browse repository at this point
Copy the full SHA 54828c7View commit details -
Don't do post checks in inlined code
Capability references in inlined code might end up not being tracked or being redundant. Don't flag this as an error.
Configuration menu - View commit details
-
Copy full SHA for c8d418a - Browse repository at this point
Copy the full SHA c8d418aView commit details
Commits on Jul 18, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 04dba38 - Browse repository at this point
Copy the full SHA 04dba38View commit details -
Give some explanation if a capture set was under-approximated
Give some explanation if an empty capture set was the result of an under-approximation.
Configuration menu - View commit details
-
Copy full SHA for 9391b9a - Browse repository at this point
Copy the full SHA 9391b9aView commit details -
Perform bounds checking before checking self types. Checking self types interpolates them, which may give an upper approximation solution that failes subsequent bounds checks. On the other hand, well-formedness checkimng should come after self types checking since otherwise we get spurious "has empty capture set, cannot be tracked" messages.
Configuration menu - View commit details
-
Copy full SHA for fac643a - Browse repository at this point
Copy the full SHA fac643aView commit details