Files
swift-mirror/test/Parse/fixed_infinite_loops.swift
Rintaro Ishizaki b119407966 [Parse] Change whitespace rule between attribute name and '(' in Swift 6
In Swift 6 and later, whitespace is no longer permitted between an
attribute name and the opening parenthesis. Update the parser so that
in Swift 6+, a `(` without preceding whitespace is always treated as
the start of the argument list, while a '(' with preceding whitespace is
considered the start of the argument list _only when_ it is unambiguous.

This change makes the following closure be parsed correctly:

  { @MainActor (arg: Int) in ... }

rdar://147785544
2025-09-09 16:44:29 -07:00

11 lines
254 B
Swift

// RUN: %target-swift-frontend -parse -verify %s
func test1() {
@s
return // expected-error {{expected declaration}}
}
func test2() {
@unknown // expected-error {{unknown attribute 'unknown'}}
return // expected-error {{expected declaration}}
}