mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
<rdar://problem/15975935> warning that you can use 'let' not 'var' <rdar://problem/18876585> Compiler should warn me if I set a parameter as 'var' but never modify it <rdar://problem/17224539> QoI: warn about unused variables This uses a simple pass in MiscDiagnostics that walks the body of an AbstractFunctionDecl. This means that it doesn't warn about unused properties (etc), but it captures a vast majority of the cases. It also does not warn about unused parameters (as a policy decision) because it is too noisy, there are a variety of other refinements that could be done as well, thoughts welcome. Swift SVN r28412
11 lines
369 B
Swift
11 lines
369 B
Swift
// RUN: %target-swift-frontend %s -parse -verify
|
|
|
|
// Distributed under the terms of the MIT license
|
|
// Test case submitted to project by https://github.com/tmu (Teemu Kurppa)
|
|
// rdar://18175202
|
|
|
|
func d<b: SequenceType, e where Optional<e> == b.Generator.Element>(c : b) -> e? {
|
|
for mx : e? in c { // expected-warning {{immutable value 'mx' was never used}}
|
|
}
|
|
}
|