You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that we're parsing subscript expression inside a collection expression, so the parser doesn't throw an error for a missing comma. We can emit a warning diagnostic if we parse a subscript along with a fix-it to insert the comma.
I mean, the code is valid as written. It's just doing something silly. (For a simpler example, consider [[1, 2] [3]].) But maybe the compiler should warn on it and suggest parens if you really want to subscript a literal?
Environment
Apple Swift version 5.1 (swiftlang-1100.0.212.5 clang-1100.0.28.2)
Target: x86_64-apple-darwin19.0.0
Additional Detail from JIRA
md5: 800226d4c9df36713bd9fbf8b113f1ac
Issue Description:
This line of code is missing a comma before `[42]` and was a hard to spot typo. This results in a runtime crash rather than a compile time error.
Related discussion: https://forums.swift.org/t/is-this-a-bug-of-xcode-or-is-this-intended/26978
The text was updated successfully, but these errors were encountered: