Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-14530] Using @main prevents usage of global variables with a single file #56882

Open
typesanitizer opened this issue Apr 26, 2021 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@typesanitizer
Copy link

Previous ID SR-14530
Radar rdar://problem/77165976
Original Reporter @typesanitizer
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 4e8597dcdc805d0461226c475c071f62

Issue Description:

nix.swift:48:1: error: 'main' attribute cannot be used in a module that contains top-level code
@main
^
nix.swift:1:1: note: top-level code defined in this source file
var gg = 0
^ 

This limitation can be worked around by using -parse-as-library but that shouldn't be required.

@typesanitizer
Copy link
Author

@swift-ci create

@typesanitizer
Copy link
Author

This error even triggers with comments??

nix.swift:60:1: error: 'main' attribute cannot be used in a module that contains top-level code
@main
^
nix.swift:1:1: note: top-level code defined in this source file
/*
^ 

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

1 participant