Added bytes type and some inference (#13061)

## Summary

This PR adds the `bytes` type to red-knot:
- Added the `bytes` type
- Added support for bytes literals
- Support for the `+` operator

Improves on #12701 

Big TODO on supporting and normalizing r-prefixed bytestrings
(`rb"hello\n"`)

## Test Plan

Added a test for a bytes literals, concatenation, and corner values
This commit is contained in:
Teodoro Freund 2024-08-22 21:27:15 +01:00 committed by GitHub
parent 2edd32aa31
commit b9c8113a8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 73 additions and 6 deletions

View file

@ -2152,7 +2152,7 @@ impl BytesLiteralValue {
}
/// Returns an iterator over the bytes of the concatenated bytes.
fn bytes(&self) -> impl Iterator<Item = u8> + '_ {
pub fn bytes(&self) -> impl Iterator<Item = u8> + '_ {
self.iter().flat_map(|part| part.as_slice().iter().copied())
}
}