structT<A> {
funcrun<C>(_c: C) whereC: Collection, C.SubSequence == A {
print(c[...] as! A)
}
}
This should restrict the collection passed into `run` to be such that its subsequence matches the generic A.
For example, these following compile just fine:
// These should compile ✅T<Substring>().run("")
T<Data>().run(Data())
However, there seem to be some situations where we can pass in a collection that does not match this constraint and yet it still compiles, and hence crashes at runtime:
// These should not but do⁉️T<Substring>().run(Data())
T<Data>().run("")
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: 2c03afa2034e8d179cd73102ecf6a551
Issue Description:
Consider the following method:
This should restrict the collection passed into `run` to be such that its subsequence matches the generic A.
For example, these following compile just fine:
However, there seem to be some situations where we can pass in a collection that does not match this constraint and yet it still compiles, and hence crashes at runtime:
The text was updated successfully, but these errors were encountered: