mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add syntax "[#Color(...)#]" for object literals, to be used by Playgrounds for inline color wells etc. The arguments are forwarded to the relevant constructor (although we will probably change this soon, since (colorLiteralRed:... blue:... green:... alpha) is kind of verbose). Add _ColorLiteralConvertible and _ImageLiteralConvertible protocols, and link them to the new expressions in the type checker. CSApply replaces the object literal expressions with a call to the appropriate protocol witness. Swift SVN r27479
7 lines
644 B
Swift
7 lines
644 B
Swift
// RUN: %target-parse-verify-swift
|
|
|
|
let _ = [##] // expected-error{{expected identifier after '[#' in object literal expression}} expected-error{{consecutive statements on a line must be separated by ';'}} expected-error{{expected expression}}
|
|
let _ = [#what#] // expected-error{{expected argument list in object literal}} expected-error{{consecutive statements on a line must be separated by ';'}} expected-error{{expected expression}}
|
|
let _ = [#what()#] // expected-error{{use of unknown object literal name 'what'}}
|
|
let _ = [#Color( // expected-error{{expected ',' separator}} expected-error@+1{{expected expression in list of expressions}}
|