Commit 0da66e2
committed
Fix various issues with maximal capabilities
The subsumes check mistakenly allowed any capability to subsume `cap`, since `cap` is expanded
as `caps.cap`, and by the path subcapturing rule `caps.cap <: caps`, where the capture set of
`caps` is empty. This allowed quite a few hidden errors to go through. This commit fixes the
subcapturing issue and all downstream issues caused by that fix.
In particular:
- Don't use path comparison for `x subsumes caps.cap`
- Don't allow an opened existential on the left of a comparison to leak into a capture set on
the right. This would give a "leak" error later in healCaptures.
- Print `Fresh.Cap` as `fresh` in error messages where both `cap` and `Fresh.Cap` are printed.
This avoid confustion with `cap`. Similarly, print `A => B` as `A ->{fresh B` in that case.
- Print pre-cc annotated capturing types with @retains annotations with `^`. The annotation is
already rendered as a set in this case, but the `^` was missing.
- Don't recheck `_` right hand sides of uninitialized variables. These were handled in ways
that broke freshness checking. The new `uninitialied` scheme does not have this problem.
- Convert cap to fresh in type arguments of asInstanceOf
- Have Fresh.FromCap also work for pre-cc @retains annotated types
- Don't cache captureSetOfInfos under mode IgnoreCaptures
- Let cap and Fresh.Cap subsume other refs only if these others refs cannot
be added separately to a capture set.
- When creating a instance of a capability class, assume fresh.cap, not cap as capability.
Three tests had to be disabled, they were renamed from test.scala to test.scala.disabled.
Two of these will work again when we stop boxing alias types (next commit). The third,
ex-fun-aliases needs more investigation. Also, the neg test box-adapt-cases needs
to be re-evaluated.1 parent 0f49ba4 commit 0da66e2
File tree
42 files changed
+355
-130
lines changed- compiler/src/dotty/tools/dotc
- cc
- core
- printing
- transform
- scala2-library-cc/src/scala/collection/immutable
- tests
- neg-custom-args/captures
- neg
- pos-custom-args/captures
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
42 files changed
+355
-130
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| |||
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
53 | | - | |
54 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
55 | 61 | | |
56 | 62 | | |
57 | 63 | | |
| |||
668 | 674 | | |
669 | 675 | | |
670 | 676 | | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
671 | 690 | | |
672 | 691 | | |
673 | 692 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 168 | + | |
178 | 169 | | |
179 | | - | |
| 170 | + | |
180 | 171 | | |
181 | 172 | | |
182 | 173 | | |
| |||
221 | 212 | | |
222 | 213 | | |
223 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
224 | 242 | | |
225 | 243 | | |
226 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
165 | 170 | | |
166 | 171 | | |
167 | 172 | | |
| |||
399 | 404 | | |
400 | 405 | | |
401 | 406 | | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | 407 | | |
409 | 408 | | |
410 | 409 | | |
| |||
442 | 441 | | |
443 | 442 | | |
444 | 443 | | |
445 | | - | |
| 444 | + | |
446 | 445 | | |
447 | 446 | | |
448 | 447 | | |
| |||
538 | 537 | | |
539 | 538 | | |
540 | 539 | | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
545 | 543 | | |
546 | 544 | | |
547 | 545 | | |
548 | 546 | | |
549 | | - | |
| 547 | + | |
550 | 548 | | |
551 | 549 | | |
552 | 550 | | |
| |||
562 | 560 | | |
563 | 561 | | |
564 | 562 | | |
565 | | - | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
566 | 566 | | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
567 | 570 | | |
568 | 571 | | |
569 | 572 | | |
| |||
635 | 638 | | |
636 | 639 | | |
637 | 640 | | |
638 | | - | |
| 641 | + | |
639 | 642 | | |
640 | 643 | | |
641 | 644 | | |
| |||
1035 | 1038 | | |
1036 | 1039 | | |
1037 | 1040 | | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
1038 | 1047 | | |
1039 | 1048 | | |
1040 | 1049 | | |
1041 | 1050 | | |
1042 | 1051 | | |
| 1052 | + | |
| 1053 | + | |
1043 | 1054 | | |
1044 | 1055 | | |
1045 | 1056 | | |
| |||
1054 | 1065 | | |
1055 | 1066 | | |
1056 | 1067 | | |
1057 | | - | |
1058 | 1068 | | |
1059 | 1069 | | |
1060 | 1070 | | |
| |||
1066 | 1076 | | |
1067 | 1077 | | |
1068 | 1078 | | |
1069 | | - | |
1070 | 1079 | | |
1071 | 1080 | | |
1072 | 1081 | | |
| |||
1097 | 1106 | | |
1098 | 1107 | | |
1099 | 1108 | | |
| 1109 | + | |
1100 | 1110 | | |
1101 | 1111 | | |
1102 | 1112 | | |
| |||
1107 | 1117 | | |
1108 | 1118 | | |
1109 | 1119 | | |
| 1120 | + | |
1110 | 1121 | | |
1111 | 1122 | | |
1112 | 1123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
| 336 | + | |
337 | 337 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
343 | 344 | | |
344 | 345 | | |
345 | 346 | | |
346 | 347 | | |
347 | 348 | | |
348 | 349 | | |
349 | | - | |
| 350 | + | |
350 | 351 | | |
351 | 352 | | |
352 | 353 | | |
| |||
355 | 356 | | |
356 | 357 | | |
357 | 358 | | |
358 | | - | |
| 359 | + | |
359 | 360 | | |
360 | 361 | | |
361 | 362 | | |
| |||
771 | 772 | | |
772 | 773 | | |
773 | 774 | | |
774 | | - | |
| 775 | + | |
775 | 776 | | |
776 | 777 | | |
777 | 778 | | |
| |||
1227 | 1228 | | |
1228 | 1229 | | |
1229 | 1230 | | |
1230 | | - | |
1231 | | - | |
1232 | | - | |
1233 | | - | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
1234 | 1236 | | |
1235 | 1237 | | |
1236 | 1238 | | |
| |||
0 commit comments