Files
swift-mirror/test/Parse/object_literals.swift
Chris Willmore d4db635e3d Add object literal syntax and _{Color,Image}LiteralConvertible protocols
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
2015-04-20 12:55:56 +00:00

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}}