Commit 3920665
authored
Enable experimental mode when experimental feature is imported (#19807)
Make it easier to use experimental language features out of the box. We
already have `-experimental` that enables experimental mode globally by
adding the `@experimental` annotation to all top-level definitions. The
complication was that this flag was necessary to use experimental
language features. It was not always easy to set (for example in the
REPL) and it is all or nothing. Users can also annotate explicitly all
top-level definitions that use language features with `@experimental`.
Now, the import of an experimental language feature will automatically
enable experimental mode. If the import is at the top-level, all
definitions in the file are experimental.
We also remove the special case that makes all code generated with a
nightly or snapshot compiler compile as if in experimental mode. This
implies that now the behavior of nightlies is identical to the behavior
of release versions. The `-Yno-experimental` becomes a no-op and will be
removed in a later PR.
[test_scala2_library_tasty]File tree
210 files changed
+339
-331
lines changed- compiler
- src/dotty/tools/dotc
- config
- core
- transform
- typer
- test/dotty/tools/backend/jvm
- docs/_docs/reference/other-new-features
- project
- scaladoc-testcases/src/tests
- scaladoc/src/dotty/tools/scaladoc/snippets
- tests
- init-global
- pos
- warn
- neg-macros
- i18677-a
- i18677-b
- i19676
- i19842-a
- i19842-b
- newClassExtendsNoParents
- newClassExtendsOnlyTrait
- neg
- experimental-message-experimental-flag
- pos-custom-args/captures
- pos-macros
- annot-dependency-between-modules
- annot-in-object
- annot-suspend
- annot-then-inline
- erasedArgs
- i15413b
- i15413
- i19526b
- macro-annot-with-companion
- pos
- phantom-Eq2
- run-deep-subtype
- run-macros
- Xmacro-settings-compileTimeEnv
- Xmacro-settings-simple
- annot-add-global-class
- annot-add-global-object
- annot-add-local-class
- annot-add-local-object
- annot-add-nested-class
- annot-add-nested-object
- annot-annot-order
- annot-bind
- annot-changeVal
- annot-concrete-class
- annot-export
- annot-gen2
- annot-generate
- annot-macro-main
- annot-memo
- annot-mod-class-add-def
- annot-mod-class-add-inner-class
- annot-mod-class-add-lazy-val
- annot-mod-class-add-local-class
- annot-mod-class-add-val
- annot-mod-class-add-var
- annot-mod-class-data
- annot-mod-class-equals
- annot-mod-class-mod-def
- annot-mod-class-mod-val
- annot-mod-class-override-def
- annot-mod-class-override-val
- annot-mod-class-unused-new-sym
- annot-result-order
- annot-simple-fib
- annot-unrollLast
- i11685
- i12021
- i16734b
- i17105
- i19676
- macro-erased
- newClassExtendsClassParams
- newClassExtends
- newClassSelf
- newClass
- run
- publicInBinary
- quotes-add-erased
- quotes-reflection
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
210 files changed
+339
-331
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | 83 | | |
85 | 84 | | |
86 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
| |||
157 | 162 | | |
158 | 163 | | |
159 | 164 | | |
160 | | - | |
161 | | - | |
| 165 | + | |
| 166 | + | |
162 | 167 | | |
163 | 168 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | 169 | | |
171 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
172 | 178 | | |
173 | 179 | | |
174 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 87 | | |
94 | 88 | | |
95 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
409 | | - | |
410 | 409 | | |
411 | 410 | | |
412 | 411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2008 | 2008 | | |
2009 | 2009 | | |
2010 | 2010 | | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
2011 | 2018 | | |
2012 | 2019 | | |
2013 | 2020 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
420 | | - | |
| 420 | + | |
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
430 | 429 | | |
431 | 430 | | |
432 | 431 | | |
| |||
438 | 437 | | |
439 | 438 | | |
440 | 439 | | |
441 | | - | |
| 440 | + | |
442 | 441 | | |
443 | 442 | | |
444 | 443 | | |
| |||
546 | 545 | | |
547 | 546 | | |
548 | 547 | | |
549 | | - | |
550 | | - | |
| 548 | + | |
| 549 | + | |
551 | 550 | | |
552 | 551 | | |
553 | 552 | | |
| |||
584 | 583 | | |
585 | 584 | | |
586 | 585 | | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
| 586 | + | |
591 | 587 | | |
592 | 588 | | |
593 | | - | |
594 | | - | |
595 | 589 | | |
596 | 590 | | |
597 | 591 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
797 | 798 | | |
798 | 799 | | |
799 | 800 | | |
800 | | - | |
801 | | - | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
802 | 805 | | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
823 | 822 | | |
824 | 823 | | |
825 | 824 | | |
826 | | - | |
827 | 825 | | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
828 | 834 | | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
842 | 842 | | |
843 | | - | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
844 | 852 | | |
845 | 853 | | |
846 | 854 | | |
| |||
Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
269 | | - | |
| 268 | + | |
270 | 269 | | |
271 | 270 | | |
272 | 271 | | |
| |||
0 commit comments