1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-30 05:42:26 +03:00
juvix/tests/Rust/Compilation/positive/test058.juvix
Łukasz Czajka fcd52a443f
Improve specialization optimization (#2944)
* Specialization has become less effective after recent changes to the
codebase. This PR fixes issues with specialization.
* Closes #2939 
* Closes #2945 

Checklist
---------
- [X] Preserve pragmas for letrec and lambda in Stored Core
- [x] Remove the assumption that all type variables are at the front
(closes #2945)
- [x] Allow specialization when the argument is a constructor
application
- [x] Make renaming adjust pragmas
- [x] Allow pragmas for fields in record definitions (closes #2939)
- [x] Update standard library pragmas
- [x] Fix JuvixTree printing
2024-08-14 10:04:30 +02:00

13 lines
230 B
Plaintext

-- ranges
module test058;
import Stdlib.Prelude open;
sum (x : Nat) : Nat :=
for (acc := 0) (n in 1 to x) {acc + n};
sum' (x : Nat) : Nat :=
for (acc := 0) (n in 1 to x step 2) {acc + n};
main : Nat := sum 100 + sum' 100;