1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-25 16:45:20 +03:00
Commit Graph

507 Commits

Author SHA1 Message Date
Łukasz Czajka
7db74442d4
Hoisting of loop-invariant subexpressions (#3195)
* Closes #3028 
* Detects fully-applied expressions of the form
```
f a (\{ x1 .. xk := body }) a'
```
where `f` is a recursive function which does not modify its function
argument (the one for which a lambda is provided), i.e., passes it to
recursive invocations unchanged (it's the second argument in the above
example). A function `f` satisfying this requirement implements some
kind of loop with the lambda-expression usually being the loop body /
action.

Let e.g. `body = g x1 .. xk b1 b2` where `b1`, `b2` do not contain any
variables bound in the lambda (`x1`,..,`xk`). If `b1`, `b2` are
non-trivial (require computation), then these loop-invariant
subexpressions are hoisted outside of the loop, obtaining:
```
let 
  y1 := b1;
  y2 := b2;
in
f a (\{ x1 .. xk := g x1 .. xk y1 y2) a'
```
* Adds a volatility info in Core which prevents the lets created by
loop-invariant expression hoisting from being folded back.
* Removes potential duplication in the specialization optimization.
* Adds another optimization phase before lambda-lifting where hoisting
of loop-invariant subexpressions is performed. This allows to reduce the
number of iterations in the main optimization phase after
lambda-lifting.
2024-12-03 11:21:09 +01:00
Paul Cadman
9210e39dc7
Enable Anoma compilation resource machine builtin tests (#3208)
This PR:

* Updates the anomalib nock stdlib to the latest head of
`artem/juvix-node-integration-v0.28` containing the latest testnet
fixes.
* Re-enables the Anoma resource machine builtins tests
2024-12-02 14:09:55 +01:00
Łukasz Czajka
ad0333467b
Fix aliases to non-recursive names (#3203)
* Closes #3201 
* As a side effect, aliases can now only be used after they are declared
(but they can still forward-reference identifiers, except the
non-recursive definitions or other aliases).
2024-12-01 11:20:10 +01:00
Jan Mas Rovira
f34309658a
Allow punning in record updates (#3125)
Now it is allowed to use field puns in record updates. E.g.
```
type R :=
  mkR@{
    a : Nat;
    b : Nat;
    c : Nat;
  };

example : R :=
  let
    z :=
      mkR@{
        a := 0;
        b := 0;
        c := 0;
      };
    a := 6;
  in z@R{a} -- the field `a` is updated to 6
```
2024-11-29 13:05:39 +01:00
Paul Cadman
cc263e7a39
Add a new Anoma compile test mode 'AnomaTestModeNodeOnly' (#3196)
This mode is for tests that must run on the Anoma Node / Client. These
tests contain calls that are crashes in AnomaLib nock file and must
therefore be jetted.

With this changed the contents of test085 (resource machine builtins)
can be uncommnented. However it currently fails, unexpectedly on the
node.
2024-11-28 17:26:36 +00:00
Jan Mas Rovira
c64420efe8
Deriving Ord (#3184)
Allows automatic derivation of `Ord` instances. It generates a
lexicographical order equivalent to the one defined by Haskell's stock
deriving.
2024-11-28 11:21:18 +01:00
Paul Cadman
f916c0a95a
Update Anoma client to testnet-v1 release (#3190)
This PR makes changes to make our Anoma client CLI commands compatible
with the https://github.com/anoma/anoma/tree/testnet-01 branch.

We must now capture the Anoma client node_id on start because some
endpoints (e.g mempool submit) require this node id in the request.

I'm using
[Effectful.Environment](https://hackage.haskell.org/package/effectful-2.5.0.0/docs/Effectful-Environment.html)
to interact with environment variables as it avoids use of `IOE`.

In a separate PR we should replace all usages of `System.Environment`
with `Effectful.Environment` but I've left existing usages of
`System.Environment` in place for the time being.
2024-11-25 18:28:24 +01:00
Łukasz Czajka
3c74c3700c
Allow pattern-matching in variable definitions (#3181)
* Closes #3118 
* Allows patterns on the left-hand sides of definitions. To avoid
clashes with constructor names, the patterns need to be enclosed in
parentheses or have the form `n@...`. A standalone symbol `x` in a
definition `x := ...` is always interpreted as an identifier even if
there exists a constructor `x`.
* Left-hand side patterns are desugared in the translation from Concrete
to Internal. If the inductive type has more than one constructor,
non-exhaustive pattern matching error will later be given by the pattern
matching compiler.

---------

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2024-11-25 10:27:53 +01:00
Jan Mas Rovira
c100812cd0
Add deriving for Eq (#3176)
This pr adds automatic implementation of `Eq` instances for inductive
types. To create such an instance the user will use the same syntax as a
regular instance with two differences.
1. It is prefixed with the `deriving` keyword.
2. It has no body.

E.g. 
```
deriving instance
eqProductI {A B} {{Eq A}} {{Eq B}} : Eq (Pair A B);
```

This desugars into an instance that returns true when the constructors
match and all arguments are equal according to their respective
instances. There is no special handling of type errors occurring in the
generated code. I.e. if the user forgets a necessary instance argument
in the type signature, a type error will occur in the generated code.

## Stdlib PR
- https://github.com/anoma/juvix-stdlib/pull/148

# Future work
* In the future we should look at
https://www.dreixel.net/research/pdf/gdmh_nocolor.pdf
* See also:
https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/generic-deriving

---------

Co-authored-by: Lukasz Czajka <lukasz@heliax.dev>
2024-11-22 13:13:26 +01:00
Łukasz Czajka
2e38aa609f
Unify type signature declaration syntax (#3178)
* Closes #2990 
* Allows type signatures for constructors, record fields and axioms to
have the same form as in function definitions, e.g.,
```
field {A} {{M A}} (arg1 arg2 : A) : List A
```
* For constructors, this introduces an ambiguity between record and GADT
syntax with names. For example,
```
ctr {
  A : Type
}
```
can be confused by the parser with initial part of GADT type signature:
```
ctr {A : Type} : A -> C A
```
For now, this is resolved by preferring the record syntax. Hence, it's
currently not possible to use type signatures with implicit arguments
for constructors. Ultimately, the `@` in record syntax should be made
mandatory, which would resolve the ambiguity:
```
ctr@{
  A : Type
}
```

---------

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2024-11-20 15:57:15 +00:00
Paul Cadman
eab02a77da
Remove GetAnomaProcess from the Anoma effect (#3179)
This PR removes `GetAnomaProcess` from the Anoma effect.

Use the `launchAnoma` function to start a persistent Anoma client /
server (used by `juvix dev anoma node`).

Other changes:

* It's no longer necessary to pass the protobuf files to `grpcurl`
because the Anoma client now supports gRPC reflection.
* We pass the elixir start command to `mix` via `-e` argument instead of
using a temporary file.

The purpose for this change is that we I want to add an interpreter for
Anoma that makes gRPC calls to an exisitng Anoma client.
`GetAnomaProcess` has no meaning for this interpreter.
2024-11-19 17:34:13 +00:00
Łukasz Czajka
5f803ec6c2
Named arguments for record projections (#3173)
* Closes #3054
* Adds named argument signatures for generated record projections.
2024-11-15 18:25:49 +01:00
Łukasz Czajka
9f25ffde16
Detect termination for nested local definitions (#3169)
* Closes #3147 

When we call a function that is currently being defined (there may be
several such due to nested local definitions), we add a reflexive edge
in the call map instead of adding an edge from the most nested
definition. For example, for

```juvix
go {A B} (f : A -> B) : List A -> List B
  | nil := nil
  | (elem :: next) :=
    let var1 := f elem;
        var2 := go f next;
    in var1 :: var2;
```

we add an edge from `go` to the recursive call `go f next`, instead of
adding an edge from `var2` to `go f next` as before.

This makes the above type-check.

The following still doesn't type-check, because `next'` is not a
subpattern of the clause pattern of `go`. But this is a less pressing
problem.

```juvix
go {A B} (f : A -> B) : List A -> List B
  | nil := nil
  | (elem :: next) :=
    let var1 := f elem;
        var2 (next' : List A) : List B := go f next';
    in myCons var1 (var2 next);
```
2024-11-15 12:30:18 +01:00
Jan Mas Rovira
1d7bf1f25b
Fix compiler error on import cycles (#3171)
- Fixes #3161 

The strongly connected components given in [this
function](https://hackage.haskell.org/package/containers-0.7/docs/Data-Graph.html#v:stronglyConnComp)
are not guaranteed to give a cycle in the order they are given. I've
fixed that
2024-11-15 09:41:02 +01:00
Paul Cadman
49c14be71e
Fix nock compilation and builtin evaluation of sha256 stdilb (#3175)
This PR:

1. Fixes the compilation of the sha256 builtin anoma lib call

A sha256 hash is 32 bytes long, not 64 bytes. This number is used when
constructing the ByteArray representation (i.e `[length payload]` cell)
of the output of Anoma stdlib sha256 call. The Anoma stdlib sha256 call
just returns the atom payload.

2. Fixes the evaluation of the sha256 stdlib call

Previously we were converting the sha256 hash bytestring to Base16
format. This is convenient when displaying the ByteString hash. However
the Anoma nock interpreter outputs the raw bytes so we must change the
builtin evaluator to match this behaviour.

After these fixes we can re-enable the test084 anoma compilation test.
2024-11-14 18:54:39 +01:00
Paul Cadman
29041dcb32
Launch the Anoma node and client from the elixir REPL (#3172)
This PR changes how we launch the Anoma Client to avoid a bug with
linking cryptographic APIs.

libsodium cryptographic APIs like sign-detached cannot currently be
called from within the Anoma node or client binaries. Until this is
solved we must start both the node and client from the elixir REPL.
Previously we were starting the node using the REPL and the client using
the binary.

This commit changes the `start.exs` script we were using to start the
node to now start both a node and a client.

After this change we can enable Anoma compilation test `test077`.

The output of `juvix dev anoma node --anoma-dir ANOMA_DIR` is now:

```
Anoma node and client successfully started
Listening on port 51748
```
2024-11-14 09:10:00 +01:00
Jan Mas Rovira
200daad1dc
Fix bug in ComputeTypeInfo for let (#3158)
- Fixes #3030 

The `ComputeTypeInfo` transformation was incorrectly assuming that the
type of the body couldn't refer to the let item. When inferring the type
of a let, we now inline the let item(s) into the type of the body.

```
NLet Let {..} ->
   let bodyTy = Info.getNodeType _letBody
   in subst (_letItem ^. letItemValue) bodyTy
```
2024-11-12 16:44:25 +01:00
Jan Mas Rovira
ca56b6b0cd
Support traces in the anoma node (#3152)
This pr adds support for getting traces from the anoma node.
I've updated the test suite so that tests that were disabled because of
traces are now being run.
There are a few tests that require atention:
1. `test028`: Gives the wrong answer.
2. `test084`: Gives the wrong answer.
4. `test074`: Expected to fail because it uses scry.
5. `test086`: Expected to fail because Anoma representation of prngs is
different than the juvix representation.
2024-11-08 11:54:17 +00:00
Paul Cadman
6ed5e136b6
Add option to run Anoma tests in non-debug mode (#3144)
> ⚠️ Based on https://github.com/anoma/juvix/pull/3142

When using AnomaTestModeFull the compilation tests are run in debug
mode, with stdlib interception and run using the raw nock (without
stdlib interception).

---------

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2024-11-07 13:11:41 +00:00
Paul Cadman
2a463a00a2
Fix StdlibRandomNextBytes call (#3150)
The hoon code that generates the stdlib call is:


1a8b632463/src/Juvix/Compiler/Nockma/AnomaLib.hs (L101)

i.e the random number generator is the first argument and the width is
the second argument. We have the arguments transposed in the
corresponding Juvix builtin API so the call was failing.

This PR transposes the argumetns in the stdlib call so the builtin API
and hoon generated nock code are compatible.
2024-11-07 09:05:13 +01:00
Jan Mas Rovira
4cdcb2f747
Add anoma nockma tests (#3134)
* Fixes a bug in calling Anoma stdlib from Nock code
* Runs the anoma compilation test with the anoma node nockma evaluator.

I've classified the tests in 4 categories:
1. `Working`. The test works as expected.
2. `Trace`. We need more work on our end to get the traces from the
anoma node and check that they match the expected result.
3. `NodeError`. The anoma node returns `failed to prove the nock
program`.
4. `Wrong`. The anoma node returns some value that does not match the
expected value.

---------

Co-authored-by: Lukasz Czajka <lukasz@heliax.dev>
Co-authored-by: Łukasz Czajka <62751+lukaszcz@users.noreply.github.com>
Co-authored-by: Paul Cadman <git@paulcadman.dev>
2024-11-05 13:28:28 +00:00
Łukasz Czajka
3030196fdd Non-recursive definitions (#3138)
* Closes #2968 
* Implements detection of function-like definitions, which either:
  - have some arguments on the left of `:`, or
  - have at least one clause.
* Only function-like definitions are recursive.
* Non-recursive definitions are not mutually recursive either, and can
be used only after their definition. This necessitates rearranging some
definitions in existing Juvix code.
* Changes the scoping of identifiers in record updates. Now field names
on the right side don't refer to the old values of the record fields but
to identifiers in scope defined outside the record update. To refer to
old values, one needs to explicitly use record projections, e.g.
```
r@Rec{x := Rec.x r}
```
2024-11-04 18:18:39 +01:00
Jan Mas Rovira
71161ffecd
Fix package-base interaction (#3139)
- Fixes #3009 
- Fixes #2877
- TODO think if this makes https://github.com/anoma/juvix/issues/2985
slightly easier to fix
2024-11-01 14:42:18 +00:00
Łukasz Czajka
95275ca5c1
Detect constant side conditions in matches (#3133)
* Closes #3007 
* Depends on #3101 
* Detects side conditions which are `true` (removes the condition) or
`false` (removes the branch).
2024-11-01 09:50:19 +00:00
Łukasz Czajka
68a79bc8a8
Detect redundant patterns (#3101)
* Closes #3008
* Implements the algorithm from [Luc Maranget, Warnings for Pattern
Matching](https://www.cambridge.org/core/services/aop-cambridge-core/content/view/3165B75113781E2431E3856972940347/S0956796807006223a.pdf/warnings-for-pattern-matching.pdf)
to detect redundant patterns.
* Adds an option to the Core pretty printer to print match patterns in a
user-friendly format consistent with pattern syntax in Juvix frontend
language.
2024-10-30 11:38:22 +01:00
Paul Cadman
3b34f6e4ff
Support random API from the Anoma stdlib (#3129)
This PR adds frontend support for the Anoma Random API:

The frontend builtin APIs are:

```
builtin anoma-random-generator
axiom RandomGenerator : Type;

builtin anoma-random-generator-init
axiom randomGeneratorInit : Nat -> RandomGenerator;

builtin anoma-random-generator-split
axiom randomGeneratorSplit : RandomGenerator
  -> Pair RandomGenerator RandomGenerator;

builtin anoma-random-next-bytes
axiom randomNextBytes : Nat
  -> RandomGenerator
  -> Pair ByteArray RandomGenerator;
```

### Nockma Evaluator

The Nockma evaluator intercepts the corresponding Anoma random stdlib
calls using the
[System.Random](https://hackage.haskell.org/package/random-1.2.1.2/docs/System-Random.html)
API. The implementation uses the
[splitmix](https://hackage.haskell.org/package/splitmix-0.1.0.5/docs/System-Random-SplitMix.html)
generator directly because it has an API to destructure the generator
into a pair of integers. We can use this to serialise the generator.



* Closes https://github.com/anoma/juvix/issues/2902
2024-10-29 18:23:37 +00:00
Jan Mas Rovira
021f183d33
Run Nockma in an Anoma node (#3128)
# Changes
1. Adds a new command `juvix dev anoma node`. This command runs the
anoma node.
2. Adds a flag `--anoma-dir` to `juvix dev nockma run`. When given, it
must point to the anoma clone. Then, it will run the nockma code in the
anoma node and report the result (with no traces).

# Prerequisites
1. An anoma clone at some specific commit. 
   ```
   git clone git@github.com:anoma/anoma.git
   cd anoma
   git checkout 98e3660b91cd55f1d9424dcff9420425ae98f5f8
   
   # build anoma
   mix deps.get
   mix escript.install hex protobuf
   mix compile

   # build the client
   mix do --app anoma_client escript.build
   ```
2. The `mix` command (elixir).
3. The [`grpcurl`](https://github.com/fullstorydev/grpcurl) command. To
install a single binary in `~/.local/bin` you can run:
   ```
curl -sSL
"https://github.com/fullstorydev/grpcurl/releases/download/v1.9.1/grpcurl_1.9.1_linux_x86_64.tar.gz"
| tar -xz -C ~/.local/bin --no-wildcards grpcurl
   ```

# Testing
I've not included any test. It can be tested locally like this:
```
cd juvix/tests/Anoma/Compilation/positive
juvix compile anoma test001.juvix
echo 20 > args.debug.nockma
juvix dev nockma run --anoma-dir ~/projects/anoma test001.nockma --args args.debug.nockma
2024-10-29 17:32:59 +01:00
Paul Cadman
18cca89296
Add frontend support for Anoma Resource Machine builtins (#3113)
This PR adds frontend builtin support for the Anoma Resource machine
functions provided in
[resource-machine.hoon](4897751366/hoon/resource-machine.hoon),
*except* for the `prove-logic` function which still needs some
discussion.

Users must now mark the Anoma `Resource` type with
`builtin-anoma-resource` and the Anoma `Action` type with
`builtin-anoma-action`. This is required because the resource machine
functions use these types.

The compiler does not check that the constructors of `Resource` and
`Action` match the RM spec. I made this decision because the Anoma types
are sill in flux and it's easier to change if correctness is delegated
to the RM library for now. We can add the constructor checks when the
Anoma RM interface is stable.

The test file
[test085.juvix](47ba3e2746/tests/Anoma/Compilation/positive/test085.juvix)
demonstrates how each builtin should be used.

### Core Evaluator

The Core evaluator does not support these builtin functions in normal
mode. When used for normalisation (e.g when used in the constant folding
pass) the Core evaluator leaves the builtin functions unchanged.

### Nock Evaluator

The Nock evaluator does not intercept the Anoma lib functions that the
builtins correspond to in the Nock backend. It executes the underlying
Nock code instead. This means that several of the functions cannot be
tested because they're either too slow (e.g commitment) or do not have
an implementation in the Nock code (e.g addDelta).

* Closes: https://github.com/anoma/juvix/issues/3084
2024-10-22 13:10:08 +02:00
Paul Cadman
8fb5ae77ba
Rename Nockma stdlib to anomalib and add RM references (#3111)
Most changes in this PR relate to renaming of the Anoma Nock
StandardLibrary to AnomaLibrary. This is because the Anoma library now
consists of a standard library from
[anoma.hoon](a20b5e7838/hoon/anoma.hoon)
and the resource machine library
[resource-machine.hoon](a20b5e7838/hoon/anoma.hoon).

The Anoma RM functions and value references are also added. Their
integration into the compiler pipeline will happen in a separate PR.

The Anoma Library RM functions and stdlib functions are enumerated
separately. There is a separate type for Anoma Library values because
these are compiled differently than functions.

Part of:

* https://github.com/anoma/juvix/issues/3084
2024-10-21 13:28:37 +02:00
Łukasz Czajka
5d32e8f0b5
Fix closure representation in the Nock backend (#3105)
* Closes #3083 
* Closes #3042 

The representation of closures is changed to make it more efficient and
compatible with the Nock calling convention.
2024-10-18 18:49:34 +01:00
Paul Cadman
0a9ec8fb37
Add frontend support for Anoma stdlib sha256 (#3109)
This PR adds frontend support for Anoma stdlib sha256 function (aka
`shax` in Nock).

* Closes https://github.com/anoma/juvix/issues/2901

The new builtin can be declared as follows:

```
builtin anoma-sha256
axiom anomaSha256 : Nat -> ByteArray;
```

The intention is that it wraps a call to anomaEncode as follows:

```
sha256 {A} (a : A) : ByteArray := anomaSha256 (anomaEncode a);
```

### Fix for atom to ByteString

This PR also includes a commit
6205dc9ff9
to fix an issue with functions like `integerToByteArray` when called
with negative integers (the solution is to change the argument types to
Natural, as this is all we need for Anoma).
2024-10-17 19:11:26 +02:00
Łukasz Czajka
f1bb0e50d9
Remove VampIR compile command and tests (#3104)
* Closes #2841 
* Moves the `vampir` compilation target under `dev`.
* Removes VampIR tests that require the external `vamp-ir` executable.
2024-10-16 15:03:14 +02:00
Łukasz Czajka
c50ad06976
Compile-time configuration (#3102)
* Closes #3077 
* Closes #3100 
* Adds a compilation-time configuration script that creates a
`config/config.json` file which is then read by the
`Makefile`/`justfile` and embedded into the Juvix binary.
2024-10-16 11:47:23 +02:00
Paul Cadman
c499d0d7e1
Support Anoma stdlib curry function (#3097)
This PR adds support for the Anoma node stdlib function to the nockma
backend.

https://developers.urbit.org/reference/hoon/stdlib/2n#cury

This PR also changes the arguments placeholder value when compiling
functions and closures to make it a tuple of length equal to the
function/closure arity.

To use curry, the function argument's placeholder argument tuple must
have length equal to the function airty.

For example if we are compiling a function with arity 2, the compiled
nock function should have the form:

```
[compiled-code [0 0] env]
```
2024-10-11 16:53:06 +02:00
Łukasz Czajka
7760267bcd
Fix JuvixTree unification (#3087)
* Closes #3016 
* Fixes the `curryType` function
* Changes the behaviour of `unifyTypes` and `isSubtype` to always curry
first
2024-10-09 15:33:42 +02:00
Łukasz Czajka
a3bfaca7bb
Avoid duplication in Nockma code generation (#3070)
* Closes #3013 
* Removes all remaining problems with evaluation duplication that could
potentially lead to an exponential blow-up in the running time.
* Adds the capacity to generate saves of temporary values in the Nock
code generation backend.
* Removes the `TempHeight` transformation on JuvixTree. It is no longer
needed.
* Removes the `ComputeCaseANF` transformation on JuvixCore from the
Anoma pipeline. It is no longer necessary.
2024-10-08 10:05:20 +02:00
Łukasz Czajka
40b71b95de
Nockma backend: translate trace to %puts hints (#3053)
* Closes #3022 
* Requires https://github.com/anoma/anoma/pull/861
2024-10-07 14:01:01 +02:00
Jan Mas Rovira
358551995e
Fix named application bug (#3075)
- Fixes #3074

- Merge after #3076

---------

Co-authored-by: Łukasz Czajka <62751+lukaszcz@users.noreply.github.com>
2024-10-03 16:26:59 +01:00
Jan Mas Rovira
8c37d9b439
Merge typechecker negative tests (#3076) 2024-10-03 10:02:45 +02:00
Jan Mas Rovira
137b6d83eb
Fix termination crash due to empty permutation (#3081)
- Fixes #3064
2024-10-02 18:59:30 +02:00
Jan Mas Rovira
a1926547a2
Reimplement positivity checker (#3057)
- Fixes #3048
- Fixes #3058

Due to #3071 I had to change the order of two lines in
tests/Compilation/positive/test079.juvix.
2024-10-01 13:39:28 +02:00
Jan Mas Rovira
deca981fa3
Ignore files that start with a . (#3072)
- Closes #3068
2024-09-30 12:17:18 +02:00
Jan Mas Rovira
c09d10db02
Improve parsing error for missing @ in named application (#3012)
- Closes #2796 

Example:
```
module NamedApplicationMissingAt;

type T := t;

fun (a : T)
 : T := t;

main : T := fun {a := t};
```

The error displays as:

![image](https://github.com/user-attachments/assets/e36232cb-9ec3-462c-8ee4-8332924b4b07)
2024-09-20 18:00:38 +01:00
Łukasz Czajka
b609e1f6a5
Don't fold lets if the let-bound variable occurs under a lambda-abstraction (#3029)
* Closes #3002
2024-09-13 19:29:39 +02:00
Łukasz Czajka
56e2db7336
Fix JuvixTree parsing and pretty printing (#3024)
Recent changes to the compiler left JuvixTree parsing and pretty
printing not in sync with each other.
2024-09-12 14:37:51 +02:00
Łukasz Czajka
26ea94b977
The assert builtin (#3014)
* Requires #3015
2024-09-12 09:29:57 +02:00
Jan Mas Rovira
d8919087dd
Fix location of scoped modulePathName (#3011)
Closes #2737.

This issues caused the formatter to sometimes insert unwanted line
breaks.
2024-09-09 15:50:29 +02:00
Łukasz Czajka
ab2d31a313
Compilation of side conditions in pattern matches (#2984)
* Closes #2804 
* Requires #3003
* Front-end syntax for side conditions was implemented in #2852. This PR
implements compilation of side conditions.
* Adds side-conditions to `Match` nodes in Core. Updates Core parsing,
printing and the evaluator.
* Only side-conditions without an `else` branch are allowed in Core. If
there is an `else` branch, the side conditions are translated in
`fromInternal` into nested ifs. Because with `else` the conditions are
exhaustive, there are no implications for pattern exhaustiveness
checking.
* Adjusts the "wildcard row" case in the pattern matching compilation
algorithm to take into account the side conditions.
2024-09-09 12:25:15 +02:00
Jan Mas Rovira
4ae4e4e4d9
Fix a bug that prevented use of name signature defined after the point (#3001)
- Fixes #2999
2024-09-06 14:32:03 +02:00
Jan Mas Rovira
e45503a63e
Fix typechecking of default arguments in signatures with trait arguments (#2998)
- Fixes #2994
2024-09-05 19:43:04 +02:00