Merge branch 'main' into int_overflow

This commit is contained in:
Asher Frost 2024-12-01 15:32:39 -05:00 committed by GitHub
commit 7055253564
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
82 changed files with 1326 additions and 1036 deletions

View file

@ -55,6 +55,10 @@ repository = "https://github.com/roc-lang/roc"
version = "0.0.1"
[workspace.dependencies]
object = { version = "0.32.2", default-features = false, features = [
"read",
"write",
] }
# NOTE: roc-lang/inkwell is a fork of TheDan64/inkwell which does not change anything.
#
# The reason for this fork is that the way Inkwell is designed, you have to use
@ -76,9 +80,7 @@ version = "0.0.1"
inkwell = { git = "https://github.com/roc-lang/inkwell", branch = "inkwell-llvm-16", features = [
"llvm16-0",
] }
soa = { path = "crates/soa" }
roc_specialize_types = { path = "crates/compiler/specialize_types" }
arrayvec = "0.7.2" # update roc_std/Cargo.toml on change
arrayvec = "0.7.2"
base64-url = "1.4.13"
bincode = "1.3.3"
bitflags = "1.3.2"
@ -133,10 +135,7 @@ mach_object = "0.1"
maplit = "1.0.2"
memmap2 = "0.5.10"
mimalloc = { version = "0.1.34", default-features = false }
object = { version = "0.32.2", default-features = false, features = [
"read",
"write",
] }
morphic_lib = { path = "crates/vendor/morphic_lib" }
packed_struct = "0.10.1"
parking_lot = "0.12"
perfcnt = "0.8.0"
@ -179,10 +178,74 @@ tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
walkdir = "2.3.2"
wasm-bindgen = "0.2.84"
wasm-bindgen-futures = "0.4.34"
widestring = { version = "1.1.0", default-features = false }
wyhash = "0.5.0"
# Testing
# INTERNAL DEPENDENCIES
cli_test_utils = { path = "crates/cli_test_utils" }
roc_alias_analysis = { path = "crates/compiler/alias_analysis" }
roc_bitcode = { path = "crates/compiler/builtins/bitcode" }
roc_bitcode_bc = { path = "crates/compiler/builtins/bitcode/bc" }
roc_build = { path = "crates/compiler/build" }
roc_builtins = { path = "crates/compiler/builtins" }
roc_can = { path = "crates/compiler/can" }
roc_checkmate = { path = "crates/compiler/checkmate" }
roc_checkmate_schema = { path = "crates/compiler/checkmate_schema" }
roc_cli = { path = "crates/cli" }
roc_collections = { path = "crates/compiler/collections" }
roc_command_utils = { path = "crates/utils/command" }
roc_constrain = { path = "crates/compiler/constrain" }
roc_debug_flags = { path = "crates/compiler/debug_flags" }
roc_derive = { path = "crates/compiler/derive" }
roc_derive_key = { path = "crates/compiler/derive_key" }
roc_docs = { path = "crates/docs" }
roc_error_macros = { path = "crates/error_macros" }
roc_exhaustive = { path = "crates/compiler/exhaustive" }
roc_fmt = { path = "crates/compiler/fmt" }
roc_gen_llvm = { path = "crates/compiler/gen_llvm" }
roc_gen_dev = { path = "crates/compiler/gen_dev" }
roc_gen_wasm = { path = "crates/compiler/gen_wasm" }
roc_glue = { path = "crates/glue" }
roc_highlight = { path = "crates/highlight" }
roc_ident = { path = "crates/compiler/ident" }
roc_late_solve = { path = "crates/compiler/late_solve" }
roc_linker = { path = "crates/linker" }
roc_load = { path = "crates/compiler/load" }
roc_load_internal = { path = "crates/compiler/load_internal" }
roc_lower_params = { path = "crates/compiler/lower_params" }
roc_module = { path = "crates/compiler/module" }
roc_mono = { path = "crates/compiler/mono" }
roc_packaging = { path = "crates/packaging" }
roc_parse = { path = "crates/compiler/parse" }
roc_problem = { path = "crates/compiler/problem" }
roc_region = { path = "crates/compiler/region" }
roc_repl_cli = { path = "crates/repl_cli" }
roc_repl_eval = { path = "crates/repl_eval" }
roc_repl_expect = { path = "crates/repl_expect" }
roc_repl_ui = { path = "crates/repl_ui" }
roc_reporting = { path = "crates/reporting" }
roc_serialize = { path = "crates/compiler/serialize" }
roc_solve = { path = "crates/compiler/solve" }
roc_solve_schema = { path = "crates/compiler/solve_schema" }
roc_solve_problem = { path = "crates/compiler/solve_problem" }
roc_specialize_types = { path = "crates/compiler/specialize_types" }
roc_std = { path = "crates/roc_std" }
roc_target = { path = "crates/compiler/roc_target" }
roc_test_utils = { path = "crates/test_utils" }
roc_test_utils_dir = { path = "crates/test_utils_dir" }
roc_tracing = { path = "crates/tracing" }
roc_types = { path = "crates/compiler/types" }
roc_unify = { path = "crates/compiler/unify" }
roc_wasm_interp = { path = "crates/wasm_interp" }
roc_wasm_module = { path = "crates/wasm_module" }
roc_work = { path = "crates/compiler/work" }
roc_worker = { path = "crates/compiler/worker" }
soa = { path = "crates/soa" }
test_compile = { path = "crates/test_compile" }
test_mono_macros = { path = "crates/compiler/test_mono_macros" }
test_solve_helpers = { path = "crates/compiler/test_solve_helpers" }
ven_pretty = { path = "crates/vendor/pretty" }
wasi_libc_sys = { path = "crates/wasi-libc-sys" }
# Optimizations based on https://deterministic.space/high-performance-rust.html
[profile.release]

View file

@ -43,30 +43,30 @@ sanitizers = ["roc_build/sanitizers"]
[dependencies]
roc_build = { path = "../compiler/build" }
roc_builtins = { path = "../compiler/builtins" }
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_docs = { path = "../docs" }
roc_error_macros = { path = "../error_macros" }
roc_fmt = { path = "../compiler/fmt" }
roc_gen_llvm = { path = "../compiler/gen_llvm" }
roc_gen_dev = { path = "../compiler/gen_dev" }
roc_glue = { path = "../glue" }
roc_linker = { path = "../linker" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_mono = { path = "../compiler/mono" }
roc_packaging = { path = "../packaging" }
roc_parse = { path = "../compiler/parse" }
roc_region = { path = "../compiler/region" }
roc_repl_cli = { path = "../repl_cli", optional = true }
roc_reporting = { path = "../reporting" }
roc_target = { path = "../compiler/roc_target" }
roc_tracing = { path = "../tracing" }
roc_wasm_interp = { path = "../wasm_interp", optional = true }
roc_build.workspace = true
roc_builtins.workspace = true
roc_can.workspace = true
roc_collections.workspace = true
roc_docs.workspace = true
roc_error_macros.workspace = true
roc_fmt.workspace = true
roc_gen_llvm.workspace = true
roc_gen_dev.workspace = true
roc_glue.workspace = true
roc_linker.workspace = true
roc_load.workspace = true
roc_module.workspace = true
roc_mono.workspace = true
roc_packaging.workspace = true
roc_parse.workspace = true
roc_region.workspace = true
roc_reporting.workspace = true
roc_target.workspace = true
roc_tracing.workspace = true
roc_repl_cli = { workspace = true, optional = true }
roc_wasm_interp = { workspace = true, optional = true }
ven_pretty = { path = "../vendor/pretty" }
ven_pretty.workspace = true
bumpalo.workspace = true
clap.workspace = true
@ -86,12 +86,12 @@ tempfile.workspace = true
# for now, uses unix/libc functions that windows does not support
[target.'cfg(not(windows))'.dependencies]
roc_repl_expect = { path = "../repl_expect" }
roc_repl_expect.workspace = true
[dev-dependencies]
cli_test_utils = { path = "../cli_test_utils" }
roc_command_utils = { path = "../utils/command" }
cli_test_utils.workspace = true
roc_command_utils.workspace = true
criterion.workspace = true
indoc.workspace = true

View file

@ -1434,6 +1434,20 @@ mod cli_tests {
.run()
.assert_clean_success();
}
#[test]
fn module_params_effectful_param() {
let cli_check = ExecCli::new(
CMD_CHECK,
file_from_root(
"crates/cli/tests/test-projects/module_params",
"effect_module.roc",
),
);
let cli_check_out = cli_check.run();
cli_check_out.assert_clean_success();
}
}
#[cfg(feature = "wasm32-cli-run")]

View file

@ -0,0 +1,3 @@
module { stdout! } -> [log!]
log! = \msg, level -> stdout! "$(level):$(msg)"

View file

@ -9,12 +9,12 @@ repository.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../compiler/collections" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_reporting = { path = "../reporting" }
roc_command_utils = { path = "../utils/command" }
roc_cli = { path = "../cli" }
roc_collections.workspace = true
roc_load.workspace = true
roc_module.workspace = true
roc_reporting.workspace = true
roc_command_utils.workspace = true
roc_cli.workspace = true
bumpalo.workspace = true
criterion.workspace = true

View file

@ -7,11 +7,10 @@ license.workspace = true
version.workspace = true
[dependencies]
morphic_lib = { path = "../../vendor/morphic_lib" }
roc_collections = { path = "../collections" }
roc_debug_flags = { path = "../debug_flags" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
morphic_lib.workspace = true
roc_collections.workspace = true
roc_debug_flags.workspace = true
roc_error_macros.workspace = true
roc_module.workspace = true
roc_mono.workspace = true
bumpalo.workspace = true

View file

@ -8,32 +8,31 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_bitcode = { path = "../builtins/bitcode" }
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_constrain = { path = "../constrain" }
roc_debug_flags = { path = "../debug_flags" }
roc_error_macros = { path = "../../error_macros" }
roc_gen_dev = { path = "../gen_dev", default-features = false }
roc_gen_llvm = { path = "../gen_llvm" }
roc_gen_wasm = { path = "../gen_wasm" }
roc_linker = { path = "../../linker" }
roc_load = { path = "../load" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
roc_packaging = { path = "../../packaging" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_reporting = { path = "../../reporting" }
roc_solve_problem = { path = "../solve_problem" }
roc_std = { path = "../../roc_std" }
roc_target = { path = "../roc_target" }
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
roc_command_utils = { path = "../../utils/command" }
wasi_libc_sys = { path = "../../wasi-libc-sys" }
roc_bitcode.workspace = true
roc_can.workspace = true
roc_collections.workspace = true
roc_constrain.workspace = true
roc_debug_flags.workspace = true
roc_error_macros.workspace = true
roc_gen_dev.workspace = true
roc_gen_llvm.workspace = true
roc_gen_wasm.workspace = true
roc_linker.workspace = true
roc_load.workspace = true
roc_module.workspace = true
roc_mono.workspace = true
roc_packaging.workspace = true
roc_parse.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_reporting.workspace = true
roc_solve_problem.workspace = true
roc_std.workspace = true
roc_target.workspace = true
roc_types.workspace = true
roc_unify.workspace = true
roc_command_utils.workspace = true
wasi_libc_sys.workspace = true
bumpalo.workspace = true
indoc.workspace = true

View file

@ -8,8 +8,8 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_module = { path = "../module" }
roc_region = { path = "../region" }
roc_target = { path = "../roc_target" }
roc_error_macros = { path = "../../error_macros" }
roc_collections.workspace = true
roc_module.workspace = true
roc_region.workspace = true
roc_target.workspace = true
roc_error_macros.workspace = true

View file

@ -11,8 +11,8 @@ version.workspace = true
tempfile.workspace = true
[build-dependencies]
roc_command_utils = { path = "../../../utils/command" }
roc_error_macros = { path = "../../../error_macros" }
roc_command_utils.workspace = true
roc_error_macros.workspace = true
# dunce can be removed once ziglang/zig#5109 is fixed
dunce = "1.0.3"

View file

@ -8,8 +8,8 @@ license.workspace = true
version.workspace = true
[build-dependencies]
roc_command_utils = { path = "../../../../utils/command" }
roc_error_macros = { path = "../../../../error_macros" }
roc_command_utils.workspace = true
roc_error_macros.workspace = true
# dunce can be removed once ziglang/zig#5109 is fixed
dunce = "1.0.3"

View file

@ -110,7 +110,21 @@ pub fn exportNumToFloatCast(comptime T: type, comptime F: type, comptime name: [
pub fn exportPow(comptime T: type, comptime name: []const u8) void {
comptime var f = struct {
fn func(base: T, exp: T) callconv(.C) T {
return std.math.pow(T, base, exp);
switch (@typeInfo(T)) {
// std.math.pow can handle ints via powi, but it turns any errors to unreachable
// we want to catch overflow and report a proper error to the user
.Int => {
if (std.math.powi(T, base, exp)) |value| {
return value;
} else |err| switch (err) {
error.Overflow => roc_panic("Integer raised to power overflowed!", 0),
error.Underflow => return 0,
}
},
else => {
return std.math.pow(T, base, exp);
},
}
}
}.func;
@export(f, .{ .name = name ++ @typeName(T), .linkage = .Strong });

View file

@ -8,22 +8,19 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_exhaustive = { path = "../exhaustive" }
roc_module = { path = "../module" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_serialize = { path = "../serialize" }
roc_types = { path = "../types" }
ven_pretty = { path = "../../vendor/pretty" }
roc_collections.workspace = true
roc_error_macros.workspace = true
roc_exhaustive.workspace = true
roc_module.workspace = true
roc_parse.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_serialize.workspace = true
roc_types.workspace = true
ven_pretty.workspace = true
bitvec.workspace = true
bumpalo.workspace = true
static_assertions.workspace = true
soa.workspace = true
[dev-dependencies]

View file

@ -8,12 +8,12 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_checkmate_schema = { path = "../checkmate_schema" }
roc_module = { path = "../module" }
roc_solve_schema = { path = "../solve_schema" }
roc_types = { path = "../types" }
roc_checkmate_schema.workspace = true
roc_module.workspace = true
roc_solve_schema.workspace = true
roc_types.workspace = true
chrono.workspace = true
[build-dependencies]
roc_checkmate_schema = { path = "../checkmate_schema" }
roc_checkmate_schema.workspace = true
serde_json.workspace = true

View file

@ -8,15 +8,13 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_types = { path = "../types" }
roc_can.workspace = true
roc_collections.workspace = true
roc_error_macros.workspace = true
roc_module.workspace = true
roc_parse.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_types.workspace = true
arrayvec.workspace = true
soa.workspace = true

View file

@ -8,17 +8,16 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_checkmate = { path = "../checkmate" }
roc_collections = { path = "../collections" }
roc_derive_key = { path = "../derive_key" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_region = { path = "../region" }
roc_solve_schema = { path = "../solve_schema" }
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
roc_can.workspace = true
roc_checkmate.workspace = true
roc_collections.workspace = true
roc_derive_key.workspace = true
roc_error_macros.workspace = true
roc_module.workspace = true
roc_region.workspace = true
roc_solve_schema.workspace = true
roc_types.workspace = true
roc_unify.workspace = true
bumpalo.workspace = true
[features]

View file

@ -7,8 +7,8 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_region = { path = "../region" }
roc_types = { path = "../types" }
roc_collections.workspace = true
roc_error_macros.workspace = true
roc_module.workspace = true
roc_region.workspace = true
roc_types.workspace = true

View file

@ -8,8 +8,8 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_collections.workspace = true
roc_error_macros.workspace = true
roc_module.workspace = true
roc_problem.workspace = true
roc_region.workspace = true

View file

@ -8,10 +8,10 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_module = { path = "../module" }
roc_parse = { path = "../parse" }
roc_region = { path = "../region" }
roc_error_macros = { path = "../../error_macros" }
roc_collections.workspace = true
roc_module.workspace = true
roc_parse.workspace = true
roc_region.workspace = true
roc_error_macros.workspace = true
bumpalo.workspace = true

View file

@ -8,28 +8,26 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_builtins = { path = "../builtins" }
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_solve = { path = "../solve" }
roc_target = { path = "../roc_target" }
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
roc_builtins.workspace = true
roc_collections.workspace = true
roc_error_macros.workspace = true
roc_module.workspace = true
roc_mono.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_solve.workspace = true
roc_target.workspace = true
roc_types.workspace = true
roc_unify.workspace = true
bumpalo.workspace = true
object.workspace = true
packed_struct.workspace = true
target-lexicon.workspace = true
[dev-dependencies]
roc_can = { path = "../can" }
roc_parse = { path = "../parse" }
roc_std = { path = "../../roc_std" }
roc_can.workspace = true
roc_parse.workspace = true
roc_std.workspace = true
bumpalo.workspace = true
capstone.workspace = true

View file

@ -1432,28 +1432,20 @@ impl<
src2: Symbol,
layout: InLayout<'a>,
) {
match self.layout_interner.get_repr(layout) {
LayoutRepr::Builtin(Builtin::Int(width @ quadword_and_smaller!())) => {
let intrinsic = bitcode::NUM_ADD_SATURATED_INT[width].to_string();
match self.interner().get_repr(layout) {
LayoutRepr::Builtin(Builtin::Int(int_width)) => {
let intrinsic = bitcode::NUM_ADD_SATURATED_INT[int_width].to_string();
self.build_fn_call(&dst, intrinsic, &[src1, src2], &[layout, layout], &layout);
}
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F64)) => {
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, &dst);
let src1_reg = self.storage_manager.load_to_float_reg(&mut self.buf, &src1);
let src2_reg = self.storage_manager.load_to_float_reg(&mut self.buf, &src2);
ASM::add_freg64_freg64_freg64(&mut self.buf, dst_reg, src1_reg, src2_reg);
}
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F32)) => {
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, &dst);
let src1_reg = self.storage_manager.load_to_float_reg(&mut self.buf, &src1);
let src2_reg = self.storage_manager.load_to_float_reg(&mut self.buf, &src2);
ASM::add_freg32_freg32_freg32(&mut self.buf, dst_reg, src1_reg, src2_reg);
LayoutRepr::Builtin(Builtin::Float(_)) => {
// saturated add is just normal add
self.build_num_add(&dst, &src1, &src2, &layout)
}
LayoutRepr::Builtin(Builtin::Decimal) => {
let intrinsic = bitcode::DEC_ADD_SATURATED.to_string();
self.build_fn_call(&dst, intrinsic, &[src1, src2], &[layout, layout], &layout);
}
x => todo!("NumAddSaturated: layout, {:?}", x),
other => internal_error!("NumAddSaturated is not defined for {other:?}"),
}
}
@ -1481,6 +1473,30 @@ impl<
)
}
fn build_num_sub_saturated(
&mut self,
dst: Symbol,
src1: Symbol,
src2: Symbol,
layout: InLayout<'a>,
) {
match self.interner().get_repr(layout) {
LayoutRepr::Builtin(Builtin::Int(int_width)) => {
let intrinsic = bitcode::NUM_SUB_SATURATED_INT[int_width].to_string();
self.build_fn_call(&dst, intrinsic, &[src1, src2], &[layout, layout], &layout);
}
LayoutRepr::Builtin(Builtin::Float(_)) => {
// saturated sub is just normal sub
self.build_num_sub(&dst, &src1, &src2, &layout)
}
LayoutRepr::Builtin(Builtin::Decimal) => {
let intrinsic = bitcode::DEC_SUB_SATURATED.to_string();
self.build_fn_call(&dst, intrinsic, &[src1, src2], &[layout, layout], &layout);
}
other => internal_error!("NumSubSaturated is not defined for {other:?}"),
}
}
fn build_num_sub_checked(
&mut self,
dst: &Symbol,
@ -1619,28 +1635,20 @@ impl<
src2: Symbol,
layout: InLayout<'a>,
) {
match self.layout_interner.get_repr(layout) {
LayoutRepr::Builtin(Builtin::Int(width @ quadword_and_smaller!())) => {
let intrinsic = bitcode::NUM_MUL_SATURATED_INT[width].to_string();
match self.interner().get_repr(layout) {
LayoutRepr::Builtin(Builtin::Int(int_width)) => {
let intrinsic = bitcode::NUM_MUL_SATURATED_INT[int_width].to_string();
self.build_fn_call(&dst, intrinsic, &[src1, src2], &[layout, layout], &layout);
}
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F64)) => {
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, &dst);
let src1_reg = self.storage_manager.load_to_float_reg(&mut self.buf, &src1);
let src2_reg = self.storage_manager.load_to_float_reg(&mut self.buf, &src2);
ASM::mul_freg64_freg64_freg64(&mut self.buf, dst_reg, src1_reg, src2_reg);
}
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F32)) => {
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, &dst);
let src1_reg = self.storage_manager.load_to_float_reg(&mut self.buf, &src1);
let src2_reg = self.storage_manager.load_to_float_reg(&mut self.buf, &src2);
ASM::mul_freg32_freg32_freg32(&mut self.buf, dst_reg, src1_reg, src2_reg);
LayoutRepr::Builtin(Builtin::Float(_)) => {
// saturated mul is just normal mul
self.build_num_mul(&dst, &src1, &src2, &layout)
}
LayoutRepr::Builtin(Builtin::Decimal) => {
let intrinsic = bitcode::DEC_MUL_SATURATED.to_string();
self.build_fn_call(&dst, intrinsic, &[src1, src2], &[layout, layout], &layout);
}
x => todo!("NumMulSaturated: layout, {:?}", x),
other => internal_error!("NumMulSaturated is not defined for {other:?}"),
}
}

View file

@ -1005,7 +1005,7 @@ trait Backend<'a> {
}
}
/// build_run_low_level builds the low level opertation and outputs to the specified symbol.
/// build_run_low_level builds the low level operation and outputs to the specified symbol.
/// The builder must keep track of the symbol because it may be referred to later.
fn build_run_low_level(
&mut self,
@ -1068,9 +1068,6 @@ trait Backend<'a> {
LowLevel::NumAddChecked => {
self.build_num_add_checked(sym, &args[0], &args[1], &arg_layouts[0], ret_layout)
}
LowLevel::NumSubChecked => {
self.build_num_sub_checked(sym, &args[0], &args[1], &arg_layouts[0], ret_layout)
}
LowLevel::NumAcos => self.build_fn_call(
sym,
bitcode::NUM_ACOS[FloatWidth::F64].to_string(),
@ -1239,27 +1236,12 @@ trait Backend<'a> {
);
self.build_num_sub_wrap(sym, &args[0], &args[1], ret_layout)
}
LowLevel::NumSubSaturated => match self.interner().get_repr(*ret_layout) {
LayoutRepr::Builtin(Builtin::Int(int_width)) => self.build_fn_call(
sym,
bitcode::NUM_SUB_SATURATED_INT[int_width].to_string(),
args,
arg_layouts,
ret_layout,
),
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F32)) => {
self.build_num_sub(sym, &args[0], &args[1], ret_layout)
}
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F64)) => {
// saturated sub is just normal sub
self.build_num_sub(sym, &args[0], &args[1], ret_layout)
}
LayoutRepr::Builtin(Builtin::Decimal) => {
// self.load_args_and_call_zig(backend, bitcode::DEC_SUB_SATURATED)
todo!()
}
_ => internal_error!("invalid return type"),
},
LowLevel::NumSubSaturated => {
self.build_num_sub_saturated(*sym, args[0], args[1], *ret_layout)
}
LowLevel::NumSubChecked => {
self.build_num_sub_checked(sym, &args[0], &args[1], &arg_layouts[0], ret_layout)
}
LowLevel::NumBitwiseAnd => {
if let LayoutRepr::Builtin(Builtin::Int(int_width)) =
self.interner().get_repr(*ret_layout)
@ -2392,16 +2374,6 @@ trait Backend<'a> {
layout: &InLayout<'a>,
);
/// build_num_sub_checked stores the sum of src1 and src2 into dst.
fn build_num_sub_checked(
&mut self,
dst: &Symbol,
src1: &Symbol,
src2: &Symbol,
num_layout: &InLayout<'a>,
return_layout: &InLayout<'a>,
);
/// build_num_mul stores `src1 * src2` into dst.
fn build_num_mul(&mut self, dst: &Symbol, src1: &Symbol, src2: &Symbol, layout: &InLayout<'a>);
@ -2460,6 +2432,25 @@ trait Backend<'a> {
layout: &InLayout<'a>,
);
/// build_num_sub_saturated stores the `src1 - src2` difference into dst.
fn build_num_sub_saturated(
&mut self,
dst: Symbol,
src1: Symbol,
src2: Symbol,
layout: InLayout<'a>,
);
/// build_num_sub_checked stores the difference of src1 and src2 into dst.
fn build_num_sub_checked(
&mut self,
dst: &Symbol,
src1: &Symbol,
src2: &Symbol,
num_layout: &InLayout<'a>,
return_layout: &InLayout<'a>,
);
/// stores the `src1 & src2` into dst.
fn build_int_bitwise_and(
&mut self,

View file

@ -8,19 +8,18 @@ license.workspace = true
version.workspace = true
[dependencies]
morphic_lib = { path = "../../vendor/morphic_lib" }
roc_alias_analysis = { path = "../alias_analysis" }
roc_bitcode_bc = { path = "../builtins/bitcode/bc" }
roc_builtins = { path = "../builtins" }
roc_collections = { path = "../collections" }
roc_debug_flags = { path = "../debug_flags" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
roc_region = { path = "../region" }
roc_std = { path = "../../roc_std" }
roc_target = { path = "../roc_target" }
morphic_lib.workspace = true
roc_alias_analysis.workspace = true
roc_bitcode_bc.workspace = true
roc_builtins.workspace = true
roc_collections.workspace = true
roc_debug_flags.workspace = true
roc_error_macros.workspace = true
roc_module.workspace = true
roc_mono.workspace = true
roc_region.workspace = true
roc_std.workspace = true
roc_target.workspace = true
bumpalo.workspace = true
inkwell.workspace = true
target-lexicon.workspace = true

View file

@ -12,8 +12,8 @@ use crate::llvm::refcounting::{
use inkwell::attributes::{Attribute, AttributeLoc};
use inkwell::types::{BasicType, BasicTypeEnum, StructType};
use inkwell::values::{
BasicValueEnum, CallSiteValue, FunctionValue, InstructionValue, IntValue, PointerValue,
StructValue,
BasicValue, BasicValueEnum, CallSiteValue, FunctionValue, InstructionValue, IntValue,
PointerValue, StructValue,
};
use inkwell::AddressSpace;
use roc_error_macros::internal_error;
@ -47,6 +47,28 @@ pub fn call_bitcode_fn<'ctx>(
.build_bitcast(ret, env.context.i128_type(), "return_i128")
.unwrap();
}
} else if env.target == roc_target::Target::MacArm64 {
// Essentially the same happens on macos arm64, but with array type [2xi64].
let i64_type = env.context.i64_type();
let arr_type = i64_type.array_type(2);
if ret.get_type() == arr_type.into() {
let alloca = env
.builder
.build_array_alloca(i64_type, i64_type.const_int(2, false), "dec_alloca")
.unwrap_or_else(|err| internal_error!("failed to build array alloca: {err}"));
let instruction = alloca.as_instruction_value().unwrap_or_else(|| {
internal_error!("failed to convert pointer to instruction value ({alloca:?})");
});
instruction.set_alignment(16).unwrap_or_else(|err| {
internal_error!(
"failed to set 16-byte alignment on instruction ({instruction:?}): {err}"
);
});
env.builder.new_build_store(alloca, ret);
return env
.builder
.new_build_load(env.context.i128_type(), alloca, "return_i128");
}
}
ret

View file

@ -1784,7 +1784,7 @@ fn build_float_binop<'ctx>(
};
match op {
NumAdd => bd.new_build_float_add(lhs, rhs, "add_float").into(),
NumAdd | NumAddSaturated => bd.new_build_float_add(lhs, rhs, "add_float").into(),
NumAddChecked => {
let context = env.context;
@ -1811,7 +1811,7 @@ fn build_float_binop<'ctx>(
struct_value.into()
}
NumAddWrap => unreachable!("wrapping addition is not defined on floats"),
NumSub => bd.new_build_float_sub(lhs, rhs, "sub_float").into(),
NumSub | NumSubSaturated => bd.new_build_float_sub(lhs, rhs, "sub_float").into(),
NumSubChecked => {
let context = env.context;
@ -1838,8 +1838,7 @@ fn build_float_binop<'ctx>(
struct_value.into()
}
NumSubWrap => unreachable!("wrapping subtraction is not defined on floats"),
NumMul => bd.new_build_float_mul(lhs, rhs, "mul_float").into(),
NumMulSaturated => bd.new_build_float_mul(lhs, rhs, "mul_float").into(),
NumMul | NumMulSaturated => bd.new_build_float_mul(lhs, rhs, "mul_float").into(),
NumMulChecked => {
let context = env.context;
@ -1881,7 +1880,7 @@ fn build_float_binop<'ctx>(
&bitcode::NUM_POW[float_width],
),
_ => {
unreachable!("Unrecognized int binary operation: {:?}", op);
unreachable!("Unrecognized float binary operation: {:?}", op);
}
}
}
@ -2312,6 +2311,9 @@ fn build_dec_binop<'a, 'ctx>(
rhs,
"Decimal multiplication overflowed",
),
NumAddSaturated => dec_binary_op(env, bitcode::DEC_ADD_SATURATED, lhs, rhs),
NumSubSaturated => dec_binary_op(env, bitcode::DEC_SUB_SATURATED, lhs, rhs),
NumMulSaturated => dec_binary_op(env, bitcode::DEC_MUL_SATURATED, lhs, rhs),
NumDivFrac => dec_binop_with_unchecked(env, bitcode::DEC_DIV, lhs, rhs),
NumLt => call_bitcode_fn(env, &[lhs, rhs], &bitcode::NUM_LESS_THAN[IntWidth::I128]),

View file

@ -8,14 +8,13 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_builtins = { path = "../builtins" }
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
roc_std = { path = "../../roc_std" }
roc_target = { path = "../roc_target" }
roc_wasm_module = { path = "../../wasm_module" }
roc_builtins.workspace = true
roc_collections.workspace = true
roc_error_macros.workspace = true
roc_module.workspace = true
roc_mono.workspace = true
roc_std.workspace = true
roc_target.workspace = true
roc_wasm_module.workspace = true
bitvec.workspace = true
bumpalo.workspace = true

View file

@ -1829,24 +1829,12 @@ impl<'a> LowLevelCall<'a> {
_ => panic_ret_type(),
}
}
NumPowInt => {
self.load_args(backend);
let base_type = CodeGenNumType::for_symbol(backend, self.arguments[0]);
let exponent_type = CodeGenNumType::for_symbol(backend, self.arguments[1]);
let ret_type = CodeGenNumType::from(self.ret_layout);
debug_assert!(base_type == exponent_type);
debug_assert!(exponent_type == ret_type);
let width = match ret_type {
CodeGenNumType::I32 => IntWidth::I32,
CodeGenNumType::I64 => IntWidth::I64,
CodeGenNumType::I128 => todo!("{:?} for I128", self.lowlevel),
_ => internal_error!("Invalid return type for pow: {:?}", ret_type),
};
self.load_args_and_call_zig(backend, &bitcode::NUM_POW_INT[width])
}
NumPowInt => match self.ret_layout_raw {
LayoutRepr::Builtin(Builtin::Int(width)) => {
self.load_args_and_call_zig(backend, &bitcode::NUM_POW_INT[width])
}
_ => panic_ret_type(),
},
NumIsNan => num_is_nan(backend, self.arguments[0]),
NumIsInfinite => num_is_infinite(backend, self.arguments[0]),

View file

@ -8,15 +8,14 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_checkmate = { path = "../checkmate" }
roc_collections = { path = "../collections" }
roc_derive = { path = "../derive" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_solve = { path = "../solve" }
roc_solve_schema = { path = "../solve_schema" }
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
roc_can.workspace = true
roc_checkmate.workspace = true
roc_collections.workspace = true
roc_derive.workspace = true
roc_error_macros.workspace = true
roc_module.workspace = true
roc_solve.workspace = true
roc_solve_schema.workspace = true
roc_types.workspace = true
roc_unify.workspace = true
bumpalo.workspace = true

View file

@ -8,40 +8,38 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_load_internal = { path = "../load_internal" }
roc_module = { path = "../module" }
roc_packaging = { path = "../../packaging" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_target = { path = "../roc_target" }
roc_types = { path = "../types" }
roc_can.workspace = true
roc_collections.workspace = true
roc_load_internal.workspace = true
roc_module.workspace = true
roc_packaging.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_target.workspace = true
roc_types.workspace = true
bumpalo.workspace = true
[build-dependencies]
roc_builtins = { path = "../builtins" }
roc_can = { path = "../can" }
roc_module = { path = "../module" }
roc_packaging = { path = "../../packaging" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_target = { path = "../roc_target" }
roc_error_macros = { path = "../../error_macros" }
roc_load_internal = { path = "../load_internal" }
roc_builtins.workspace = true
roc_can.workspace = true
roc_module.workspace = true
roc_packaging.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_target.workspace = true
roc_error_macros.workspace = true
roc_load_internal.workspace = true
bumpalo.workspace = true
[dev-dependencies]
roc_constrain = { path = "../constrain" }
roc_derive = { path = "../derive" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_solve_problem = { path = "../solve_problem" }
ven_pretty = { path = "../../vendor/pretty" }
roc_test_utils_dir = { path = "../../test_utils_dir" }
roc_constrain.workspace = true
roc_derive.workspace = true
roc_parse.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_solve_problem.workspace = true
ven_pretty.workspace = true
roc_test_utils_dir.workspace = true
indoc.workspace = true
insta.workspace = true
pretty_assertions.workspace = true

View file

@ -8,43 +8,40 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_builtins = { path = "../builtins" }
roc_can = { path = "../can" }
roc_work = { path = "../work" }
roc_checkmate = { path = "../checkmate" }
roc_collections = { path = "../collections" }
roc_constrain = { path = "../constrain" }
roc_debug_flags = { path = "../debug_flags" }
roc_derive = { path = "../derive" }
roc_derive_key = { path = "../derive_key" }
roc_error_macros = { path = "../../error_macros" }
roc_late_solve = { path = "../late_solve" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
roc_packaging = { path = "../../packaging" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_solve_problem = { path = "../solve_problem" }
roc_target = { path = "../roc_target" }
roc_tracing = { path = "../../tracing" }
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
roc_worker = { path = "../worker" }
roc_lower_params = { path = "../lower_params" }
ven_pretty = { path = "../../vendor/pretty" }
roc_builtins.workspace = true
roc_can.workspace = true
roc_work.workspace = true
roc_checkmate.workspace = true
roc_collections.workspace = true
roc_constrain.workspace = true
roc_debug_flags.workspace = true
roc_derive.workspace = true
roc_derive_key.workspace = true
roc_error_macros.workspace = true
roc_late_solve.workspace = true
roc_module.workspace = true
roc_mono.workspace = true
roc_packaging.workspace = true
roc_parse.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_solve_problem.workspace = true
roc_target.workspace = true
roc_tracing.workspace = true
roc_types.workspace = true
roc_unify.workspace = true
roc_worker.workspace = true
roc_lower_params.workspace = true
ven_pretty.workspace = true
bumpalo.workspace = true
crossbeam.workspace = true
parking_lot.workspace = true
tempfile.workspace = true
[dev-dependencies]
roc_test_utils_dir = { path = "../../test_utils_dir" }
roc_test_utils_dir.workspace = true
indoc.workspace = true
maplit.workspace = true
pretty_assertions.workspace = true

View file

@ -661,7 +661,7 @@ struct CanAndCon {
module_docs: Option<ModuleDocumentation>,
}
#[derive(Debug)]
#[derive(Debug, PartialEq, Eq)]
enum PlatformPath<'a> {
NotSpecified,
Valid(To<'a>),
@ -1145,7 +1145,6 @@ impl<'a> LoadStart<'a> {
// Load the root module synchronously; we can't proceed until we have its id.
let root_start_time = Instant::now();
let load_result = load_filename(
arena,
filename.clone(),
@ -1290,7 +1289,6 @@ fn handle_root_type<'a>(
if let (Some(main_path), Some(cache_dir)) = (main_path.clone(), cache_dir) {
let mut messages = Vec::with_capacity(4);
messages.push(header_output.msg);
load_packages_from_main(
arena,
src_dir.clone(),
@ -2249,7 +2247,9 @@ fn update<'a>(
// If we're building an app module, and this was the platform
// specified in its header's `to` field, record it as our platform.
if state.opt_platform_shorthand == Some(config_shorthand) {
if state.opt_platform_shorthand == Some(config_shorthand)
|| state.platform_path == PlatformPath::RootIsModule
{
debug_assert!(state.platform_data.is_none());
state.platform_data = Some(PlatformData {
@ -2269,18 +2269,18 @@ fn update<'a>(
state.fx_mode = FxMode::PurityInference;
}
}
Builtin { .. } | Module { .. } => {
Builtin { .. } => {
if header.is_root_module {
debug_assert!(matches!(state.platform_path, PlatformPath::NotSpecified));
state.platform_path = PlatformPath::RootIsModule;
}
}
Hosted { exposes, .. } => {
Hosted { exposes, .. } | Module { exposes, .. } => {
if header.is_root_module {
debug_assert!(matches!(state.platform_path, PlatformPath::NotSpecified));
state.platform_path = PlatformPath::RootIsHosted;
}
// WARNING: This will be bypassed if we export a record of effectful functions. This is a temporary hacky method
if exposes
.iter()
.any(|exposed| exposed.value.is_effectful_fn())
@ -2343,7 +2343,6 @@ fn update<'a>(
extend_module_with_builtin_import(parsed, ModuleId::INSPECT);
extend_module_with_builtin_import(parsed, ModuleId::TASK);
}
state
.module_cache
.imports

View file

@ -8,11 +8,10 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_module = { path = "../module" }
roc_region = { path = "../region" }
roc_types = { path = "../types" }
roc_collections = { path = "../collections" }
roc_solve_problem = { path = "../solve_problem" }
roc_can.workspace = true
roc_module.workspace = true
roc_region.workspace = true
roc_types.workspace = true
roc_collections.workspace = true
roc_solve_problem.workspace = true
bumpalo.workspace = true

View file

@ -8,10 +8,10 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_ident = { path = "../ident" }
roc_region = { path = "../region" }
roc_collections.workspace = true
roc_error_macros.workspace = true
roc_ident.workspace = true
roc_region.workspace = true
bumpalo.workspace = true
static_assertions.workspace = true

View file

@ -8,25 +8,25 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_builtins = { path = "../builtins" }
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_debug_flags = { path = "../debug_flags" }
roc_derive = { path = "../derive" }
roc_derive_key = { path = "../derive_key" }
roc_error_macros = { path = "../../error_macros" }
roc_exhaustive = { path = "../exhaustive" }
roc_late_solve = { path = "../late_solve" }
roc_module = { path = "../module" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_std = { path = "../../roc_std" }
roc_target = { path = "../roc_target" }
roc_tracing = { path = "../../tracing" }
roc_types = { path = "../types" }
roc_solve_schema = { path = "../solve_schema" }
roc_unify = { path = "../unify" }
ven_pretty = { path = "../../vendor/pretty" }
roc_builtins.workspace = true
roc_can.workspace = true
roc_collections.workspace = true
roc_debug_flags.workspace = true
roc_derive.workspace = true
roc_derive_key.workspace = true
roc_error_macros.workspace = true
roc_exhaustive.workspace = true
roc_late_solve.workspace = true
roc_module.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_std.workspace = true
roc_target.workspace = true
roc_tracing.workspace = true
roc_types.workspace = true
roc_solve_schema.workspace = true
roc_unify.workspace = true
ven_pretty.workspace = true
bitvec.workspace = true
arrayvec.workspace = true
@ -34,4 +34,4 @@ bumpalo.workspace = true
hashbrown.workspace = true
parking_lot.workspace = true
static_assertions.workspace = true
indoc.workspace = true
indoc.workspace = true

View file

@ -11,10 +11,10 @@ version.workspace = true
"parse_debug_trace" = []
[dependencies]
roc_collections = { path = "../collections" }
roc_module = { path = "../module" }
roc_region = { path = "../region" }
roc_error_macros = { path = "../../error_macros" }
roc_collections.workspace = true
roc_module.workspace = true
roc_region.workspace = true
roc_error_macros.workspace = true
soa.workspace = true

View file

@ -8,8 +8,8 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_module = { path = "../module" }
roc_parse = { path = "../parse" }
roc_region = { path = "../region" }
roc_types = { path = "../types" }
roc_collections.workspace = true
roc_module.workspace = true
roc_parse.workspace = true
roc_region.workspace = true
roc_types.workspace = true

View file

@ -8,7 +8,7 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_error_macros = { path = "../../error_macros" }
roc_error_macros.workspace = true
strum.workspace = true
strum_macros.workspace = true

View file

@ -8,4 +8,4 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_collections.workspace = true

View file

@ -8,21 +8,21 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_checkmate = { path = "../checkmate" }
roc_collections = { path = "../collections" }
roc_debug_flags = { path = "../debug_flags" }
roc_derive = { path = "../derive" }
roc_derive_key = { path = "../derive_key" }
roc_error_macros = { path = "../../error_macros" }
roc_exhaustive = { path = "../exhaustive" }
roc_module = { path = "../module" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_solve_problem = { path = "../solve_problem" }
roc_solve_schema = { path = "../solve_schema" }
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
roc_can.workspace = true
roc_checkmate.workspace = true
roc_collections.workspace = true
roc_debug_flags.workspace = true
roc_derive.workspace = true
roc_derive_key.workspace = true
roc_error_macros.workspace = true
roc_exhaustive.workspace = true
roc_module.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_solve_problem.workspace = true
roc_solve_schema.workspace = true
roc_types.workspace = true
roc_unify.workspace = true
arrayvec.workspace = true
bumpalo.workspace = true
@ -30,14 +30,14 @@ bumpalo.workspace = true
soa.workspace = true
[dev-dependencies]
roc_builtins = { path = "../builtins" }
roc_derive = { path = "../derive", features = ["debug-derived-symbols"] }
roc_load = { path = "../load" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_reporting = { path = "../../reporting" }
roc_target = { path = "../roc_target" }
test_solve_helpers = { path = "../test_solve_helpers" }
roc_builtins.workspace = true
roc_derive = { workspace = true, features = ["debug-derived-symbols"] }
roc_load.workspace = true
roc_parse.workspace = true
roc_problem.workspace = true
roc_reporting.workspace = true
roc_target.workspace = true
test_solve_helpers.workspace = true
bumpalo.workspace = true
indoc.workspace = true

View file

@ -8,10 +8,10 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_exhaustive = { path = "../exhaustive" }
roc_module = { path = "../module" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_types = { path = "../types" }
roc_can.workspace = true
roc_collections.workspace = true
roc_exhaustive.workspace = true
roc_module.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_types.workspace = true

View file

@ -8,12 +8,12 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_region = { path = "../region" }
roc_types = { path = "../types" }
roc_collections = { path = "../collections" }
roc_module = { path = "../module" }
roc_solve = { path = "../solve" }
roc_can.workspace = true
roc_region.workspace = true
roc_types.workspace = true
roc_collections.workspace = true
roc_module.workspace = true
roc_solve.workspace = true
bitvec.workspace = true
arrayvec.workspace = true
@ -26,15 +26,15 @@ indoc.workspace = true
soa.workspace = true
[dev-dependencies]
roc_builtins = { path = "../builtins" }
roc_derive = { path = "../derive", features = ["debug-derived-symbols"] }
roc_load = { path = "../load" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_reporting = { path = "../../reporting" }
roc_target = { path = "../roc_target" }
roc_solve = { path = "../solve" }
test_solve_helpers = { path = "../test_solve_helpers" }
roc_builtins.workspace = true
roc_derive = { workspace = true, features = ["debug-derived-symbols"] }
roc_load.workspace = true
roc_parse.workspace = true
roc_problem.workspace = true
roc_reporting.workspace = true
roc_target.workspace = true
roc_solve.workspace = true
test_solve_helpers.workspace = true
test_compile.workspace = true
pretty_assertions.workspace = true

View file

@ -12,26 +12,26 @@ name = "test_derive"
path = "src/tests.rs"
[dev-dependencies]
roc_builtins = { path = "../builtins" }
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_constrain = { path = "../constrain" }
roc_debug_flags = { path = "../debug_flags" }
roc_derive = { path = "../derive", features = [
roc_builtins.workspace = true
roc_can.workspace = true
roc_collections.workspace = true
roc_constrain.workspace = true
roc_debug_flags.workspace = true
roc_derive = { workspace = true, features = [
"debug-derived-symbols",
"open-extension-vars",
] }
roc_derive_key = { path = "../derive_key" }
roc_load_internal = { path = "../load_internal" }
roc_module = { path = "../module" }
roc_packaging = { path = "../../packaging" }
roc_region = { path = "../region" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_target = { path = "../roc_target" }
roc_types = { path = "../types" }
roc_derive_key.workspace = true
roc_load_internal.workspace = true
roc_module.workspace = true
roc_packaging.workspace = true
roc_region.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_target.workspace = true
roc_types.workspace = true
ven_pretty = { path = "../../vendor/pretty" }
ven_pretty.workspace = true
bumpalo.workspace = true
insta.workspace = true

View file

@ -12,44 +12,48 @@ name = "test_gen"
path = "src/tests.rs"
[build-dependencies]
roc_bitcode = { path = "../builtins/bitcode" }
roc_command_utils = { path = "../../utils/command" }
wasi_libc_sys = { path = "../../wasi-libc-sys" }
roc_bitcode.workspace = true
roc_command_utils.workspace = true
wasi_libc_sys.workspace = true
tempfile.workspace = true
[dependencies]
roc_gen_llvm = { path = "../gen_llvm", optional = true }
roc_gen_llvm = { workspace = true, optional = true }
inkwell = { workspace = true, optional = true }
[dev-dependencies]
roc_gen_dev = { path = "../gen_dev" }
roc_gen_wasm = { path = "../gen_wasm" }
roc_bitcode = { path = "../builtins/bitcode" }
roc_build = { path = "../build", features = ["target-aarch64", "target-x86_64", "target-wasm32"] }
roc_builtins = { path = "../builtins" }
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_command_utils = { path = "../../utils/command" }
roc_constrain = { path = "../constrain" }
roc_debug_flags = { path = "../debug_flags" }
roc_error_macros = { path = "../../error_macros" }
roc_load = { path = "../load" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
roc_packaging = { path = "../../packaging" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_std = { path = "../../roc_std" }
roc_target = { path = "../roc_target" }
roc_test_utils = { path = "../../test_utils"}
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
roc_wasm_interp = { path = "../../wasm_interp" }
roc_wasm_module = { path = "../../wasm_module" }
roc_gen_dev.workspace = true
roc_gen_wasm.workspace = true
roc_bitcode.workspace = true
roc_build = { workspace = true, features = [
"target-aarch64",
"target-x86_64",
"target-wasm32",
] }
roc_builtins.workspace = true
roc_can.workspace = true
roc_collections.workspace = true
roc_command_utils.workspace = true
roc_constrain.workspace = true
roc_debug_flags.workspace = true
roc_error_macros.workspace = true
roc_load.workspace = true
roc_module.workspace = true
roc_mono.workspace = true
roc_packaging.workspace = true
roc_parse.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_std.workspace = true
roc_target.workspace = true
roc_test_utils.workspace = true
roc_types.workspace = true
roc_unify.workspace = true
roc_wasm_interp.workspace = true
roc_wasm_module.workspace = true
bumpalo.workspace = true
criterion.workspace = true

View file

@ -1926,6 +1926,13 @@ fn pow_int() {
assert_evals_to!("Num.powInt 2 3", 8, i64);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
#[should_panic(expected = r#"Roc failed with message: "Integer raised to power overflowed!"#)]
fn pow_int_overflow() {
assert_evals_to!("Num.powInt 2u8 8", 0, u8);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn atan() {
@ -3000,161 +3007,199 @@ fn u8_mul_greater_than_i8() {
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn add_saturated() {
assert_evals_to!("Num.addSaturated 200u8 200u8", 255u8, u8);
assert_evals_to!("Num.addSaturated 100i8 100i8", 127i8, i8);
assert_evals_to!("Num.addSaturated -100i8 -100i8", -128i8, i8);
assert_evals_to!("Num.addSaturated 40000u16 40000u16", 65535u16, u16);
assert_evals_to!("Num.addSaturated 20000i16 20000i16", 32767i16, i16);
assert_evals_to!("Num.addSaturated -20000i16 -20000i16", -32768i16, i16);
assert_evals_to!(
indoc!(
r"
x : U8
x = 200
y : U8
y = 200
Num.addSaturated x y
"
),
255,
u8
"Num.addSaturated 3000000000u32 3000000000u32",
4294967295u32,
u32
);
assert_evals_to!(
"Num.addSaturated 2000000000i32 2000000000i32",
2147483647i32,
i32
);
assert_evals_to!(
"Num.addSaturated -2000000000i32 -2000000000i32",
-2147483648i32,
i32
);
assert_evals_to!(
"Num.addSaturated 10000000000000000000u64 10000000000000000000u64",
18446744073709551615u64,
u64
);
assert_evals_to!(
"Num.addSaturated 5000000000000000000i64 5000000000000000000i64 ",
9223372036854775807i64,
i64
);
assert_evals_to!(
"Num.addSaturated -5000000000000000000i64 -5000000000000000000i64 ",
-9223372036854775808i64,
i64
);
assert_evals_to!(
"Num.addSaturated -5000000000000000000i64 -5000000000000000000i64 ",
-9223372036854775808i64,
i64
);
assert_evals_to!(
"Num.addSaturated Num.maxF32 Num.maxF32",
std::f32::INFINITY,
f32
);
assert_evals_to!(
"Num.addSaturated Num.minF32 Num.minF32",
std::f32::NEG_INFINITY,
f32
);
assert_evals_to!(
"Num.addSaturated Num.maxF64 Num.maxF64",
std::f64::INFINITY,
f64
);
assert_evals_to!(
"Num.addSaturated Num.minF64 Num.minF64",
std::f64::NEG_INFINITY,
f64
);
assert_evals_to!(
indoc!(
r"
x : I8
x = 100
y : I8
y = 100
Num.addSaturated x y
"
),
127,
i8
"Num.addSaturated 170_141_183_460_469_231_731dec 1",
RocDec::from_str("170141183460469231731.687303715884105727").unwrap(),
RocDec
);
assert_evals_to!(
indoc!(
r"
x : I8
x = -100
y : I8
y = -100
Num.addSaturated x y
"
),
-128,
i8
"Num.addSaturated -170_141_183_460_469_231_731dec -1",
RocDec::from_str("-170141183460469231731.687303715884105728").unwrap(),
RocDec
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn sub_saturated() {
assert_evals_to!("Num.subSaturated 1u8 10u8", 0u8, u8);
assert_evals_to!("Num.subSaturated 100i8 -100i8", 127i8, i8);
assert_evals_to!("Num.subSaturated -100i8 100i8", -128i8, i8);
assert_evals_to!("Num.subSaturated 1u16 10u16", 0u16, u16);
assert_evals_to!("Num.subSaturated 20000i16 -20000i16", 32767i16, i16);
assert_evals_to!("Num.subSaturated -20000i16 20000i16", -32768i16, i16);
assert_evals_to!("Num.subSaturated 1u32 10u32", 0u32, u32);
assert_evals_to!(
indoc!(
r"
x : U8
x = 10
y : U8
y = 20
Num.subSaturated x y
"
),
0,
u8
"Num.subSaturated 2000000000i32 -2000000000i32",
2147483647i32,
i32
);
assert_evals_to!(
indoc!(
r"
x : I8
x = -100
y : I8
y = 100
Num.subSaturated x y
"
),
-128,
i8
"Num.subSaturated -2000000000i32 2000000000i32",
-2147483648i32,
i32
);
assert_evals_to!("Num.subSaturated 1u64 10u64", 0u64, u64);
assert_evals_to!(
"Num.subSaturated 5000000000000000000i64 -5000000000000000000i64 ",
9223372036854775807i64,
i64
);
assert_evals_to!(
indoc!(
r"
x : I8
x = 100
y : I8
y = -100
Num.subSaturated x y
"
),
127,
i8
"Num.subSaturated -5000000000000000000i64 5000000000000000000i64 ",
-9223372036854775808i64,
i64
);
assert_evals_to!(
"Num.subSaturated -5000000000000000000i64 5000000000000000000i64 ",
-9223372036854775808i64,
i64
);
assert_evals_to!(
"Num.subSaturated Num.maxF32 -Num.maxF32",
std::f32::INFINITY,
f32
);
assert_evals_to!(
"Num.subSaturated Num.minF32 -Num.minF32",
std::f32::NEG_INFINITY,
f32
);
assert_evals_to!(
"Num.subSaturated Num.maxF64 -Num.maxF64",
std::f64::INFINITY,
f64
);
assert_evals_to!(
"Num.subSaturated Num.minF64 -Num.minF64",
std::f64::NEG_INFINITY,
f64
);
assert_evals_to!(
"Num.subSaturated 170_141_183_460_469_231_731dec -1",
RocDec::from_str("170141183460469231731.687303715884105727").unwrap(),
RocDec
);
assert_evals_to!(
"Num.subSaturated -170_141_183_460_469_231_731dec 1",
RocDec::from_str("-170141183460469231731.687303715884105728").unwrap(),
RocDec
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn mul_saturated() {
assert_evals_to!("Num.mulSaturated 200u8 2", 255u8, u8);
assert_evals_to!("Num.mulSaturated 100i8 2", 127i8, i8);
assert_evals_to!("Num.mulSaturated -100i8 2", -128i8, i8);
assert_evals_to!("Num.mulSaturated 40000u16 2", 65535u16, u16);
assert_evals_to!("Num.mulSaturated 20000i16 2", 32767i16, i16);
assert_evals_to!("Num.mulSaturated -20000i16 2", -32768i16, i16);
assert_evals_to!("Num.mulSaturated 3000000000u32 2", 4294967295u32, u32);
assert_evals_to!("Num.mulSaturated 2000000000i32 2", 2147483647i32, i32);
assert_evals_to!("Num.mulSaturated -2000000000i32 2", -2147483648i32, i32);
assert_evals_to!(
indoc!(
r"
x : U8
x = 20
y : U8
y = 20
Num.mulSaturated x y
"
),
255,
u8
"Num.mulSaturated 10000000000000000000u64 2",
18446744073709551615u64,
u64
);
assert_evals_to!(
indoc!(
r"
x : I8
x = -20
y : I8
y = -20
Num.mulSaturated x y
"
),
127,
i8
"Num.mulSaturated 5000000000000000000i64 2",
9223372036854775807i64,
i64
);
assert_evals_to!(
indoc!(
r"
x : I8
x = 20
y : I8
y = -20
Num.mulSaturated x y
"
),
-128,
i8
"Num.mulSaturated -5000000000000000000i64 2",
-9223372036854775808i64,
i64
);
assert_evals_to!(
indoc!(
r"
x : I8
x = -20
y : I8
y = 20
Num.mulSaturated x y
"
),
-128,
i8
"Num.mulSaturated -5000000000000000000i64 2",
-9223372036854775808i64,
i64
);
assert_evals_to!("Num.mulSaturated Num.maxF32 2", std::f32::INFINITY, f32);
assert_evals_to!("Num.mulSaturated Num.minF32 2", std::f32::NEG_INFINITY, f32);
assert_evals_to!("Num.mulSaturated Num.maxF64 2", std::f64::INFINITY, f64);
assert_evals_to!("Num.mulSaturated Num.minF64 2", std::f64::NEG_INFINITY, f64);
// TODO: This doesn't work anywhere? It returns -1.374607431768211456 : Dec ?
/*
assert_evals_to!(
"Num.mulSaturated 170_141_183_460_469_231_731dec 2",
RocDec::from_str("170141183460469231731.687303715884105727").unwrap(),
RocDec
);
assert_evals_to!(
indoc!(
r"
x : I8
x = 20
y : I8
y = 20
Num.mulSaturated x y
"
),
127,
i8
"Num.mulSaturated -170_141_183_460_469_231_731dec 2",
RocDec::from_str("-170141183460469231731.687303715884105728").unwrap(),
RocDec
);
*/
}
#[test]

View file

@ -12,19 +12,19 @@ name = "test_mono"
path = "src/tests.rs"
[dev-dependencies]
roc_builtins = { path = "../builtins" }
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_load = { path = "../load" }
roc_module = { path = "../module", features = ["debug-symbols"] }
roc_mono = { path = "../mono" }
roc_packaging = { path = "../../packaging" }
roc_reporting = { path = "../../reporting" }
roc_target = { path = "../roc_target" }
roc_test_utils = { path = "../../test_utils" }
roc_tracing = { path = "../../tracing" }
roc_builtins.workspace = true
roc_can.workspace = true
roc_collections.workspace = true
roc_load.workspace = true
roc_module = { workspace = true, features = ["debug-symbols"] }
roc_mono.workspace = true
roc_packaging.workspace = true
roc_reporting.workspace = true
roc_target.workspace = true
roc_test_utils.workspace = true
roc_tracing.workspace = true
test_mono_macros = { path = "../test_mono_macros" }
test_mono_macros.workspace = true
bumpalo.workspace = true
indoc.workspace = true

View file

@ -8,19 +8,19 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_derive = { path = "../derive" }
roc_load = { path = "../load" }
roc_module = { path = "../module" }
roc_packaging = { path = "../../packaging" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_late_solve = { path = "../late_solve" }
roc_solve_problem = { path = "../solve_problem" }
roc_target = { path = "../roc_target" }
roc_types = { path = "../types" }
roc_can.workspace = true
roc_derive.workspace = true
roc_load.workspace = true
roc_module.workspace = true
roc_packaging.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_late_solve.workspace = true
roc_solve_problem.workspace = true
roc_target.workspace = true
roc_types.workspace = true
bumpalo.workspace = true
indoc.workspace = true

View file

@ -12,13 +12,13 @@ version.workspace = true
[dependencies]
bumpalo.workspace = true
roc_collections = { path = "../collections" }
roc_fmt = { path = "../fmt" }
roc_module = { path = "../module" }
roc_parse = { path = "../parse" }
roc_region = { path = "../region" }
roc_test_utils = { path = "../../test_utils" }
roc_test_utils_dir = { path = "../../test_utils_dir" }
roc_collections.workspace = true
roc_fmt.workspace = true
roc_module.workspace = true
roc_parse.workspace = true
roc_region.workspace = true
roc_test_utils.workspace = true
roc_test_utils_dir.workspace = true
[dev-dependencies]
indoc.workspace = true

View file

@ -10,10 +10,9 @@ edition = "2021"
cargo-fuzz = true
[dependencies]
test_syntax = { path = "../../test_syntax" }
roc_parse = { path = "../../parse" }
bumpalo = { version = "3.12.0", features = ["collections"] }
test_syntax.workspace = true
roc_parse.workspace = true
bumpalo = { workspace = true, features = ["collections"] }
libfuzzer-sys = "0.4"
# Prevent this from interfering with workspaces

View file

@ -8,15 +8,15 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_debug_flags = { path = "../debug_flags" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_region = { path = "../region" }
roc_serialize = { path = "../serialize" }
roc_parse = { path = "../parse" }
roc_collections.workspace = true
roc_debug_flags.workspace = true
roc_error_macros.workspace = true
roc_module.workspace = true
roc_region.workspace = true
roc_serialize.workspace = true
roc_parse.workspace = true
ven_pretty = { path = "../../vendor/pretty" }
ven_pretty.workspace = true
bumpalo.workspace = true
static_assertions.workspace = true

View file

@ -13,19 +13,19 @@ path = "src/uitest.rs"
harness = false
[dev-dependencies]
roc_builtins = { path = "../builtins" }
roc_collections = { path = "../collections" }
roc_derive = { path = "../derive", features = ["debug-derived-symbols"] }
roc_load = { path = "../load" }
roc_packaging = { path = "../../packaging" }
roc_module = { path = "../module", features = ["debug-symbols"] }
roc_mono = { path = "../mono" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_target = { path = "../roc_target" }
test_solve_helpers = { path = "../test_solve_helpers" }
roc_builtins.workspace = true
roc_collections.workspace = true
roc_derive = { workspace = true, features = ["debug-derived-symbols"] }
roc_load.workspace = true
roc_packaging.workspace = true
roc_module = { workspace = true, features = ["debug-symbols"] }
roc_mono.workspace = true
roc_parse.workspace = true
roc_problem.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_target.workspace = true
test_solve_helpers.workspace = true
bumpalo.workspace = true
indoc.workspace = true

View file

@ -8,27 +8,11 @@ license.workspace = true
version.workspace = true
[dependencies]
[dependencies.roc_collections]
path = "../collections"
[dependencies.roc_error_macros]
path = "../../error_macros"
[dependencies.roc_module]
path = "../module"
[dependencies.roc_types]
path = "../types"
[dependencies.roc_debug_flags]
path = "../debug_flags"
[dependencies.roc_tracing]
path = "../../tracing"
[dependencies.roc_checkmate]
path = "../checkmate"
[dependencies.roc_solve_schema]
path = "../solve_schema"
roc_collections.workspace = true
roc_error_macros.workspace = true
roc_module.workspace = true
roc_types.workspace = true
roc_debug_flags.workspace = true
roc_tracing.workspace = true
roc_checkmate.workspace = true
roc_solve_schema.workspace = true

View file

@ -3345,6 +3345,17 @@ fn unify_flat_type<M: MetaCollector>(
outcome
}
(Func(args, closure, ret, fx), EffectfulFunc) => {
let mut outcome = unify_pool(env, pool, *fx, Variable::EFFECTFUL, ctx.mode);
outcome.union(merge(
env,
ctx,
Structure(Func(*args, *closure, *ret, Variable::EFFECTFUL)),
));
outcome
}
(FunctionOrTagUnion(tag_names, tag_symbols, ext), Func(args, closure, ret, fx)) => {
unify_function_or_tag_union_and_func(
env,

View file

@ -8,6 +8,6 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_module = { path = "../module" }
roc_error_macros = { path = "../../error_macros" }
roc_collections.workspace = true
roc_module.workspace = true
roc_error_macros.workspace = true

View file

@ -8,9 +8,9 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_module = { path = "../module" }
roc_work = { path = "../work" }
roc_error_macros = { path = "../../error_macros" }
roc_collections.workspace = true
roc_module.workspace = true
roc_work.workspace = true
roc_error_macros.workspace = true
crossbeam.workspace = true

View file

@ -8,22 +8,22 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_builtins = { path = "../compiler/builtins" }
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_highlight = { path = "../highlight" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_packaging = { path = "../packaging" }
roc_parse = { path = "../compiler/parse" }
roc_region = { path = "../compiler/region" }
roc_reporting = { path = "../reporting" }
roc_solve = { path = "../compiler/solve" }
roc_target = { path = "../compiler/roc_target" }
roc_types = { path = "../compiler/types" }
roc_problem = { path = "../compiler/problem" }
roc_builtins.workspace = true
roc_can.workspace = true
roc_collections.workspace = true
roc_highlight.workspace = true
roc_load.workspace = true
roc_module.workspace = true
roc_packaging.workspace = true
roc_parse.workspace = true
roc_region.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_target.workspace = true
roc_types.workspace = true
roc_problem.workspace = true
ven_pretty = { path = "../vendor/pretty" }
ven_pretty.workspace = true
bumpalo.workspace = true
pulldown-cmark.workspace = true

View file

@ -241,20 +241,45 @@ fn render_package_index(docs_by_module: &[(ModuleId, ModuleDocumentation)]) -> S
push_html(&mut module_list_buf, "li", [], link_buf.as_str());
}
let header = {
let mut header_buf = String::new();
push_html(
&mut header_buf,
"h2",
[("class", "module-name")],
"Exposed Modules",
);
push_html(
&mut header_buf,
"a",
[
("class", "llm-prompt-link"),
("title", "Documentation in a LLM-friendly format"),
("href", "llms.txt"),
],
"LLM docs",
);
header_buf
};
// The HTML for the index page
let mut index_buf = String::new();
push_html(
&mut index_buf,
"h2",
[("class", "module-name")],
"Exposed Modules",
"div",
[("class", "module-header-container")],
&header,
);
push_html(
&mut index_buf,
"ul",
[("class", "index-module-links")],
module_list_buf.as_str(),
&module_list_buf,
);
index_buf

View file

@ -1,75 +1,107 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- Page title -->
<!-- <meta name="description" content="TODO populate this based on the module's description"> -->
<meta name="viewport" content="width=device-width">
<base href="<!-- base -->">
<script type="text/javascript" src="search.js" defer></script>
<link rel="stylesheet" href="styles.css">
<link rel="icon" href="/favicon.svg">
<!-- Safari ignores rel="icon" and only respects rel="mask-icon". It will render the SVG with
<head>
<meta charset="utf-8" />
<!-- Page title -->
<!-- <meta name="description" content="TODO populate this based on the module's description"> -->
<meta name="viewport" content="width=device-width" />
<base href="<!-- base -->" />
<script type="text/javascript" src="search.js" defer></script>
<link rel="stylesheet" href="styles.css" />
<link rel="icon" href="/favicon.svg" />
<!-- Safari ignores rel="icon" and only respects rel="mask-icon". It will render the SVG with
fill="#000" unless this `color` attribute here is hardcoded (not a CSS `var()`) to override it.
-->
<link rel="mask-icon" href="/favicon.svg" color="#7d59dd">
<!-- Prefetch links -->
</head>
<link rel="mask-icon" href="/favicon.svg" color="#7d59dd" />
<!-- Prefetch links -->
</head>
<body>
<nav id="sidebar-nav">
<div class="module-links">
<!-- Module links -->
</div>
</nav>
<div class="top-header-extension">
<!-- if the window gets big, this extends the purple bar on the top header to the left edge of the window -->
</div>
<header class="top-header">
<div class="pkg-and-logo">
<a class="logo" href="/" aria-labelledby="logo-link">
<svg viewBox="0 -6 51 58" fill="none" xmlns="http://www.w3.org/2000/svg" aria-labelledby="logo-link"
role="img">
<title id="logo-link">Return to Roc packages</title>
<polygon role="presentation"
points="0,0 23.8834,3.21052 37.2438,19.0101 45.9665,16.6324 50.5,22 45,22 44.0315,26.3689 26.4673,39.3424 27.4527,45.2132 17.655,53 23.6751,22.7086" />
</svg>
</a>
<!-- Package Name -->
</div>
<form id="module-search-form">
<input
id="module-search"
aria-labelledby="search-link"
type="text"
placeholder="Search"
role="combobox"
aria-autocomplete="list"
aria-expanded="false"
aria-controls="search-type-ahead"
/>
<label for="module-search" id="search-link">Search (press s)</label>
<span id="search-shortcut-key" aria-hidden="true">s</span>
<ul id="search-type-ahead" role="listbox" aria-label="Search Results" class="hidden">
<!-- Search Type Ahead -->
</ul>
</form>
<div id="llm-prompt-container">
<a id="llm-prompt-link" href="llms.txt" title="Documentation in a LLM friendly format">
LLM docs
</a>
</div>
<div class="top-header-triangle">
<body>
<nav id="sidebar-nav">
<div class="module-links">
<!-- Module links -->
</div>
</nav>
<div class="header-start-extension">
<!-- if the window gets big, this extends the purple bar on the top header to the left edge of the window -->
</div>
</header>
<main>
<!-- Module Docs -->
</main>
<footer>
<p>Made by people who like to make nice things.</p>
</footer>
</body>
<header class="top-header">
<div class="pkg-and-logo">
<a class="logo" href="/" aria-labelledby="logo-link">
<svg
viewBox="0 -6 51 58"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-labelledby="logo-link"
role="img"
>
<title id="logo-link">Return to Roc packages</title>
<polygon
role="presentation"
points="0,0 23.8834,3.21052 37.2438,19.0101 45.9665,16.6324 50.5,22 45,22 44.0315,26.3689 26.4673,39.3424 27.4527,45.2132 17.655,53 23.6751,22.7086"
/>
</svg>
</a>
<!-- Package Name -->
</div>
<form id="module-search-form">
<input
id="module-search"
aria-labelledby="search-label"
type="text"
placeholder="Search"
role="combobox"
aria-autocomplete="list"
aria-expanded="false"
aria-controls="search-type-ahead"
/>
<label for="module-search" id="search-label"
>(press
<span id="search-shortcut-key" aria-hidden="true">s</span
>)</label
>
<!-- Magnifying Glass icon -->
<svg
version="1.1"
xmlns="http://www.w3.org/2000/svg"
class="search-icon"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="24px"
height="24px"
viewBox="0 0 512 512"
xml:space="preserve"
>
<g>
<path
d="M449.803,62.197C408.443,20.807,353.85-0.037,299.646-0.006C245.428-0.037,190.85,20.807,149.49,62.197
C108.1,103.557,87.24,158.15,87.303,212.338c-0.047,37.859,10.359,75.766,30.547,109.359L15.021,424.525
c-20.016,20.016-20.016,52.453,0,72.469c20,20.016,52.453,20.016,72.453,0L190.318,394.15
c33.578,20.203,71.5,30.594,109.328,30.547c54.203,0.047,108.797-20.797,150.156-62.188
c41.375-41.359,62.234-95.938,62.188-150.172C512.053,158.15,491.178,103.557,449.803,62.197z M391.818,304.541
c-25.547,25.531-58.672,38.125-92.172,38.188c-33.5-0.063-66.609-12.656-92.188-38.188c-25.531-25.578-38.125-58.688-38.188-92.203
c0.063-33.484,12.656-66.609,38.188-92.172c25.578-25.531,58.688-38.125,92.188-38.188c33.5,0.063,66.625,12.656,92.188,38.188
c25.531,25.563,38.125,58.688,38.188,92.172C429.959,245.854,417.365,278.963,391.818,304.541z"
></path>
</g>
</svg>
<ul
id="search-type-ahead"
role="listbox"
aria-label="Search Results"
class="hidden"
>
<!-- Search Type Ahead -->
</ul>
</form>
</header>
<div class="header-end-extension">
<!-- if the window gets big, this extends the purple bar on the top header to the right edge of the window -->
</div>
<main>
<!-- Module Docs -->
</main>
<footer>
<p>Made by people who like to make nice things.</p>
</footer>
</body>
</html>

View file

@ -27,7 +27,64 @@
let searchForm = document.getElementById("module-search-form");
let topSearchResultListItem = undefined;
// Hide the results whenever anyone clicks outside the search results.
window.addEventListener("click", function(event) {
if (!searchForm?.contains(event.target)) {
searchTypeAhead.classList.add("hidden");
}
});
if (searchBox != null) {
function searchKeyDown(event) {
switch (event.key) {
case "ArrowDown": {
event.preventDefault();
const focused = document.querySelector("#search-type-ahead > li:not([class*='hidden']) > a:focus");
// Find the next element to focus.
let nextToFocus = focused?.parentElement?.nextElementSibling;
while (nextToFocus != null && nextToFocus.classList.contains("hidden")) {
nextToFocus = nextToFocus.nextElementSibling;
}
if (nextToFocus == null) {
// If none of the links were focused, focus the first one.
// Also if we've reached the last one in the list, wrap around to the first.
document.querySelector("#search-type-ahead > li:not([class*='hidden']) > a")?.focus();
} else {
nextToFocus.querySelector("a").focus();
}
break;
}
case "ArrowUp": {
event.preventDefault();
const focused = document.querySelector("#search-type-ahead > li:not([class*='hidden']) > a:focus");
// Find the next element to focus.
let nextToFocus = focused?.parentElement?.previousElementSibling;
while (nextToFocus != null && nextToFocus.classList.contains("hidden")) {
nextToFocus = nextToFocus.previousElementSibling;
}
if (nextToFocus == null) {
// If none of the links were focused, or we're at the first one, focus the search box again.
searchBox?.focus();
} else {
// If one of the links was focused, focus the previous one
nextToFocus.querySelector("a").focus();
}
break;
}
}
}
searchForm.addEventListener("keydown", searchKeyDown);
function search() {
topSearchResultListItem = undefined;
let text = searchBox.value.toLowerCase(); // Search is case-insensitive.
@ -46,11 +103,7 @@
?.textContent?.toLowerCase()
?.replace(/\s+/g, "");
if (
totalResults < 5 &&
(entryName.includes(text) ||
entrySignature?.includes(text.replace(/\s+/g, "")))
) {
if ((entryName.includes(text) || entrySignature?.includes(text.replace(/\s+/g, "")))) {
totalResults++;
entry.classList.remove("hidden");
if (topSearchResultListItem === undefined) {
@ -88,30 +141,28 @@
// Capture '/' keypress for quick search
window.addEventListener("keyup", (e) => {
if (e.key === "s" && document.activeElement !== searchBox) {
e.preventDefault;
e.preventDefault();
searchBox.focus();
searchBox.value = "";
}
if (e.key === "Escape" && document.activeElement === searchBox) {
e.preventDefault;
// De-focus input box
if (e.key === "Escape") {
if (document.activeElement === searchBox) {
// De-focus and clear input box
searchBox.value = "";
searchBox.blur();
} else if (
e.key === "Escape" &&
searchTypeAhead.contains(document.activeElement)
) {
e.preventDefault;
} else {
// Hide the search results
searchTypeAhead.classList.add("hidden");
// De-focus type ahead
searchBox.focus();
searchBox.blur();
if (searchTypeAhead.contains(document.activeElement)) {
searchBox.focus();
}
}
}
});
}
const isTouchSupported = () => {
try {
document.createEvent("TouchEvent");

View file

@ -180,6 +180,7 @@ main {
max-width: 740px;
/* necessary for text-overflow: ellipsis to work in descendants */
min-width: 0;
overflow-x: auto;
/* fixes issues with horizonatal scroll in cases where word is too long,
like in one of the examples at https://www.roc-lang.org/builtins/Num#Dec */
overflow-wrap: break-word;
@ -241,7 +242,7 @@ padding: 0px 16px;
width: 100%;
}
.top-header-extension {
.header-start-extension {
grid-column-start: before-sidebar;
grid-column-end: sidebar;
grid-row-start: top-header;
@ -249,6 +250,14 @@ padding: 0px 16px;
background-color: var(--violet-bg);
}
.header-end-extension {
grid-column-start: end;
grid-column-end: end;
grid-row-start: top-header;
grid-row-end: top-header;
background-color: var(--violet-bg);
}
.top-header {
grid-column-start: sidebar;
grid-column-end: end;
@ -262,21 +271,11 @@ padding: 0px 16px;
font-family: var(--font-sans);
font-size: 24px;
height: 100%;
background-color: var(--violet-bg);
/* min-width must be set to something (even 0) for text-overflow: ellipsis to work in descendants, but we want this anyway. */
min-width: 1024px;
}
.top-header-triangle {
/* This used to be a clip-path, but Firefox on Android (at least as of early 2020)
* rendered the page extremely slowly in that version. With this approach it's super fast.
*/
width: 0;
height: 0;
border-style: solid;
border-width: var(--top-header-height) 0 0 48px;
border-color: transparent transparent transparent var(--violet-bg);
}
p {
overflow-wrap: break-word;
margin: 24px 0;
@ -449,7 +448,6 @@ pre>samp {
height: 100%;
background-color: var(--violet-bg);
position: relative;
max-width: 500px;
flex-grow: 1;
box-sizing: border-box;
padding: 0px var(--module-search-form-padding-width);
@ -463,6 +461,7 @@ pre>samp {
}
#module-search {
border-radius: 8px;
display: block;
position: relative;
box-sizing: border-box;
@ -481,6 +480,10 @@ pre>samp {
opacity: 1;
}
#module-search:focus, #module-search:hover {
outline: 2px solid var(--faded-color);
}
#search-type-ahead {
font-family: var(--font-mono);
display: flex;
@ -498,19 +501,39 @@ pre>samp {
border-color: var(--border-color);
list-style-type: none;
margin: 0;
padding: 10px;
padding: 0;
}
.search-icon {
fill: var(--faded-color);
pointer-events: none;
opacity: 0.6;
position: absolute;
right: 32px;
}
#search-type-ahead .type-ahead-link {
font-size: 1rem;
color: var(--text-color);
line-height: 2em;
display: inline-block;
position: relative;
box-sizing: border-box;
width: 100%;
height: 100%;
padding: 4px 8px;
max-height: 6em;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
/* if it wraps, indent after the first line */
padding-left: 2em;
padding-left: calc(2em + 8px);
text-indent: -2em;
span {
margin: 0px;
}
@ -520,32 +543,33 @@ pre>samp {
font-size: 1rem;
}
}
#search-type-ahead li {
box-sizing: border-box;
padding: 4px;
position: relative;
}
/*use browser defaults for focus outline*/
#search-type-ahead li:focus-within {
/*firefox*/
outline: 5px auto Highlight;
/*chrome and safari*/
outline: 5px auto -webkit-focus-ring-color;
}
.type-ahead-link:focus-visible {
#search-type-ahead a:focus {
outline: none;
background: var(--violet-bg);
}
#search-link {
box-sizing: border-box;
#module-search-form:focus-within #search-label, #module-search-form:focus-within .search-icon {
display: none;
}
#search-label {
color: var(--faded-color);
box-sizing: border-box;
align-items: center;
font-size: 18px;
line-height: 18px;
padding: 12px 16px;
height: 48px;
cursor: pointer;
pointer-events: none;
position: absolute;
top: 12px;
left: 96px;
}
#search-shortcut-key {
@ -556,22 +580,7 @@ pre>samp {
font-style: normal;
line-height: 15px;
opacity: 0.6;
position: absolute;
right: 30px;
}
#llm-prompt-container {
background-color: var(--violet-bg);
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-size: initial;
}
#llm-prompt-copy-button:hover {
border-color: var(--link-hover-color);
color: var(--link-hover-color);
pointer-events: none;
}
.builtins-tip {
@ -580,6 +589,22 @@ pre>samp {
line-height: 1.3em;
}
.module-header-container {
display: flex;
justify-content: space-between;
align-items: flex-end;
margin-bottom: 48px;
}
.llm-prompt-link {
flex-shrink: 0;
}
.module-name {
flex-grow: 1;
margin-bottom: 0;
}
@media (prefers-color-scheme: dark) {
:root {
/* WCAG AAA Compliant colors */
@ -611,11 +636,46 @@ pre>samp {
}
@media only screen and (max-device-width: 480px) and (orientation: portrait) {
body {
grid-template-areas:
"header"
"main"
"sidebar"
"footer";
}
#sidebar-nav {
grid-area: sidebar;
}
main {
grid-area: main;
}
.top-header {
grid-area: header;
}
footer {
grid-area: footer;
}
:root {
--top-header-height: 160px;
}
#search-shortcut-key {
#search-shortcut-key, .header-start-extension, .header-end-extension, #search-label {
display: none;
}
#module-search-form {
padding: 0 16px;
width: 100%;
height: auto;
margin-bottom: 16px;
}
/* Hide the Copy Link button on mobile. */
.entry-name a:first-of-type {
display: none;
}
@ -660,26 +720,17 @@ pre>samp {
font-size: 36px;
margin-top: 8px;
margin-bottom: 8px;
max-width: calc(100% - 18px);
overflow: hidden;
text-overflow: ellipsis;
}
main {
grid-column-start: none;
grid-column-end: none;
grid-row-start: above-footer;
grid-row-end: above-footer;
padding: 18px;
font-size: 16px;
max-width: none;
max-width: 480px;
}
#sidebar-nav {
grid-column-start: none;
grid-column-end: none;
grid-row-start: sidebar;
grid-row-end: sidebar;
margin-top: 0;
padding-left: 0;
width: auto;
@ -702,9 +753,6 @@ pre>samp {
body {
grid-template-columns: auto;
grid-template-rows: [top-header] var(--top-header-height) [before-sidebar] auto [sidebar] auto [above-footer] auto [footer] auto;
/* [before-sidebar] 1fr [sidebar] var(--sidebar-width) [main-content] fit-content(calc(1280px - var(--sidebar-width))) [end] 1fr; */
margin: 0;
min-width: 320px;
max-width: 100%;

View file

@ -19,7 +19,7 @@ test = false
bench = false
[dependencies]
roc_docs = { path = "../docs" }
roc_docs.workspace = true
clap.workspace = true

View file

@ -8,4 +8,4 @@ license.workspace = true
version.workspace = true
[target.'cfg(windows)'.dependencies]
widestring = { version = "1.1.0", default-features = false }
widestring.workspace = true

View file

@ -8,22 +8,22 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_build = { path = "../compiler/build" }
roc_builtins = { path = "../compiler/builtins" }
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_error_macros = { path = "../error_macros" }
roc_gen_llvm = { path = "../compiler/gen_llvm" }
roc_linker = { path = "../linker" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_mono = { path = "../compiler/mono" }
roc_packaging = { path = "../packaging" }
roc_reporting = { path = "../reporting" }
roc_std = { path = "../roc_std" }
roc_target = { path = "../compiler/roc_target" }
roc_tracing = { path = "../tracing" }
roc_types = { path = "../compiler/types" }
roc_build.workspace = true
roc_builtins.workspace = true
roc_can.workspace = true
roc_collections.workspace = true
roc_error_macros.workspace = true
roc_gen_llvm.workspace = true
roc_linker.workspace = true
roc_load.workspace = true
roc_module.workspace = true
roc_mono.workspace = true
roc_packaging.workspace = true
roc_reporting.workspace = true
roc_std.workspace = true
roc_target.workspace = true
roc_tracing.workspace = true
roc_types.workspace = true
bumpalo.workspace = true
fnv.workspace = true
@ -35,7 +35,7 @@ target-lexicon.workspace = true
tempfile.workspace = true
[dev-dependencies]
cli_test_utils = { path = "../cli_test_utils" }
cli_test_utils.workspace = true
dircpy.workspace = true
indoc.workspace = true

View file

@ -9,6 +9,5 @@ version.workspace = true
[dependencies]
html-escape = "0.2"
roc_parse = { path = "../compiler/parse" }
roc_region = { path = "../compiler/region" }
roc_parse.workspace = true
roc_region.workspace = true

View file

@ -12,26 +12,31 @@ expect-test = "1.4.1"
[dependencies]
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_fmt = { path = "../compiler/fmt" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_parse = { path = "../compiler/parse" }
roc_problem = { path = "../compiler/problem" }
roc_region = { path = "../compiler/region" }
roc_reporting = { path = "../reporting" }
roc_solve_problem = { path = "../compiler/solve_problem" }
roc_target = { path = "../compiler/roc_target" }
roc_types = { path = "../compiler/types" }
roc_packaging = {path = "../packaging"}
roc_can.workspace = true
roc_collections.workspace = true
roc_fmt.workspace = true
roc_load.workspace = true
roc_module.workspace = true
roc_parse.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_reporting.workspace = true
roc_solve_problem.workspace = true
roc_target.workspace = true
roc_types.workspace = true
roc_packaging.workspace = true
bumpalo.workspace = true
parking_lot.workspace = true
tower-lsp = "0.17.0"
tokio = { version = "1.20.1", features = [ "rt", "rt-multi-thread", "macros", "io-std" ] }
tokio = { version = "1.20.1", features = [
"rt",
"rt-multi-thread",
"macros",
"io-std",
] }
log.workspace = true
indoc.workspace=true
indoc.workspace = true
env_logger = "0.10.1"
futures.workspace = true

View file

@ -13,15 +13,15 @@ name = "roc_linker"
path = "src/lib.rs"
[dependencies]
roc_collections = { path = "../compiler/collections" }
roc_error_macros = { path = "../error_macros" }
roc_module = { path = "../compiler/module" }
roc_load = { path = "../compiler/load" }
roc_mono = { path = "../compiler/mono" }
roc_packaging = { path = "../packaging" }
roc_reporting = { path = "../reporting" }
roc_solve = { path = "../compiler/solve" }
roc_target = { path = "../compiler/roc_target" }
roc_collections.workspace = true
roc_error_macros.workspace = true
roc_module.workspace = true
roc_load.workspace = true
roc_mono.workspace = true
roc_packaging.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_target.workspace = true
bincode.workspace = true
bumpalo.workspace = true

View file

@ -9,8 +9,8 @@ repository.workspace = true
version.workspace = true
[dependencies]
roc_error_macros = { path = "../error_macros" }
roc_parse = { path = "../compiler/parse" }
roc_error_macros.workspace = true
roc_parse.workspace = true
base64-url.workspace = true
blake3.workspace = true

View file

@ -15,23 +15,23 @@ target-x86 = ["roc_build/target-x86"]
target-x86_64 = ["roc_build/target-x86_64"]
[dependencies]
roc_build = { path = "../compiler/build" }
roc_builtins = { path = "../compiler/builtins" }
roc_bitcode = { path = "../compiler/builtins/bitcode" }
roc_collections = { path = "../compiler/collections" }
roc_gen_llvm = { path = "../compiler/gen_llvm" }
roc_gen_dev = { path = "../compiler/gen_dev" }
roc_load = { path = "../compiler/load" }
roc_mono = { path = "../compiler/mono" }
roc_parse = { path = "../compiler/parse" }
roc_region = { path = "../compiler/region" }
roc_repl_eval = { path = "../repl_eval" }
roc_reporting = { path = "../reporting" }
roc_std = { path = "../roc_std" }
roc_target = { path = "../compiler/roc_target" }
roc_types = { path = "../compiler/types" }
roc_error_macros = { path = "../error_macros" }
roc_repl_ui = { path = "../repl_ui" }
roc_build.workspace = true
roc_builtins.workspace = true
roc_bitcode.workspace = true
roc_collections.workspace = true
roc_gen_llvm.workspace = true
roc_gen_dev.workspace = true
roc_load.workspace = true
roc_mono.workspace = true
roc_parse.workspace = true
roc_region.workspace = true
roc_repl_eval.workspace = true
roc_reporting.workspace = true
roc_std.workspace = true
roc_target.workspace = true
roc_types.workspace = true
roc_error_macros.workspace = true
roc_repl_ui.workspace = true
tempfile.workspace = true
bumpalo.workspace = true

View file

@ -8,21 +8,21 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_builtins = { path = "../compiler/builtins" }
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_fmt = { path = "../compiler/fmt" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_mono = { path = "../compiler/mono" }
roc_packaging = { path = "../packaging" }
roc_parse = { path = "../compiler/parse" }
roc_problem = { path = "../compiler/problem" }
roc_region = { path = "../compiler/region" }
roc_reporting = { path = "../reporting" }
roc_solve = { path = "../compiler/solve" }
roc_std = { path = "../roc_std" }
roc_target = { path = "../compiler/roc_target" }
roc_types = { path = "../compiler/types" }
roc_builtins.workspace = true
roc_can.workspace = true
roc_collections.workspace = true
roc_fmt.workspace = true
roc_load.workspace = true
roc_module.workspace = true
roc_mono.workspace = true
roc_packaging.workspace = true
roc_parse.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_std.workspace = true
roc_target.workspace = true
roc_types.workspace = true
bumpalo.workspace = true

View file

@ -8,23 +8,23 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_build = { path = "../compiler/build" }
roc_builtins = { path = "../compiler/builtins" }
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_error_macros = { path = "../error_macros" }
roc_gen_llvm = { path = "../compiler/gen_llvm" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_mono = { path = "../compiler/mono" }
roc_packaging = { path = "../packaging" }
roc_parse = { path = "../compiler/parse" }
roc_region = { path = "../compiler/region" }
roc_repl_eval = { path = "../repl_eval" }
roc_reporting = { path = "../reporting" }
roc_std = { path = "../roc_std" }
roc_target = { path = "../compiler/roc_target" }
roc_types = { path = "../compiler/types" }
roc_build.workspace = true
roc_builtins.workspace = true
roc_can.workspace = true
roc_collections.workspace = true
roc_error_macros.workspace = true
roc_gen_llvm.workspace = true
roc_load.workspace = true
roc_module.workspace = true
roc_mono.workspace = true
roc_packaging.workspace = true
roc_parse.workspace = true
roc_region.workspace = true
roc_repl_eval.workspace = true
roc_reporting.workspace = true
roc_std.workspace = true
roc_target.workspace = true
roc_types.workspace = true
bumpalo.workspace = true
inkwell.workspace = true
@ -33,8 +33,7 @@ libloading.workspace = true
target-lexicon.workspace = true
[dev-dependencies]
roc_build = { path = "../compiler/build", features = ["target-aarch64", "target-x86_64"] }
roc_build = { workspace = true, features = ["target-aarch64", "target-x86_64"] }
indoc.workspace = true
pretty_assertions.workspace = true
strip-ansi-escapes.workspace = true

View file

@ -8,16 +8,16 @@ license.workspace = true
version.workspace = true
[build-dependencies]
roc_cli = { path = "../cli" }
roc_cli.workspace = true
[dev-dependencies]
roc_build = { path = "../compiler/build" }
roc_repl_cli = { path = "../repl_cli" }
roc_repl_ui = { path = "../repl_ui" }
roc_test_utils = { path = "../test_utils" }
roc_wasm_interp = { path = "../wasm_interp" }
roc_reporting = { path = "../reporting" }
roc_target = { path = "../compiler/roc_target" }
roc_build.workspace = true
roc_repl_cli.workspace = true
roc_repl_ui.workspace = true
roc_test_utils.workspace = true
roc_wasm_interp.workspace = true
roc_reporting.workspace = true
roc_target.workspace = true
bumpalo.workspace = true
indoc.workspace = true
@ -35,7 +35,13 @@ target-x86 = ["roc_build/target-x86", "roc_repl_cli/target-x86"]
target-x86_64 = ["roc_build/target-x86_64", "roc_repl_cli/target-x86_64"]
wasm = ["target-wasm32"]
target-all = ["target-aarch64", "target-arm", "target-x86", "target-x86_64", "target-wasm32"]
target-all = [
"target-aarch64",
"target-arm",
"target-x86",
"target-x86_64",
"target-wasm32",
]
[package.metadata.cargo-udeps.ignore]
development = ["roc_wasm_interp"]
development = ["roc_wasm_interp"]

View file

@ -8,13 +8,13 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../compiler/collections" }
roc_load = { path = "../compiler/load" }
roc_parse = { path = "../compiler/parse" }
roc_region = { path = "../compiler/region" }
roc_repl_eval = { path = "../repl_eval" }
roc_reporting = { path = "../reporting" }
roc_target = { path = "../compiler/roc_target" }
roc_collections.workspace = true
roc_load.workspace = true
roc_parse.workspace = true
roc_region.workspace = true
roc_repl_eval.workspace = true
roc_reporting.workspace = true
roc_target.workspace = true
bumpalo.workspace = true
const_format.workspace = true

View file

@ -11,9 +11,9 @@ version = "0.0.1"
crate-type = ["cdylib"]
[build-dependencies]
roc_bitcode = { path = "../compiler/builtins/bitcode" }
roc_builtins = { path = "../compiler/builtins" }
wasi_libc_sys = { path = "../wasi-libc-sys" }
roc_bitcode.workspace = true
roc_builtins.workspace = true
wasi_libc_sys.workspace = true
tempfile.workspace = true
@ -21,21 +21,23 @@ tempfile.workspace = true
bumpalo.workspace = true
console_error_panic_hook = { workspace = true, optional = true }
futures = { workspace = true, optional = true }
getrandom = { version = "0.2", features = ["js"] } # not a direct dependency, needed because of https://docs.rs/getrandom/latest/getrandom/#webassembly-support
getrandom = { version = "0.2", features = [
"js",
] } # not a direct dependency, needed because of https://docs.rs/getrandom/latest/getrandom/#webassembly-support
js-sys.workspace = true
wasm-bindgen-futures.workspace = true
wasm-bindgen.workspace = true
roc_collections = { path = "../compiler/collections" }
roc_gen_wasm = { path = "../compiler/gen_wasm" }
roc_load = { path = "../compiler/load" }
roc_parse = { path = "../compiler/parse" }
roc_repl_eval = { path = "../repl_eval" }
roc_repl_ui = { path = "../repl_ui" }
roc_reporting = { path = "../reporting" }
roc_solve = { path = "../compiler/solve" }
roc_target = { path = "../compiler/roc_target" }
roc_types = { path = "../compiler/types" }
roc_collections.workspace = true
roc_gen_wasm.workspace = true
roc_load.workspace = true
roc_parse.workspace = true
roc_repl_eval.workspace = true
roc_repl_ui.workspace = true
roc_reporting.workspace = true
roc_solve.workspace = true
roc_target.workspace = true
roc_types.workspace = true
[features]
wasi_test = ["futures"]

View file

@ -8,20 +8,20 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_error_macros = { path = "../error_macros" }
roc_exhaustive = { path = "../compiler/exhaustive" }
roc_fmt = { path = "../compiler/fmt" }
roc_module = { path = "../compiler/module" }
roc_parse = { path = "../compiler/parse" }
roc_packaging = { path = "../packaging" }
roc_problem = { path = "../compiler/problem" }
roc_region = { path = "../compiler/region" }
roc_solve_problem = { path = "../compiler/solve_problem" }
roc_std = { path = "../roc_std" }
roc_types = { path = "../compiler/types" }
ven_pretty = { path = "../vendor/pretty" }
roc_can.workspace = true
roc_collections.workspace = true
roc_error_macros.workspace = true
roc_exhaustive.workspace = true
roc_fmt.workspace = true
roc_module.workspace = true
roc_parse.workspace = true
roc_packaging.workspace = true
roc_problem.workspace = true
roc_region.workspace = true
roc_solve_problem.workspace = true
roc_std.workspace = true
roc_types.workspace = true
ven_pretty.workspace = true
byte-unit = "4.0.19"
itertools = "0.10.5"

View file

@ -9,5 +9,5 @@ repository = "https://github.com/roc-lang/roc"
version = "0.0.1"
[dependencies]
roc_std = { path = "../roc_std" }
memmap2 = "=0.9.4"
roc_std.workspace = true
memmap2 = "=0.9.4" # should this be a workspace dependency? workspace is at "0.5.10"

View file

@ -8,23 +8,21 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_builtins = { path = "../compiler/builtins" }
roc_derive = { path = "../compiler/derive", features = [
"debug-derived-symbols",
] }
roc_region = { path = "../compiler/region" }
roc_collections = { path = "../compiler/collections" }
roc_load = { path = "../compiler/load" }
roc_parse = { path = "../compiler/parse" }
roc_can = { path = "../compiler/can" }
roc_module = { path = "../compiler/module" }
roc_types = { path = "../compiler/types" }
roc_problem = { path = "../compiler/problem" }
roc_constrain = { path = "../compiler/constrain" }
roc_reporting = { path = "../reporting" }
roc_target = { path = "../compiler/roc_target" }
roc_solve = { path = "../compiler/solve" }
roc_solve_problem = { path = "../compiler/solve_problem" }
roc_builtins.workspace = true
roc_derive = { workspace = true, features = ["debug-derived-symbols"] }
roc_region.workspace = true
roc_collections.workspace = true
roc_load.workspace = true
roc_parse.workspace = true
roc_can.workspace = true
roc_module.workspace = true
roc_types.workspace = true
roc_problem.workspace = true
roc_constrain.workspace = true
roc_reporting.workspace = true
roc_target.workspace = true
roc_solve.workspace = true
roc_solve_problem.workspace = true
roc_specialize_types.workspace = true
bumpalo.workspace = true

View file

@ -7,14 +7,14 @@ license.workspace = true
version.workspace = true
[dev-dependencies]
cli_test_utils = { path = "../cli_test_utils" }
roc_command_utils = { path = "../utils/command" }
roc_build = { path = "../compiler/build" }
roc_linker = { path = "../linker" }
roc_load = { path = "../compiler/load" }
roc_mono = { path = "../compiler/mono" }
roc_packaging = { path = "../packaging" }
roc_reporting = { path = "../reporting" }
cli_test_utils.workspace = true
roc_command_utils.workspace = true
roc_build.workspace = true
roc_linker.workspace = true
roc_load.workspace = true
roc_mono.workspace = true
roc_packaging.workspace = true
roc_reporting.workspace = true
bumpalo.workspace = true
indoc.workspace = true

View file

@ -13,4 +13,4 @@ readme = "README.md"
edition = "2018"
[dependencies]
roc_collections = { path = "../../compiler/collections" }
roc_collections.workspace = true

View file

@ -9,4 +9,4 @@ repository.workspace = true
version.workspace = true
[build-dependencies]
roc_command_utils = { path = "../utils/command" }
roc_command_utils.workspace = true

View file

@ -12,8 +12,7 @@ name = "roc_wasm_interp"
path = "src/main.rs"
[dependencies]
roc_wasm_module = { path = "../wasm_module" }
roc_wasm_module.workspace = true
bitvec.workspace = true
bumpalo.workspace = true
clap.workspace = true

View file

@ -8,7 +8,6 @@ license.workspace = true
version.workspace = true
[dependencies]
roc_error_macros = { path = "../error_macros" }
roc_error_macros.workspace = true
bitvec.workspace = true
bumpalo.workspace = true

View file

@ -9,8 +9,7 @@ version.workspace = true
[dependencies]
[dev-dependencies]
cli_test_utils = { path = "../cli/cli_test_utils" }
cli_test_utils.workspace = true
criterion-perf-events.workspace = true
criterion.workspace = true
perfcnt.workspace = true

View file

@ -44,7 +44,7 @@ Once you've installed <code>roc</code>, check out the [tutorial](/tutorial) to l
<a class="btn-small" href="/tutorial">Start Tutorial</a>
### [Additional Learning Resources] {#additional-learning-resources}
### [Additional Learning Resources](#additional-learning-resources) {#additional-learning-resources}
If you are looking for more resources to learn about Roc, check out the following:

View file

@ -2333,11 +2333,11 @@ Here are various Roc expressions involving operators, and what they desugar to.
| `f!` | [see example](https://www.roc-lang.org/examples/DesugaringAwait/README.html) |
| `f?` | [see example](https://www.roc-lang.org/examples/DesugaringTry/README.html) |
</section>
<script type="text/javascript" src="/builtins/search.js" defer></script>
### [Additional Resources]
### [Additional Resources](#additional-resources) {#additional-resources}
You've completed the tutorial, well done!
If you are looking for more resources to learn Roc, check out [these links](/install#additional-learning-resources).
</section>
<script type="text/javascript" src="/builtins/search.js" defer></script>