Files
swift-mirror/test/Sema/immutability.swift
Chris Lattner b1a2059604 Implement the ability to create a Pattern as a set of 'let' decls instead of
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
2013-12-11 07:28:13 +00:00

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}}
}
}