Static variables named Type causes odd error message in Array/Dictionary

Originator:kevinrandrup
Number:rdar://22674032 Date Originated:9/12/2015
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7 GM
Classification:Other bug Reproducible:ALways
 
Summary:
When a static variable named "Type" is used is in an array or dictionary the compiler gives a warning "Type of expression is ambiguous without more context"

Steps to Reproduce:
Paste the following code into a playground

struct MyKeys {
    static let Type = "type" //No error
    static let Key = "key"
}

let keys = [MyKeys.Key, MyKeys.Type] //"Type of expression is ambiguous without more context"
let dictionary = [MyKeys.Key : "val", MyKeys.Type:"val"] //"Type of expression is ambiguous without more context"

Expected Results:
The compiler should produce a warning/error such "Type" is a reserved keyword" on the line
    static let Type = "type"



Actual Results:
No warning/error is emitted by the compiler at the site of the definition. A warning is only presented when the incorrect value is used.

Version:
Xcode 7 GM
OS X Yosemite

Notes:
The workaround/solution is to name the static variable something other than Type.

Configuration:
Error always occurs.

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!