mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
Merge branch 'trunk' into list-map-ownership
This commit is contained in:
commit
201d09d9bf
71 changed files with 2250 additions and 2560 deletions
|
@ -3270,3 +3270,51 @@ fn dec_float_suffix() {
|
|||
i128
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn ceiling_to_u32() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
n : U32
|
||||
n = Num.ceiling 124.5
|
||||
n
|
||||
"#
|
||||
),
|
||||
125,
|
||||
u32
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn floor_to_u32() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
n : U32
|
||||
n = Num.floor 124.5
|
||||
n
|
||||
"#
|
||||
),
|
||||
124,
|
||||
u32
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn round_to_u32() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
n : U32
|
||||
n = Num.round 124.49
|
||||
n
|
||||
"#
|
||||
),
|
||||
124,
|
||||
u32
|
||||
);
|
||||
}
|
||||
|
|
|
@ -3267,7 +3267,6 @@ fn polymophic_expression_captured_inside_closure() {
|
|||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
#[ignore = "Compile polymorphic functions"]
|
||||
fn issue_2322() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
|
@ -3421,7 +3420,6 @@ fn polymorphic_def_used_in_closure() {
|
|||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
#[ignore = "This still doesn't work... yet"]
|
||||
fn polymorphic_lambda_set_usage() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
|
@ -3429,6 +3427,7 @@ fn polymorphic_lambda_set_usage() {
|
|||
id1 = \x -> x
|
||||
id2 = \y -> y
|
||||
id = if True then id1 else id2
|
||||
|
||||
id 9u8
|
||||
"#
|
||||
),
|
||||
|
@ -3437,6 +3436,24 @@ fn polymorphic_lambda_set_usage() {
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
fn polymorphic_lambda_set_multiple_specializations() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
id1 = \x -> x
|
||||
id2 = \y -> y
|
||||
id = if True then id1 else id2
|
||||
|
||||
(id 9u8) + Num.toU8 (id 16u16)
|
||||
"#
|
||||
),
|
||||
25,
|
||||
u8
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
fn list_map2_conslist() {
|
||||
|
@ -3456,4 +3473,4 @@ fn list_map2_conslist() {
|
|||
RocStr::default(),
|
||||
RocStr
|
||||
)
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ use libloading::Library;
|
|||
use roc_build::link::{link, LinkType};
|
||||
use roc_builtins::bitcode;
|
||||
use roc_collections::all::MutMap;
|
||||
use roc_load::Threading;
|
||||
use roc_region::all::LineInfo;
|
||||
use tempfile::tempdir;
|
||||
|
||||
|
@ -55,6 +56,7 @@ pub fn helper(
|
|||
Default::default(),
|
||||
roc_target::TargetInfo::default_x86_64(),
|
||||
roc_reporting::report::RenderTarget::ColorTerminal,
|
||||
Threading::Single,
|
||||
);
|
||||
|
||||
let mut loaded = loaded.expect("failed to load module");
|
||||
|
|
|
@ -5,6 +5,7 @@ use roc_build::link::module_to_dylib;
|
|||
use roc_build::program::FunctionIterator;
|
||||
use roc_collections::all::MutSet;
|
||||
use roc_gen_llvm::llvm::externs::add_default_roc_externs;
|
||||
use roc_load::Threading;
|
||||
use roc_mono::ir::OptLevel;
|
||||
use roc_region::all::LineInfo;
|
||||
use roc_reporting::report::RenderTarget;
|
||||
|
@ -59,6 +60,7 @@ fn create_llvm_module<'a>(
|
|||
Default::default(),
|
||||
target_info,
|
||||
RenderTarget::ColorTerminal,
|
||||
Threading::Multi,
|
||||
);
|
||||
|
||||
let mut loaded = match loaded {
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
use super::RefCount;
|
||||
use crate::helpers::from_wasmer_memory::FromWasmerMemory;
|
||||
use roc_collections::all::MutSet;
|
||||
use roc_gen_wasm::wasm32_result::Wasm32Result;
|
||||
use roc_gen_wasm::wasm_module::{Export, ExportType};
|
||||
use roc_gen_wasm::{DEBUG_LOG_SETTINGS, MEMORY_NAME};
|
||||
use roc_load::Threading;
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::marker::PhantomData;
|
||||
use std::path::{Path, PathBuf};
|
||||
use wasmer::{Memory, WasmPtr};
|
||||
|
||||
use super::RefCount;
|
||||
use crate::helpers::from_wasmer_memory::FromWasmerMemory;
|
||||
use roc_collections::all::MutSet;
|
||||
use roc_gen_wasm::wasm32_result::Wasm32Result;
|
||||
use roc_gen_wasm::{DEBUG_LOG_SETTINGS, MEMORY_NAME};
|
||||
|
||||
// Should manually match build.rs
|
||||
const PLATFORM_FILENAME: &str = "wasm_test_platform";
|
||||
const OUT_DIR_VAR: &str = "TEST_GEN_OUT";
|
||||
|
@ -91,6 +91,7 @@ fn compile_roc_to_wasm_bytes<'a, T: Wasm32Result>(
|
|||
Default::default(),
|
||||
roc_target::TargetInfo::default_wasm32(),
|
||||
roc_reporting::report::RenderTarget::ColorTerminal,
|
||||
Threading::Single,
|
||||
);
|
||||
|
||||
let loaded = loaded.expect("failed to load module");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue