Commit ea6b0a4
authored
Add restricted capabilities
Implementation along the lines of
#23463
- [x] Syntax and parsing rules for `only`-capabilities.
- [x] A `Classifier` base trait.
- [x] Enforce restriction that a class cannot inherit two unrelated
classified capability classes.
- [x] A new capability class for `only`-capabilities.
- [x] Implement `captureSetOfInfo` for `only` capabilities.
- [x] The empty capability is `x.only[Nothing]`. It should have empty
`captureSetOfInfo`.
- [x] Well-formedness rules: `only` must refer to a classified
capability class.
- [x] Normalization rules:
- it's `*`, then `.only`, then `.rd`,
- multiple `.only` normalize to the smallest one if the classes are
related,
- multiple `.only` normalize to the empty capability if the classes are
not related.
- [x] define transitive capture set and cache it in a capability. The
_tcs_ does not exist if a capture set in the hierarchy is still an
unsolved capture set variable.
- [x] Add a _classifier_ field to `FreshCap` and `ResultCap`.
- [x] Modify `capToFresh` and `toResultInResults` so that the classifier
field is correctly set.
- [x] Using `tcs`, define when a capability is classified by a
classifier class.
- [x] A FreshCap with a classifier `C` can subsume only capabilities
that are classified as `C`.
- [x] Implement subsumption rules:
- `c.as[C] <: d` if `c <: d` or `c.as[D] <: empty`
- `c.as[C] <: d.as[D]` if `c <: d` and `C` derives from `D`
- `c <: d.as[D]` if `c <: d` and `c` is classified as `D`
- `c.as[D] <: empty` if `tcs(c)` consists of capabilities that all
derive from classifier classes unrelated to `D`.x.only[C] (#23485)File tree
67 files changed
+723
-206
lines changed- compiler/src/dotty/tools/dotc
- ast
- cc
- core
- parsing
- printing
- typer
- docs/_docs/internals
- library/src/scala
- annotation/internal
- caps
- project
- tests
- neg-custom-args/captures
- pos-custom-args/captures
- run-tasty-inspector
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
67 files changed
+723
-206
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2321 | 2321 | | |
2322 | 2322 | | |
2323 | 2323 | | |
2324 | | - | |
2325 | | - | |
2326 | | - | |
2327 | | - | |
2328 | 2324 | | |
2329 | 2325 | | |
2330 | 2326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
553 | 562 | | |
554 | 563 | | |
555 | 564 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
84 | 94 | | |
85 | 95 | | |
86 | 96 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| |||
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
293 | | - | |
| 295 | + | |
294 | 296 | | |
295 | 297 | | |
296 | 298 | | |
| |||
376 | 378 | | |
377 | 379 | | |
378 | 380 | | |
379 | | - | |
| 381 | + | |
380 | 382 | | |
381 | 383 | | |
382 | 384 | | |
| |||
442 | 444 | | |
443 | 445 | | |
444 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
445 | 471 | | |
446 | 472 | | |
447 | 473 | | |
| |||
473 | 499 | | |
474 | 500 | | |
475 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
476 | 512 | | |
477 | 513 | | |
478 | 514 | | |
| |||
587 | 623 | | |
588 | 624 | | |
589 | 625 | | |
590 | | - | |
591 | 626 | | |
592 | 627 | | |
593 | 628 | | |
| |||
605 | 640 | | |
606 | 641 | | |
607 | 642 | | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
608 | 654 | | |
609 | 655 | | |
610 | 656 | | |
| |||
618 | 664 | | |
619 | 665 | | |
620 | 666 | | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | 667 | | |
644 | 668 | | |
645 | 669 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
86 | 94 | | |
87 | 95 | | |
88 | 96 | | |
| |||
210 | 218 | | |
211 | 219 | | |
212 | 220 | | |
| 221 | + | |
213 | 222 | | |
214 | 223 | | |
215 | 224 | | |
| |||
403 | 412 | | |
404 | 413 | | |
405 | 414 | | |
| 415 | + | |
| 416 | + | |
406 | 417 | | |
407 | 418 | | |
408 | 419 | | |
409 | 420 | | |
410 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
411 | 442 | | |
412 | 443 | | |
413 | 444 | | |
| |||
557 | 588 | | |
558 | 589 | | |
559 | 590 | | |
| 591 | + | |
| 592 | + | |
560 | 593 | | |
561 | 594 | | |
562 | 595 | | |
| |||
641 | 674 | | |
642 | 675 | | |
643 | 676 | | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
644 | 687 | | |
645 | 688 | | |
646 | 689 | | |
| |||
649 | 692 | | |
650 | 693 | | |
651 | 694 | | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
652 | 714 | | |
653 | 715 | | |
654 | 716 | | |
| |||
680 | 742 | | |
681 | 743 | | |
682 | 744 | | |
| 745 | + | |
| 746 | + | |
683 | 747 | | |
684 | 748 | | |
685 | 749 | | |
686 | 750 | | |
687 | 751 | | |
688 | 752 | | |
689 | 753 | | |
690 | | - | |
691 | 754 | | |
692 | 755 | | |
693 | 756 | | |
| |||
1344 | 1407 | | |
1345 | 1408 | | |
1346 | 1409 | | |
1347 | | - | |
1348 | 1410 | | |
1349 | 1411 | | |
| 1412 | + | |
| 1413 | + | |
1350 | 1414 | | |
1351 | 1415 | | |
1352 | 1416 | | |
| |||
1358 | 1422 | | |
1359 | 1423 | | |
1360 | 1424 | | |
1361 | | - | |
1362 | | - | |
| 1425 | + | |
| 1426 | + | |
1363 | 1427 | | |
1364 | 1428 | | |
1365 | 1429 | | |
| |||
1375 | 1439 | | |
1376 | 1440 | | |
1377 | 1441 | | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
1378 | 1449 | | |
1379 | 1450 | | |
1380 | 1451 | | |
| |||
1402 | 1473 | | |
1403 | 1474 | | |
1404 | 1475 | | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
1405 | 1479 | | |
1406 | 1480 | | |
1407 | 1481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
0 commit comments