1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-30 05:42:26 +03:00
juvix/tests/positive/Termination
Ł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
..
Data Update standard library coding style according to the guidelines (#3092) 2024-10-14 15:56:54 +02:00
Ack.juvix Format juvix files using new function syntax (#2245) 2023-07-11 17:22:07 +02:00
Fib.juvix New fixity/iterator syntax (#2332) 2023-09-14 10:57:38 +02:00
issue2414.juvix Allow @ in constructor declarations (#3099) 2024-10-15 19:15:37 +02:00
Mutual.juvix Fix remove unexpected whitespaces introduced by formatting (#2489) 2023-11-03 12:51:45 +01:00
Nested1.juvix Detect termination for nested local definitions (#3169) 2024-11-15 12:30:18 +01:00
Nested2.juvix Detect termination for nested local definitions (#3169) 2024-11-15 12:30:18 +01:00
Package.juvix Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
TreeGen.juvix Format juvix files using new function syntax (#2245) 2023-07-11 17:22:07 +02:00
Undefined.juvix Non-recursive definitions (#3138) 2024-11-04 18:18:39 +01:00