Files
swift-mirror/validation-test/compiler_crashers_fixed/0040-std-function-func-swift-constraints-solution-computesubstitutions.swift
Chris Lattner ddd6192094 Implement 3 prominent feature requests:
<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
2015-05-11 06:26:05 +00:00

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