Swift 2.1 Compiling This Object Literal Take Exponential Time

Originator:DaNmarner
Number:rdar://23538997 Date Originated:13-Nov-2015 12:38 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7.2 beta 3
Classification:Other Bug Reproducible:Always
 
Summary:
With Swift 2.1 (including the version shipped in Xcode 7.2 beta 3), the code at the end of this section will never finish compiling. Remove the amount of literals in the dictionary will not help until the count is down to single digit. Just by observation, the compilation time is growing exponentially.

let sampleInput = [
    "appts": [
        "00": ["date": "0"],
        "01": ["date": "1"],
        "02": ["date": "2"],
        "03": ["date": "0"],
        "04": ["date": "0"],
        "05": ["date": "1"],
        "06": ["date": "2"],
        "07": ["date": "0"],
        "08": ["date": "0"],
        "09": ["date": "1"],
        "10": ["date": "0"],
        "11": ["date": "1"],
        "12": ["date": "2"],
        "13": ["date": "0"],
        "14": ["date": "0"],
        "15": ["date": "1"],
        "16": ["date": "2"],
        "17": ["date": "0"],
        "18": ["date": "0"],
        "19": ["date": "1"],
        "20": ["date": "1"],
        "21": ["date": "1"],
        "22": ["date": "2"],
        "23": ["date": "0"],
        "24": ["date": "0"],
        "25": ["date": "1"],
        "26": ["date": "2"],
        "27": ["date": "0"],
        "28": ["date": "0"],
        "29": ["date": "1"],
        "30": ["date": "1"],
        "31": ["date": "1"],
        "32": ["date": "2"],
        "33": ["date": "0"],
        "34": ["date": "0"],
        "35": ["date": "1"],
        "36": ["date": "2"],
        "37": ["date": "0"],
        "38": ["date": "0"],
        "39": ["date": "1"],
    ]
]


Steps to Reproduce:
Try to compile the code. Remove some literals and try compile again.

Expected Results:
The code should compile in non-exponential time.

Actual Results:
As is, the code will never finish compiling.

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!