Fixes merge conflict

This commit is contained in:
Joshua Hoeflich 2021-08-08 21:38:15 -05:00
commit c00d400d85
54 changed files with 946 additions and 631 deletions

View file

@ -14,8 +14,8 @@ use crate::llvm::build_list::{
};
use crate::llvm::build_str::{
empty_str, str_concat, str_count_graphemes, str_ends_with, str_from_float, str_from_int,
str_from_utf8, str_from_utf8_range, str_join_with, str_number_of_bytes, str_split, str_starts_with,
str_starts_with_code_point, str_to_bytes,
str_from_utf8, str_from_utf8_range, str_join_with, str_number_of_bytes, str_split,
str_starts_with, str_starts_with_code_point, str_to_utf8,
};
use crate::llvm::compare::{generic_eq, generic_neq};
use crate::llvm::convert::{
@ -4412,8 +4412,8 @@ fn run_low_level<'a, 'ctx, 'env>(
str_starts_with(env, scope, args[0], args[1])
}
StrStartsWithCodePoint => {
// Str.startsWithCodePoint : Str, U32 -> Bool
StrStartsWithCodePt => {
// Str.startsWithCodePt : Str, U32 -> Bool
debug_assert_eq!(args.len(), 2);
str_starts_with_code_point(env, scope, args[0], args[1])
@ -4445,7 +4445,6 @@ fn run_low_level<'a, 'ctx, 'env>(
str_from_utf8(env, parent, original_wrapper)
}
StrFromUtf8Range => {
// Str.fromUtf8 : List U8 -> Result Str Utf8Problem
debug_assert_eq!(args.len(), 2);
let list_wrapper = load_symbol(scope, &args[0]).into_struct_value();
@ -4453,7 +4452,7 @@ fn run_low_level<'a, 'ctx, 'env>(
str_from_utf8_range(env, parent, list_wrapper, count_and_start)
}
StrToBytes => {
StrToUtf8 => {
// Str.fromInt : Str -> List U8
debug_assert_eq!(args.len(), 1);
@ -4461,7 +4460,7 @@ fn run_low_level<'a, 'ctx, 'env>(
// we just implement it here to subvert the type system
let string = load_symbol(scope, &args[0]);
str_to_bytes(env, string.into_struct_value())
str_to_utf8(env, string.into_struct_value())
}
StrSplit => {
// Str.split : Str, Str -> List Str

View file

@ -175,7 +175,7 @@ pub fn str_starts_with<'a, 'ctx, 'env>(
)
}
/// Str.startsWithCodePoint : Str, U32 -> Bool
/// Str.startsWithCodePt : Str, U32 -> Bool
pub fn str_starts_with_code_point<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
scope: &Scope<'a, 'ctx>,
@ -188,7 +188,7 @@ pub fn str_starts_with_code_point<'a, 'ctx, 'env>(
call_bitcode_fn(
env,
&[str_i128.into(), prefix],
bitcode::STR_STARTS_WITH_CODE_POINT,
bitcode::STR_STARTS_WITH_CODE_PT,
)
}
@ -235,8 +235,8 @@ pub fn str_from_int<'a, 'ctx, 'env>(
call_bitcode_fn(env, &[int], bitcode::STR_FROM_INT)
}
/// Str.toBytes : Str -> List U8
pub fn str_to_bytes<'a, 'ctx, 'env>(
/// Str.toUtf8 : Str -> List U8
pub fn str_to_utf8<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
original_wrapper: StructValue<'ctx>,
) -> BasicValueEnum<'ctx> {
@ -244,10 +244,10 @@ pub fn str_to_bytes<'a, 'ctx, 'env>(
env.builder,
original_wrapper.into(),
env.context.i128_type().into(),
"to_bytes",
"to_utf8",
);
call_bitcode_fn_returns_list(env, &[string], bitcode::STR_TO_BYTES)
call_bitcode_fn_returns_list(env, &[string], bitcode::STR_TO_UTF8)
}
/// Str.fromUtf8 : List U8, { count : Nat, start : Nat } -> { a : Bool, b : Str, c : Nat, d : I8 }