Emit compiler warnings to enforce capitalization guidance for Swift types.

Originator:GriotSpeak
Number:rdar://17735933 Date Originated:2014-07-19
Status:Open Resolved:
Product: Product Version:
Classification: Reproducible:
 
Summary:
There are at least three places within "The Swift Programming Language" where guidance is provided for how to capitalize when naming Types. I propose capturing this guidance in warnings given by the compiler when these suggestions are ignored

“Each enumeration definition defines a brand new type. Like other types in Swift, their names (such as CompassPoint and Planet) should start with a capital letter. Give enumeration types singular rather than plural names, so that they read as self-evident:”
 
Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l
 
“NOTE
Whenever you define a new class or structure, you effectively define a brand new Swift type. Give types UpperCamelCase names (such as SomeClass and SomeStructure here) to match the capitalization of standard Swift types (such as String, Int, and Bool). Conversely, always give properties and methods lowerCamelCase names (such as frameRate and incrementCount) to differentiate them from type names.”
 
Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l
 
“NOTE
Because protocols are types, begin their names with a capital letter (such as FullyNamed and RandomNumberGenerator) to match the names of other types in Swift (such as Int, String, and Double).”
 
Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l

Steps to Reproduce:
enum test {
    case Foo, bar
}

Expected Results:
Warnings for 'test' at least and possibly–though explicit guidance is not provided, all individual enumeration values in the book begin with an uppercase letter–for 'bar' as well.

Actual Results:
No warning is emitted.

Version:


Notes:


Configuration:


Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!