1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-08 08:39:26 +03:00
juvix/tests/negative
Jan Mas Rovira 2c8a364143
New syntax for function definitions (#2243)
- Closes #2060
- Closes #2189


- This pr adds support for the syntax described in #2189. It does not
drop support for the old syntax.

It is possible to automatically translate juvix files to the new syntax
by using the formatter with the `--new-function-syntax` flag. E.g.

```
juvix format --in-place --new-function-syntax
```
# Syntax changes
Type signatures follow this pattern:
```
f (a1 : Expr) .. (an : Expr) : Expr
```
where each `ai` is a non-empty list of symbols. Braces are used instead
of parentheses when the argument is implicit.

Then, we have these variants:
1. Simple body. After the signature we have `:= Expr;`.
2. Clauses. The function signature is followed by a non-empty sequence
of clauses. Each clause has the form:
```
| atomPat .. atomPat := Expr
```
# Mutual recursion
Now identifiers **do not need to be defined before they are used**,
making it possible to define mutually recursive functions/types without
any special syntax.
There are some exceptions to this. We cannot forward reference a symbol
`f` in some statement `s` if between `s` and the definition of `f` there
is one of the following statements:
1. Local module
2. Import statement
3. Open statement

I think it should be possible to drop the restriction for local modules
and import statements
2023-07-10 19:57:55 +02:00
..
230 Iterator syntax (#2126) 2023-05-30 15:30:11 +02:00
258 Fix Makefile target bugs for formatting and type Checking Juvix files (#2057) 2023-05-19 17:33:56 +02:00
265 Fix Makefile target bugs for formatting and type Checking Juvix files (#2057) 2023-05-19 17:33:56 +02:00
BindGroupConflict Change syntax for ind. data types and forbid the empty data type (#1684) 2023-01-03 13:49:04 +01:00
Dependencies Fix dependencies suggestion in missing module error (#2024) 2023-04-22 18:15:38 +01:00
ImportCycle Rename MiniJuvix to Juvix (#259) 2022-07-08 13:59:45 +02:00
Internal Fix Makefile target bugs for formatting and type Checking Juvix files (#2057) 2023-05-19 17:33:56 +02:00
issue1337 Fix Makefile target bugs for formatting and type Checking Juvix files (#2057) 2023-05-19 17:33:56 +02:00
issue1344 Fix Makefile target bugs for formatting and type Checking Juvix files (#2057) 2023-05-19 17:33:56 +02:00
issue1700 Fix Makefile target bugs for formatting and type Checking Juvix files (#2057) 2023-05-19 17:33:56 +02:00
NoDependencies Fix dependencies suggestion in missing module error (#2024) 2023-04-22 18:15:38 +01:00
StdlibConflict Fix Makefile target bugs for formatting and type Checking Juvix files (#2057) 2023-05-19 17:33:56 +02:00
Termination Add VampIR to the CI (#2096) 2023-05-22 19:49:36 +02:00
UsingHiding Scope check symbols inside using {..} and hiding {..} (#2108) 2023-05-22 11:41:13 +02:00
AmbiguousConstructor.juvix Change syntax for ind. data types and forbid the empty data type (#1684) 2023-01-03 13:49:04 +01:00
AmbiguousExport.juvix Change syntax for ind. data types and forbid the empty data type (#1684) 2023-01-03 13:49:04 +01:00
AmbiguousModule.juvix Rename MiniJuvix to Juvix (#259) 2022-07-08 13:59:45 +02:00
AmbiguousSymbol.juvix Change syntax for ind. data types and forbid the empty data type (#1684) 2023-01-03 13:49:04 +01:00
AppLeftImplicit.juvix Fix Makefile target bugs for formatting and type Checking Juvix files (#2057) 2023-05-19 17:33:56 +02:00
AsPatternAlias.juvix Improve As-Pattern parsing (#1603) 2022-11-03 10:02:22 +01:00
ConstructorExpectedLeftApplication.juvix Fix Makefile target bugs for formatting and type Checking Juvix files (#2057) 2023-05-19 17:33:56 +02:00
DanglingJudoc.juvix Add dangling judoc error (#2099) 2023-05-16 15:39:43 +02:00
DuplicateFixity.juvix Add syntax keyword (#2107) 2023-05-22 12:50:07 +02:00
DuplicateInductiveParameterName.juvix Change syntax for ind. data types and forbid the empty data type (#1684) 2023-01-03 13:49:04 +01:00
ImplicitPatternLeftApplication.juvix Fix Makefile target bugs for formatting and type Checking Juvix files (#2057) 2023-05-19 17:33:56 +02:00
InfixError.juvix Add syntax keyword (#2107) 2023-05-22 12:50:07 +02:00
InfixErrorP.juvix Add syntax keyword (#2107) 2023-05-22 12:50:07 +02:00
Iterators1.juvix Iterator syntax (#2126) 2023-05-30 15:30:11 +02:00
Iterators2.juvix Iterator syntax (#2126) 2023-05-30 15:30:11 +02:00
Iterators3.juvix Iterator syntax (#2126) 2023-05-30 15:30:11 +02:00
Iterators4.juvix Iterator syntax (#2126) 2023-05-30 15:30:11 +02:00
Iterators5.juvix Iterator syntax (#2126) 2023-05-30 15:30:11 +02:00
juvix.yaml Rename MiniJuvix to Juvix (#259) 2022-07-08 13:59:45 +02:00
LacksFunctionClause.juvix Fix Makefile target bugs for formatting and type Checking Juvix files (#2057) 2023-05-19 17:33:56 +02:00
LacksTypeSig2.juvix Allow shadowing local variables with let function definitions (#1847) 2023-02-22 10:26:54 +01:00
LacksTypeSig.juvix remove ≔ from the language and replace it by := (#1563) 2022-09-30 10:55:32 +10:00
LetMissingClause.juvix Fix Makefile target bugs for formatting and type Checking Juvix files (#2057) 2023-05-19 17:33:56 +02:00
ModuleNotInScope.juvix Rename MiniJuvix to Juvix (#259) 2022-07-08 13:59:45 +02:00
MultipleDeclarations.juvix Rename MiniJuvix to Juvix (#259) 2022-07-08 13:59:45 +02:00
MultipleExportConflict.juvix Rename MiniJuvix to Juvix (#259) 2022-07-08 13:59:45 +02:00
NestedAsPatterns.juvix Improve As-Pattern parsing (#1603) 2022-11-03 10:02:22 +01:00
NestedPatternBraces.juvix remove ≔ from the language and replace it by := (#1563) 2022-09-30 10:55:32 +10:00
NotInScope.juvix Rename MiniJuvix to Juvix (#259) 2022-07-08 13:59:45 +02:00
PragmasFormat.juvix Add: pragma support (#1997) 2023-04-26 15:26:13 +02:00
PragmasYAML.juvix Iterator syntax (#2126) 2023-05-30 15:30:11 +02:00
QualSymNotInScope.juvix Rename MiniJuvix to Juvix (#259) 2022-07-08 13:59:45 +02:00
Tab.juvix Disallow tab characters as spaces (#1523) 2022-09-07 13:59:41 +02:00
UnusedOperatorDef.juvix Add syntax keyword (#2107) 2023-05-22 12:50:07 +02:00
WrongModuleName.juvix Rename MiniJuvix to Juvix (#259) 2022-07-08 13:59:45 +02:00