mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
var decls. I was originally intending to use this for argument lists, but I don't think that's a great direction to go anymore. In any case, it seems uncontroversial to enforce immutability on foreach enumation patterns, so I did that (see testcase) Swift SVN r11124
8 lines
162 B
Swift
8 lines
162 B
Swift
// RUN: %swift %s -verify
|
|
|
|
func foreach_variable() {
|
|
for i in 0..42 {
|
|
i = 11 // expected-error {{cannot assign to read-only variable or subscript}}
|
|
}
|
|
}
|