Files
Nate Chandler df99de804d Added executable entry-point via @main type.
When a type (class, enum, or struct) is annotated @main, it is required
to provide a function with the following signature:

  static func main() -> ()

That function will be called when the executable the type is defined
within is launched.
2020-04-17 09:53:46 -07:00

13 lines
362 B
Swift

// This file is a part of the multi-file test driven by 'main.swift'.
// NB: No "-verify"--this file should parse successfully on its own.
// RUN: %target-swift-frontend -typecheck -parse-as-library %s
@main // expected-error{{'main' attribute cannot be used in a module that contains top-level code}}
class MyMain {
static func main() {
}
}
func hi() {}