1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-30 14:13:27 +03:00
juvix/tests/positive
Jan Mas Rovira d08bf942b6
Add front-end support for case expressions boolean side conditions (#2852)
- Syntax for #2804.
- ⚠️ Depends on #2869.

This pr introduces:
1. front-end support (parsing, printing, typechecking) for boolean side
conditions for branches of case expressions.
2. Now `if` is a reserved keyword.
3. Multiway `if` is allowed to have only the `else` branch. I've also
refactored the parser to be simpler.

Example:
```
 multiCaseBr : Nat :=
    case 1 of
      | zero
        | if 0 < 0 := 3
        | else := 4
      | suc (suc n)
        | if 0 < 0 := 3
        | else := n
      | suc n if 0 < 0 := 3;
```
The side if branches must satisfy the following.
1. There must be at least one `if` branch.
4. The `else` branch is optional. If present, it must be the last.

Future work:
1. Translate side if conditions to Core and extend the exhaustiveness
algorithm.
5. Add side if conditions to function clauses.
2024-07-04 01:16:30 +02:00
..
265 Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
272 Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
BuiltinsMultiImport Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
BuiltinsMultiOpenImport Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
Dependencies Extract builtin definitions for loading a Package into bundled package-base package (#2535) 2023-11-30 16:22:18 +00:00
FancyPaths Extract builtin definitions for loading a Package into bundled package-base package (#2535) 2023-11-30 16:22:18 +00:00
ImportAsOpen Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
ImportNestedLocalModule Transitively register local modules in ScoperState (#2655) 2024-02-16 14:09:49 +00:00
Imports Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
ImportShadow Optional braces in case syntax (#2778) 2024-05-22 18:14:03 +01:00
InstanceImport Optional braces in case syntax (#2778) 2024-05-22 18:14:03 +01:00
Internal Merge if -> ite renaming from stdlib (#2869) 2024-07-02 10:03:06 +02:00
issue1333 Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
issue1466 Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
issue1693 Update juvix-stdlib to remove non-ASCII indentifiers (#2857) 2024-06-26 10:23:35 +02:00
issue1731 Merge if -> ite renaming from stdlib (#2869) 2024-07-02 10:03:06 +02:00
issue1879 Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
issue2163 Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
issue2248 Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
issue2296 Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
issue2373 Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
Markdown Update juvix-stdlib to remove non-ASCII indentifiers (#2857) 2024-06-26 10:23:35 +02:00
MarkdownImport Extract builtin definitions for loading a Package into bundled package-base package (#2535) 2023-11-30 16:22:18 +00:00
NoDependencies Extract builtin definitions for loading a Package into bundled package-base package (#2535) 2023-11-30 16:22:18 +00:00
package Extract builtin definitions for loading a Package into bundled package-base package (#2535) 2023-11-30 16:22:18 +00:00
PackageLoader Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
PackageLoaderV2 Extract builtin definitions for loading a Package into bundled package-base package (#2535) 2023-11-30 16:22:18 +00:00
PublicImports Generalize import syntax (#2819) 2024-06-21 15:02:30 +02:00
QualifiedConstructor Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
QualifiedImports Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
QualifiedSymbol Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
QualifiedSymbol2 Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
Reachability Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
StdlibImport Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
StdlibList Per-module compilation (#2468) 2023-12-30 20:15:35 +01:00
Termination Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
UsingHiding Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
VisibilityPrecendence Correctly resolve the visibility annotations of NameSpaceEntries (#2657) 2024-02-16 18:26:01 +01:00
Adt.juvix Improve formatting of single-constructor types and records (#2342) 2023-09-07 16:20:14 +02:00
Alias.juvix Optional braces in case syntax (#2778) 2024-05-22 18:14:03 +01:00
AliasRecordConstructor.juvix Optional braces in case syntax (#2778) 2024-05-22 18:14:03 +01:00
Ape.juvix Update juvix-stdlib to remove non-ASCII indentifiers (#2857) 2024-06-26 10:23:35 +02:00
Axiom.juvix Fix: format juvix files in test/positive (#1978) 2023-04-12 10:07:01 +02:00
Builtins.juvix Format juvix files using new function syntax (#2245) 2023-07-11 17:22:07 +02:00
BuiltinsBool.juvix Merge if -> ite renaming from stdlib (#2869) 2024-07-02 10:03:06 +02:00
ConstructorWildcard.juvix Improve formatting of function definition arguments (#2551) 2023-12-07 11:26:48 +01:00
Format.juvix Add front-end support for case expressions boolean side conditions (#2852) 2024-07-04 01:16:30 +02:00
FormatPragma.juvix Remove old function syntax (#2305) 2023-08-24 16:24:47 +02:00
HoleTypeParameter.juvix Fix for crash with wildcard used in type definition (#2405) 2023-10-02 18:58:21 +02:00
IdInType.juvix Fix formatting for all Juvix files in tests folder (#2404) 2023-10-31 18:36:34 +01:00
Inductive.juvix Improve formatting of single-constructor types and records (#2342) 2023-09-07 16:20:14 +02:00
InductivePipes.juvix Improve formatting of single-constructor types and records (#2342) 2023-09-07 16:20:14 +02:00
InstanceAxiom.juvix Fix instance axiom bug (#2439) 2023-10-10 15:55:17 +02:00
Iterators.juvix Optional braces in case syntax (#2778) 2024-05-22 18:14:03 +01:00
Judoc.juvix Improve formatting of single-constructor types and records (#2342) 2023-09-07 16:20:14 +02:00
LambdaCalculus.juvix Fix formatting for all Juvix files in tests folder (#2404) 2023-10-31 18:36:34 +01:00
LetOpen.juvix Allow open statements in let expressions (#2395) 2023-10-02 23:13:45 +02:00
LetShadow.juvix Optional braces in case syntax (#2778) 2024-05-22 18:14:03 +01:00
Literals.juvix Format juvix files using new function syntax (#2245) 2023-07-11 17:22:07 +02:00
LocalModWithAxiom.juvix Fix #2495 (#2496) 2023-11-03 21:23:57 +01:00
LocalModWithAxiom.juvix.formatted Fix #2495 (#2496) 2023-11-03 21:23:57 +01:00
LocalSynonym.juvix Fix formatting for all Juvix files in tests folder (#2404) 2023-10-31 18:36:34 +01:00
MultiParams.juvix Improve formatting of single-constructor types and records (#2342) 2023-09-07 16:20:14 +02:00
MutualLet.juvix Remove old function syntax (#2305) 2023-08-24 16:24:47 +02:00
MutualType.juvix Fix remove unexpected whitespaces introduced by formatting (#2489) 2023-11-03 12:51:45 +01:00
NamedArguments.juvix Fix formatting for all Juvix files in tests folder (#2404) 2023-10-31 18:36:34 +01:00
Namespaces.juvix Separate modules namespace (#2257) 2023-07-26 09:59:50 +02:00
NestedPatterns.juvix Optional braces in case syntax (#2778) 2024-05-22 18:14:03 +01:00
OmitType.juvix Remove old function syntax (#2305) 2023-08-24 16:24:47 +02:00
Operators.juvix New fixity/iterator syntax (#2332) 2023-09-14 10:57:38 +02:00
Package.juvix Add PackageDescription.Basic module Package variant (#2509) 2023-11-13 17:36:18 +00:00
Parsing.juvix Format juvix files using new function syntax (#2245) 2023-07-11 17:22:07 +02:00
Polymorphism.juvix Fix formatting for all Juvix files in tests folder (#2404) 2023-10-31 18:36:34 +01:00
PolymorphismHoles.juvix Fix formatting for all Juvix files in tests folder (#2404) 2023-10-31 18:36:34 +01:00
Pragmas.juvix Format juvix files using new function syntax (#2245) 2023-07-11 17:22:07 +02:00
Projections.juvix Literal casting (#2457) 2023-11-03 10:01:03 +01:00
RecordPattern.juvix Fix generation of wildcards in RecordPattern (#2802) 2024-06-04 18:28:25 +02:00
Records2.juvix Literal casting (#2457) 2023-11-03 10:01:03 +01:00
Records.juvix Improve formatting of single-constructor types and records (#2342) 2023-09-07 16:20:14 +02:00
ShadowPublicOpen.juvix Fix: format juvix files in test/positive (#1978) 2023-04-12 10:07:01 +02:00
SignatureWithBody.juvix Remove old function syntax (#2305) 2023-08-24 16:24:47 +02:00
Symbols.juvix User-friendly operator declaration syntax (#2270) 2023-08-09 18:15:51 +02:00
Syntax.juvix Per-module compilation (#2468) 2023-12-30 20:15:35 +01:00
Traits2.juvix Update juvix-stdlib to remove non-ASCII indentifiers (#2857) 2024-06-26 10:23:35 +02:00
Traits.juvix Fix formatting for all Juvix files in tests folder (#2404) 2023-10-31 18:36:34 +01:00
TypeAlias.juvix Fix formatting for all Juvix files in tests folder (#2404) 2023-10-31 18:36:34 +01:00
WildcardArguments.juvix Allow wildcard arguments in new function definition syntax (#2295) 2023-08-16 17:51:09 +02:00