Compiler switch?


(Don Wills) #1

Hello Swift-Users,

I am building an automated translator to translate from another programming language to Swift. It's mostly working, but there is one issue that would be hard for the translator to deal with - the issue of 'var' vs. 'let' declarations.

Right now the translator always creates local variables with the 'var' keyword. The result is lots of warnings from the compiler suggesting the change of 'var' to 'let' when the compiler ascertains that the variable cannot be modified.

My question is this: Can the Swift compiler be modified to allow for turning off warnings in general or the 'var' vs. 'let' warning in particular?

If this email list is not the correct place to ask such a question, please suggest where I might ask the question. Thanks.

Don Wills


(Jack Lawrence) #2

Hi Don,

It’s not currently possible to disable any warnings emitted by the Swift compiler. Alternatively, you could run a fix-it pass over all of the code after translation, which automatically accepts all suggested fix-its:

swiftc -fixit-all input_file.swift

Jack

···

On Jan 5, 2016, at 7:02 PM, Don Wills via swift-users <swift-users@swift.org> wrote:

Hello Swift-Users,

I am building an automated translator to translate from another programming language to Swift. It's mostly working, but there is one issue that would be hard for the translator to deal with - the issue of 'var' vs. 'let' declarations.

Right now the translator always creates local variables with the 'var' keyword. The result is lots of warnings from the compiler suggesting the change of 'var' to 'let' when the compiler ascertains that the variable cannot be modified.

My question is this: Can the Swift compiler be modified to allow for turning off warnings in general or the 'var' vs. 'let' warning in particular?

If this email list is not the correct place to ask such a question, please suggest where I might ask the question. Thanks.

Don Wills

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users