Skip to content

Commit 7d62c54

Browse files
authored
Move source incompatible changes to Future directions.
1 parent 1830066 commit 7d62c54

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

proposals/NNNN-migration-tooling-for-upcoming-features.md

+19-20
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ make the existing actor isolation inference explicit. If they enable the
5252
upcoming feature, their code will simply behave differently. This was a
5353
point of debate in the review of SE-0401, and the Language Steering Group
5454
concluded that automatic migration tooling is the right way to address this
55-
particular workflow, as [noted in the acceptance notes][SE-0401-acceptance:
55+
particular workflow, as [noted in the acceptance notes][SE-0401-acceptance]:
5656

5757
> the Language Steering Group believes that separate migration tooling to
5858
> help programmers audit code whose behavior will change under Swift 6 mode
@@ -127,18 +127,19 @@ behavior in the *Source compatibility* section of the proposal.
127127

128128
## Detailed design
129129

130-
### Behavior
130+
Upcoming features that have mechanical migrations will support an adoption
131+
mode, which is a a new mode of building a project that will produce compiler
132+
warnings with attached fix-its that can be applied to preserve the behavior
133+
of the code when the upcoming feature is enabled. Adoption mode must not
134+
cause any new compiler errors, and the fix-its produced must preserve the
135+
source compatibility and behavior of the code.
131136

132-
The action of enabling a previously disabled source-breaking feature in adoption
133-
mode per se must not cause compilation errors.
134-
Additionally, this action will have no effect if the mode is not supported.
137+
Additionally, this action will have no effect if the mode is not supported
138+
for a given upcoming feature, i,e. because the upcoming feature does not
139+
have a mechanical migration.
135140
A corresponding warning will be emitted in this case to avoid the false
136141
impression that the impacted source code is compatible with the feature.
137142

138-
> [!NOTE]
139-
> Experimental features can be both additive and source-breaking.
140-
> Upcoming features are necessarily source-breaking.
141-
142143
Adoption mode should deliver guidance in the shape of regular diagnostics.
143144
For arbitrary upcoming features, adoption mode is expected to anticipate and
144145
call out any compatibility issues that result from enacting the feature,
@@ -147,17 +148,6 @@ alternatives whenever feasible.
147148
Compatibility issues encompass both source and binary compatibility issues,
148149
including behavioral changes.
149150

150-
Note that adoption mode does not provide any new general guarantees in respect
151-
to fix-its.
152-
We cannot promise to offer exclusively compatible modifications.
153-
Besides the impact of a change on dependent source code being generally
154-
unpredictable, it can be reasonable to couple compatible fix-its with
155-
potentially incompatible, albeit better, alternatives, as in `any P``some P`.
156-
The same stands for provision of modifications — features might not have a
157-
mechanical migration path, and the compiler remains inherently limited in the
158-
extent to which it can make assumptions about what is helpful or best for the
159-
programmer.
160-
161151
### Interface
162152

163153
#### Compiler
@@ -263,6 +253,15 @@ potentially source-breaking action.
263253

264254
## Future directions
265255

256+
### Producing source incompatible fix-its
257+
258+
For some upcoming features, a source change which alters the semantics of
259+
the program is a more desirable approach to addressing an error that comes
260+
from enabling an upcoming feature. For example, programmers might want to
261+
replace cases of `any P` with `some P`. Adoption tooling could support the
262+
option to produce source incompatible fix-its in cases where the compiler
263+
can detect that a different behavior might be more beneficial.
264+
266265
### Applications beyond migration
267266

268267
Adoption mode can be extrapolated to additive features, such as

0 commit comments

Comments
 (0)