mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
![]() Now, when we have two aliases like ``` T a : [ A, B (U a) ] U a : [ C, D (T a) ] ``` during the first pass, we simply canonicalize them but add neither to the scope. This means that `T` will not be instantiated in the definition of `U`. Only in the second pass, during correction, do we instantiate both aliases **independently**: ``` T a : [ A, B [ C, D (T a) ] ] U a : [ C, D [ A, B (U a) ] ] ``` and now we can mark each recursive, individually: ``` T a : [ A, B [ C, D <rec1> ] ] as <rec1> U a : [ C, D [ A, B <rec2> ] ] as <rec2> ``` This means that the surface types shown to users might be a bit larger, but it has the benefit that everything needed to understand a layout of a type in later passes is stored on the type directly, and we don't need to keep alias mappings. Since we sort by connected components, this should be complete. Closes #2458 |
||
---|---|---|
.. | ||
src | ||
build.rs | ||
Cargo.toml | ||
README.md |
Running our CodeGen tests
Our code generation tests are all in this crate. Feature flags are used to run the tests with a specific backend. For convenience, some aliases are added in .cargo/config
:
[alias]
test-gen-llvm = "test -p test_gen"
test-gen-dev = "test -p test_gen --no-default-features --features gen-dev"
test-gen-wasm = "test -p test_gen --no-default-features --features gen-wasm"
So we can run:
cargo test-gen-llvm
To run the gen tests with the LLVM backend. To filter tests, append a filter like so:
> cargo test-gen-wasm wasm_str::small
Finished test [unoptimized + debuginfo] target(s) in 0.13s
Running src/tests.rs (target/debug/deps/test_gen-b4ad63a9dd50f050)
running 2 tests
test wasm_str::small_str_literal ... ok
test wasm_str::small_str_zeroed_literal ... ok