mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
* Implement the majority of parsing support for SE-0039.
* Parse old object literals names using new syntax and provide FixIt.
For example, parse "#Image(imageLiteral:...)" and provide a FixIt to
change it to "#imageLiteral(resourceName:...)". Now we see something like:
test.swift:4:9: error: '#Image' has been renamed to '#imageLiteral
var y = #Image(imageLiteral: "image.jpg")
^~~~~~ ~~~~~~~~~~~~
#imageLiteral resourceName
Handling the old syntax, and providing a FixIt for that, will be handled in a separate
commit.
Needs tests. Will be provided in later commit once full parsing support is done.
* Add back pieces of syntax map for object literals.
* Add parsing support for old object literal syntax.
... and provide fixits to new syntax.
Full tests to come in later commit.
* Improve parsing of invalid object literals with old syntax.
* Do not include bracket in code completion results.
* Remove defunct code in SyntaxModel.
* Add tests for migration fixits.
* Add literals to code completion overload tests.
@akyrtzi told me this should be fine.
* Clean up response tests not to include full paths.
* Further adjust offsets.
* Mark initializer for _ColorLiteralConvertible in UIKit as @nonobjc.
* Put attribute in the correct place.
49 lines
1.8 KiB
Plaintext
49 lines
1.8 KiB
Plaintext
// RUN: rm -rf %t && mkdir %t
|
|
// RUN: %build-irgen-test-overlays
|
|
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
|
|
|
|
// REQUIRES: CPU=x86_64
|
|
// REQUIRES: objc_interop
|
|
|
|
// CHECK: @"\01L_selector_data(initWithRed:green:blue:)"
|
|
// CHECK: @"\01L_selector_data(colorWithRed:green:blue:)"
|
|
// CHECK: @"\01L_selector_data(otherColorForRed:green:blue:)"
|
|
|
|
sil_stage raw
|
|
|
|
import Builtin
|
|
import Swift
|
|
import gizmo
|
|
|
|
class SwiftGizmo : Gizmo {
|
|
init(red: Float, green: Float, blue: Float) { }
|
|
func color(red: Float, green: Float, blue: Float)
|
|
func otherColorFor(red: Float, green: Float, blue: Float)
|
|
}
|
|
sil_vtable SwiftGizmo {}
|
|
|
|
sil @_TToFC18objc_implicit_with10SwiftGizmocfT3redSf5greenSf4blueSf_S0_ : $@convention(objc_method) (Float, Float, Float, @owned SwiftGizmo) -> @owned SwiftGizmo {
|
|
bb0(%0 : $Float, %1 : $Float, %2 : $Float, %3 : $SwiftGizmo):
|
|
return %3 : $SwiftGizmo
|
|
}
|
|
|
|
sil @_TToFC18objc_implicit_with10SwiftGizmocfT7bellsOnSi_GSQS0__ : $@convention(objc_method) (Int, @owned SwiftGizmo) -> @owned SwiftGizmo! {
|
|
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
|
unreachable
|
|
}
|
|
|
|
sil @_TToFC18objc_implicit_with10SwiftGizmocfT_S0_ : $@convention(objc_method) (@owned SwiftGizmo) -> @owned SwiftGizmo {
|
|
bb0(%0 : $SwiftGizmo):
|
|
return %0 : $SwiftGizmo
|
|
}
|
|
|
|
sil @_TToFC18objc_implicit_with10SwiftGizmo5colorfT3redSf5greenSf4blueSf_T_ : $@convention(objc_method) (Float, Float, Float, @owned SwiftGizmo) -> @owned SwiftGizmo {
|
|
bb0(%0 : $Float, %1 : $Float, %2 : $Float, %3 : $SwiftGizmo):
|
|
return %3 : $SwiftGizmo
|
|
}
|
|
|
|
sil @_TToFC18objc_implicit_with10SwiftGizmo13otherColorForfT3redSf5greenSf4blueSf_T_ : $@convention(objc_method) (Float, Float, Float, @owned SwiftGizmo) -> @owned SwiftGizmo {
|
|
bb0(%0 : $Float, %1 : $Float, %2 : $Float, %3 : $SwiftGizmo):
|
|
return %3 : $SwiftGizmo
|
|
}
|