[SR-11702] Misleading Error Message "Subscript 'subscript(_: )' requires the types 'String.Index' and 'Int' be equivalent" #54110
Labels
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
improvement
Additional Detail from JIRA
md5: 265d39699983fb138f48fa2a0e4a8417
relates to:
Issue Description:
Paste the following into a playground:
import Foundation
{{ }}
var string = "something;"
{{ }}if let index = string.firstIndex(of: ";")
{{ string = string[..<index]}}{{ }}
{{}}}
You get a misleading error message:
Really the reason for the error is that you cannot assign a Substring to a String and the error message should say that.
The text was updated successfully, but these errors were encountered: