mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Now that we have expressions that start with #, the [# introducer for
object literals is no longer guaranteed to indicate an object
literal. For example:
[#line, #column]
is an array literal and
[#line : #column]
is a dictionary literal. Use additional lookahead in the parser to
disambiguate these cases from object literals. Fixes
rdar://problem/24533081.
7 lines
622 B
Swift
7 lines
622 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 ';'}} {{11-11=;}} 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 ';'}} {{15-15=;}} expected-error{{expected expression}}
|
|
let _ = [#what()#] // expected-error{{use of unknown object literal name 'what'}}
|
|
let _ = [#Color( // expected-error{{expected expression in container literal}}
|