Post-commit review follow-up:
This works better for properties that were all-caps, such as `URL`.
Thanks @harlanhaskins for the tip!
rdar://problem/32845968
Setting up an invocation adds -aarch64-use-tbi if the target is for
AArch64. In the fix-it passes, we inherit the frontend options which
already has it from the driver passing it down to the frontend.
rdar://problem/32284152
The clang::RewriteBuffer can do weird things when seeing multiple
replacements where the replacement text is one character longer or
one character shorter than the range it is replacing.
rdar://problem/32234525
If code is irreparably broken when migrating, make sure to
check that the pre-fix-it compiler instance is `nullptr` and
bail if so.
rdar://problem/32240138
This allows the migrator to pick up fix-its from notes such as:
“Argument of #selector refers to instance method '___' that is not
exposed to Objective-C”
Add some more testing for minimal/complete workflows, and upstream
the cross-file fix-it test.
rdar://problem/32228948
If the replacement type was a function type or protocol-constrained type (e.g. 'Class & Proto) and the existing type had a postfix ? or !, we weren't wrapping the replacement in parens. This would result in an incorrect/ambiguous new type. This patch wraps the replacement in parens if it contains an & or ->, the existing type has a trailing ? or !.
Resolves rdar://problem/32082269.
Some APIs that expected a String now expect a Substring and vice
versa. To ease the transition, emit fix-its on conversion errors
between these types that the migrator can pick up.
When converting from Substring -> String, suggest wrapping in
`String.init`.
When converting from String -> Substring, suggest appending the
void subscript `[]`. (This isn't implemented yet so this is
hidden behind a flag).
This can possibly be generalized later when converting between
some sequence and its subsequence, such as Array and ArraySlice,
for example.
rdar://problem/31665649
rdar://problem/31666638
There is no implicit conversion between String and Substring, so
the migrator can offer fix-its to convert between the two by wrapping
in String.init or adding the void subscript [] accordingly. This
commit just adds the tests for migration for the time being.
rdar://problem/30928902
With SE-110, the migrator may get a recommendation to add a Void
placeholder in the call to f in:
func foo(f: (Void) -> ()) {
f()
}
Here, f was () -> () in Swift 3 but now (()) -> () in Swift 4. Adding a
type placeholder in the f() call isn't helpful for migration, although
this particular fix-it should be to fix the f parameter's type.
rdar://problem/31895432
Based on recommendations in SE-0160, there are two migration workflows:
- Conservative: Maintain @objc visibility that was inferred in Swift 3
by adding @objc to all declarations that were implicitily visible to
the Objective-C runtime. This is invoked in the migrator by adding the
-migrate-keep-objc-visibility flag.
- Minimal: Only declarations that must be visible to Objective-C based
on their uses (or in cases like dynamic vars) are migrated.
rdar://problem/31876357
This handles optionality changes and type rewrites in function param and return types and constructor param and failability types.
Resolves rdar://problem/31766010