Files
swift-mirror/test/attr/ApplicationMain/attr_main_multiple.swift
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

20 lines
458 B
Swift

// RUN: %target-swift-frontend -typecheck -parse-as-library -verify %s
@main // expected-error{{'main' attribute can only apply to one type in a module}}
struct MyMain1 {
static func main() {
}
}
@main // expected-error{{'main' attribute can only apply to one type in a module}}
enum MyMain2 {
static func main() {
}
}
@main // expected-error{{'main' attribute can only apply to one type in a module}}
class MyMain3 {
static func main() {
}
}