mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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.
76 lines
1.9 KiB
Plaintext
76 lines
1.9 KiB
Plaintext
{
|
|
key.offset: 0,
|
|
key.length: 139,
|
|
key.diagnostic_stage: source.diagnostic.stage.swift.parse,
|
|
key.syntaxmap: [
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.comment,
|
|
key.offset: 0,
|
|
key.length: 71
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.comment,
|
|
key.offset: 71,
|
|
key.length: 40
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 112,
|
|
key.length: 3
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 116,
|
|
key.length: 1
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 121,
|
|
key.length: 5
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 127,
|
|
key.length: 4
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 133,
|
|
key.length: 4
|
|
}
|
|
],
|
|
key.diagnostics: [
|
|
{
|
|
key.line: 4,
|
|
key.column: 8,
|
|
key.filepath: syntaxmap-object-literals.swift,
|
|
key.severity: source.diagnostic.severity.error,
|
|
key.description: "consecutive statements on a line must be separated by ';'",
|
|
key.diagnostic_stage: source.diagnostic.stage.swift.parse,
|
|
key.fixits: [
|
|
{
|
|
key.offset: 119,
|
|
key.length: 0,
|
|
key.sourcetext: ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.line: 4,
|
|
key.column: 9,
|
|
key.filepath: syntaxmap-object-literals.swift,
|
|
key.severity: source.diagnostic.severity.error,
|
|
key.description: "expected initial value after '='",
|
|
key.diagnostic_stage: source.diagnostic.stage.swift.parse
|
|
},
|
|
{
|
|
key.line: 4,
|
|
key.column: 9,
|
|
key.filepath: syntaxmap-object-literals.swift,
|
|
key.severity: source.diagnostic.severity.error,
|
|
key.description: "expected expression",
|
|
key.diagnostic_stage: source.diagnostic.stage.swift.parse
|
|
}
|
|
]
|
|
}
|