forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtoplevel_library_invalid.swift
18 lines (15 loc) · 1.09 KB
/
toplevel_library_invalid.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// RUN: %target-typecheck-verify-swift -parse-as-library
// RUN: %target-typecheck-verify-swift -parse-as-library -enable-astscope-lookup
let x = 42 // expected-note{{did you mean 'x'?}}
x + x; // expected-error {{expressions are not allowed at the top level}} expected-warning {{result of operator '+' is unused}}
x + x; // expected-error {{expressions are not allowed at the top level}} expected-warning {{result of operator '+' is unused}}
// 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}}
// expected-warning @-1 {{result of call is unused}}
// 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}}