I notice the exception is on:
NativeSet.insertNew(_:at:isUnique:) + 376 (/:0)
Looking at this thread: https://forums.swift.org/t/substring-violates-hashables-requirements-stdlib-compiler-bug/58046/7
I wonder if the compiler is not confused and considering you try to insert a substring.
To make sure, could you try:
let sub = self[index...] // a substring
let theStr = String(sub)
return if index == endIndex || basePath == "/" {
theStr // String(self[index...]) // for sure, a String
} else if let index = self[index...].range(of: "/", options: .anchored)?.upperBound {
theStr // String(self[index...])
} else {
nil
}
If that works, you should file a bug report.
Topic:
Programming Languages
SubTopic:
Swift
Tags: