You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dear Swift Team!
I have a very simple project. It is Command Line Tool written on Swift 3.0 using Xcode 8.0. This program is:
importFoundationfuncaaa() {
print(a)
}
leta = "a"aaa()
This is working perfectly well and printing "a" in console, but lets do this program more complex:
importFoundationfuncaaa() {
print(a)
print(b)
}
leta = "a"letb = "b"aaa()
And line print(b)
is marked with error: Use of unresolved identifier 'b'
We can make even easier:
importFoundationfuncaaa() {
print(a)
}
aaa()
leta = "a"
And again, line print(a)
is marked with error: Use of unresolved identifier 'a'
I am not newbie and I undertand that I can easily fix this error like putting all variables in the beginning of the program. Question is: why is it happening? I thought each file with extension .swift, it is a class and I can put variable and functions, call functions in any order (all variables and constants would be global)... And one last thing, I don't have ability to test this on Swift 2.2, but I don't remember I faced this bug before, so can it be a error of Swift 3.0 compiler? Thank you for any answer!
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: 051659726cbef6b8c0f2029b8342062b
duplicates:
is duplicated by:
Issue Description:
Dear Swift Team!
I have a very simple project. It is Command Line Tool written on Swift 3.0 using Xcode 8.0. This program is:
This is working perfectly well and printing "a" in console, but lets do this program more complex:
And line
print(b)
is marked with error:
Use of unresolved identifier 'b'
We can make even easier:
And again, line
print(a)
is marked with error:
Use of unresolved identifier 'a'
I am not newbie and I undertand that I can easily fix this error like putting all variables in the beginning of the program. Question is: why is it happening? I thought each file with extension .swift, it is a class and I can put variable and functions, call functions in any order (all variables and constants would be global)... And one last thing, I don't have ability to test this on Swift 2.2, but I don't remember I faced this bug before, so can it be a error of Swift 3.0 compiler? Thank you for any answer!
The text was updated successfully, but these errors were encountered: