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-11534] Having a global variable in a wrong place causes a misleading error message #53935

Closed
swift-ci opened this issue Sep 26, 2019 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-11534
Radar rdar://problem/55802703
Original Reporter apaszke (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Apple Swift version 5.1 (swiftlang-1100.0.257.2 clang-1100.0.31.3)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 21439a134b301395653f7a7fb314ff6f

relates to:

  • SR-284 Strange error caused by let/var at specific place in main file.

Issue Description:

The following:

func f() { g() }

var x = 1
func g() { x = 2 }

fails to compile because

error.swift:1:12: error: use of unresolved identifier 'g'
func f() { g() }
           ^

which is unhelpful at best...

@typesanitizer
Copy link

@swift-ci create

@CodaFi
Copy link
Member

CodaFi commented Jan 5, 2021

This successfully compiles in Swift 5.3.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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

3 participants