error when chaining String split and contains
michaelowens opened this issue · comments
The following fails to build:
// error: no member named 'contains' in 'AK::Vector<AK::DeprecatedString, 0>'
// ((((Jakt::DeprecatedString("test string"sv)).split(' '))).contains(Jakt::DeprecatedString("string"sv)));
fn main() {
"test string".split(c' ').contains("string")
}
Storing it in a variable first works as expected:
fn main() {
let words = "test string".split(c' ')
words.contains("string")
}
Yeah that's a...bad problem...
Right now we're pretending that the signature of .split()
is:
fn split(this, anon c: c_char) throws -> [String]
but it's actually
fn split(this, anon c: c_char) throws -> AK::Vector<String>
the variable thing works because there's a DynamicArray<T>(Vector<T>)
constructor.