[swift-evolution] Proposal: x == 2 should not be a valid statement

Radosław Pietruszewski radexpl at gmail.com
Thu Feb 11 17:48:27 CST 2016


I agree an expression like `x==2`, not being passed on or assigned to anything, should generate a warning and a helpful fixit. No reason to make it an error.

Implicit return doesn’t change this AFAICT.

— Radek

> On 12 Feb 2016, at 00:41, Jonathan Tang via swift-evolution <swift-evolution at swift.org> wrote:
> 
> On Thu, Feb 11, 2016 at 3:32 PM, Amir Michail via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> It’s too easy to accidentally write “x==2” instead of “x=2”.
> 
> I don’t think something like “x==2” should be a valid statement.
> 
> I'd love to see this become a compiler warning.  Unsure about making it an error; how would it affect implicit return from lambdas? 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160212/e5f7271f/attachment.html>


More information about the swift-evolution mailing list