mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
return statements, or a return statement with no operand. Also, fix a special-case diagnostic about converting a return expression to (1) only apply to converting the actual return expression, not an arbitrary sub-expression, and (2) use the actual operand and return types, not the drilled-down types that caused the failure. Swift SVN r30420
16 lines
827 B
Swift
16 lines
827 B
Swift
// RUN: %target-parse-verify-swift -parse-as-library
|
|
|
|
let x = 42
|
|
x + x; // expected-error {{expressions are not allowed at the top level}}
|
|
x + x; // expected-error {{expressions are not allowed at the top level}}
|
|
// Make sure we don't crash on closures at the top level
|
|
({ }) // expected-error {{expressions are not allowed at the top level}} expected-error{{expression resolves to an unused function}}
|
|
({ 5 }()) // expected-error {{expressions are not allowed at the top level}}
|
|
|
|
// FIXME: Too many errors for this.
|
|
for i // expected-error 2 {{expected ';' in 'for' statement}}
|
|
// expected-error @-1{{use of unresolved identifier 'i'}}
|
|
// expected-error @+3{{expected '{' in 'for' statement}}
|
|
// expected-error @+2{{expected condition in 'for' statement}}
|
|
// expected-error @+1{{expected expression}}
|