Finish first pass of Str.fromUtf8

This commit is contained in:
Jared Ramirez 2021-02-07 16:18:34 -08:00
parent 815f633a58
commit f3d9c2f2bb
12 changed files with 591 additions and 159 deletions

View file

@ -717,15 +717,18 @@ pub fn str_utf8_byte_problem_type() -> SolvedType {
#[inline(always)]
pub fn str_utf8_byte_problem_alias_content() -> SolvedType {
// [ InvalidStartByte, UnexpectedEndOfSequence, ExpectedContinuation, OverlongEncoding, CodepointTooLarge, EncodesSurrogateHalf ]
// 1. This must have the same values as the Zig struct Utf8ByteProblem in src/str.zig
// 2. This must be in alphabetical order
//
// [ CodepointTooLarge, EncodesSurrogateHalf, OverlongEncoding, InvalidStartByte, UnexpectedEndOfSequence, ExpectedContinuation ]
SolvedType::TagUnion(
vec![
(TagName::Global("InvalidStartByte".into()), vec![]),
(TagName::Global("UnexpectedEndOfSequence".into()), vec![]),
(TagName::Global("ExpectedContinuation".into()), vec![]),
(TagName::Global("OverlongEncoding".into()), vec![]),
(TagName::Global("CodepointTooLarge".into()), vec![]),
(TagName::Global("EncodesSurrogateHalf".into()), vec![]),
(TagName::Global("ExpectedContinuation".into()), vec![]),
(TagName::Global("InvalidStartByte".into()), vec![]),
(TagName::Global("OverlongEncoding".into()), vec![]),
(TagName::Global("UnexpectedEndOfSequence".into()), vec![]),
],
Box::new(SolvedType::EmptyTagUnion),
)