1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-01 00:04:58 +03:00
Commit Graph

45 Commits

Author SHA1 Message Date
janmasrovira
39a300eaa2
Support type aliases (#1404)
* add a simple positive test

* add lambda expressions to microjuvix language

* add basic normalization of type aliases

* fix test name

* normalize only functions on types

* normalize when matching

* fix type of inductive names

* improve detection of normalizing functions

* remove obsolete comment

* match constructor return type

* add test for issue 1333

* fix existing tests

* use lambda case

* add strong normalization

* Add test cases for type aliases and another fix

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
2022-07-25 12:30:18 +02:00
Jonathan Cubides
423ccec70a
Add positivity check for inductive types (#1393)
* w.i.p

* Added strict positivity condition for datatypes w.i.p

* Add negative test for str.postivity check

* Add some revisions

* the branch is back to feet

* w.i.p add lots of traces to check alg.

* Add more test and revisions

* Add negative and positive test to the new flag and the keyword

* Fix shell tests.

* Make pre-commit happy

* Fix rebase conflicts

* Make pre-commit happy

* Add shell test, rename keyword, fix error msg

* Revert change

* Necessary changes

* Remove wrong unless

* Move the positivity checker to its own folder

* Add missing juvix.yaml

* Add a negative test thanks to jan

* make some style changes

* Make ormolu happy

* Remove unnecessary instance of Show

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2022-07-23 09:27:12 +02:00
janmasrovira
e939f8fe9f
Keep qualified names (#1392)
* keep qualified names

* add comment

* add pretty field to Abstract Name

* add test

* Add shell test

* Add another test

* fix shell test

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
2022-07-21 15:54:08 +02:00
Łukasz Czajka
e19fbf489f
Implement some error messages (#1396) (#1400)
* Implement error message for double braces
* Implement error message for implicit pattern on the left of an application
* Implement error message for constructor expected on the left of an application 

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2022-07-20 16:24:03 +02:00
janmasrovira
a8f4acaca2
Curly braces are allowed nested in patterns (#1380) 2022-07-20 10:33:52 +02:00
janmasrovira
32059965a9
Type checking fails when the type of a pattern is not given by the signature (#1378)
* infer hole in type from pattern

* refactor

* fix error message

* format

* fix matching of identifiers

* improve error message
2022-07-15 17:57:04 +02:00
Jonathan Cubides
d11605ab1e
Check all the type parameter names are different when declaring an inductive type (#1377)
* Fix #1334

* Rename error type
2022-07-15 10:58:49 +02:00
Jonathan Cubides
3b3ea45da9
Rename MiniJuvix to Juvix (#259)
* Renaming MiniJuvix to Juvix

* Make Ormolu happy

* Make Hlint happy

* Remove redundant imports

* Fix shell tests and add target ci to our Makefile

* Make pre-commit happy
2022-07-08 13:59:45 +02:00
Paul Cadman
84732b281f
Updates tests to use the updated standard library (#253)
* Updates tests to use the updated stdlib

* Update to minijuvix-stdlib main
2022-07-07 15:35:56 +02:00
Paul Cadman
89ccef3da4
Throw error when reading a file that conflicts with embedded stdlib (#243)
* Throw error when reading a file that conflicts with stdlib

The Files effect first tries to read a file from the embedded stdlib. If
this succeeds and the file also exists in the project then an error is
thrown.

This error can be thrown either at the parsing stage, if the entrypoint
file conflicts with the standard library, or at the scoping stage if an
imported file conflicts.

* Fix module name in test file
2022-07-05 15:54:01 +02:00
janmasrovira
82d1f3ecf7
Filter symbol entries properly in the scoper (#234) 2022-07-04 16:40:10 +02:00
Jonathan Cubides
a78847843b
Fix: proper error handling for typechecker errors (#189)
* Fix: proper error handling for typechecker errors

* Improve error messages
2022-06-22 11:42:59 +02:00
Jonathan Cubides
9e817a62fa
Fix: Add check for constructor return types (#182)
* Checking indtype declar (return type)

* Add missing semicolon

* Fix typo
2022-06-21 17:53:35 +02:00
janmasrovira
b09d4602e7
Add negative test for AppLeftImplicit error (#154) 2022-06-14 08:56:48 +02:00
janmasrovira
2cf3f85439
Support implicit arguments (#144)
* work in progress towards implicit arguments

* Wip towards implicit types

* improve arity checker

* Add version of SimpleFungibleToken with implicit arguments

* guess arity of body before checking the lhs of a clause

* add ArityUnknown and fix some tests

* wip: proper errors in arity checker

* fix bugs, improve errors and add tests

* format

* set hlint version to 3.4 in the ci

* update pre-commit version to 3.0.0

* minor changes

* added more revisions

* minor

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
2022-06-13 14:25:22 +02:00
janmasrovira
bfcaf6bde4
140 Support holes in type signatures (#141) 2022-06-02 13:02:07 +02:00
Jonathan Cubides
f16570e546
Add the termination checker to the pipeline (#111)
* [WIP] EntryPoint now has options. --no-termination is a new global opt.

* Add TerminationChecking to the pipeline

* Add TerminationChecking to the pipeline

* Keep GlobalOptions in App

* Fix reviewer's comments

* delete unnecessary parens

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2022-05-30 13:40:52 +02:00
Jonathan Cubides
7e309eccdb
Add initial documentation (#119) (#120)
* Add initial docs generation website (#119)

* Add docs generation

* [makefile] add serve-docs target

* Fixed rebase conflicts

* Update pre-commit rev

* Added changelog
2022-05-23 16:20:02 +02:00
janmasrovira
50ea7373ee
Improve error generation and handling (#108)
* add face and handling of not in scope symbol error

* small fix

* generic errors wip

* add App effect

* format

* add flycheck-minijuvix

* use absolute paths and refactor

* fix dir0

* add generic error instances and improve some errors

* format

* qualify strings

* use AnsiText

* add ToGenericError instances for the type checker errors

* improve error message

* improve handling of parsing errors
2022-05-18 17:10:10 +02:00
janmasrovira
6bf0b1a839
Fix highlight command for modules with import statements (#102)
* fix highlight

* Add minijuvix.yaml to test directories

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
2022-05-13 16:17:26 +02:00
Jonathan Cubides
7b1371c4b9
Change terminating keyword behavior (#82) 2022-05-04 18:17:16 +02:00
Jonathan Cubides
038042b733
Add terminating keyword (#71)
* Parsing terminating keyword

* cosmetics

* Add support for `terminating` keyword to function decl.

* Minor replacement

* Fix .mjuxix to .mjuvix and the module name
2022-05-04 14:05:58 +02:00
Paul Cadman
dc6fce8820
Add support for compile (by Jonathan) (#66)
* Add support for compile (by Jonathan)

* Remove error related to unsopported backend

Co-authored-by: Jonathan Prieto-Cubides <jonathan.cubides@uib.no>
2022-04-28 17:42:15 +02:00
Paul Cadman
90f607e6ce [typecheck] Shortcircuit clause pattern check errors
In the following case:

```
module WrongConstructorArity;
  inductive T {
    A : T;
  };

  f : T → T;
  f (A i) ≔ i;
end;
```

The typechecker fails when checking the clause `f (A i) := i` because of
the extra constructor argument. However if typechecking continues then
the variable `i` on the rhs does not have a type so we must short-circuit.
2022-04-08 13:32:11 +02:00
Paul Cadman
3af9cb95ac
Restore correct handling of TypeAny and add positive typecheck tests (#34)
* [ format ] AbstractToMicroJuvix

* [ CI ] fixes

* [ CI ] fixes

* [ CI ] Using GHC 9.0 for Hlint

* [ CI ] Use static-checks for Dev as well

* [test] Add positive test for typechecker

* [test] Improve positive typechecker error output

* [typecheck] Restore correct handling of TypeAny

I mistakenly removed the matchTypes function in
https://github.com/heliaxdev/minijuvix/pull/22. This caused the handling
of TypeAny to break.

Literals have type TypeAny and so should be valid when matching against
any other type. The tests have been updated to reflect this.

* [test] Add positive MicroJuvix typecheck tests

* [ ormolu ] fixes

Co-authored-by: Jonathan Prieto-Cubides <jonathan.cubides@uib.no>
2022-04-05 22:02:03 +02:00
Jonathan Prieto-Cubides
a224d94709 [ pre-commit ] Add support and hooks 2022-04-04 17:44:08 +02:00
Paul Cadman
5bbe6cbfb2 [test] Add test for multiple type errors
Add test for literals
2022-04-04 14:59:56 +01:00
Paul Cadman
a030b97e8f [typecheck] Add descriptive messages for remainng errors 2022-03-31 09:30:54 +01:00
Paul Cadman
b41b4c4e84 [typecheck] Add error message for ctor match args mistmatch 2022-03-31 09:29:27 +01:00
Paul Cadman
615f7d11c0 [test] Adds negative typecheck test for constructor 2022-03-31 09:28:20 +01:00
Paul Cadman
242275a4e3 [scoper] Remove ErrGeneric 2022-03-24 14:57:10 +00:00
Paul Cadman
e60d307595 [error] Add ambiguous module message 2022-03-24 14:45:49 +00:00
Paul Cadman
459da40ae6 [error] Add message for ambiguous symbol error 2022-03-24 14:27:56 +00:00
Paul Cadman
86110e063a [test] Add ambiguity tests 2022-03-24 10:22:03 +00:00
Jan Mas Rovira
df5f6d2df0 [scoper] check that top modules are defined in the correct path 2022-03-16 13:58:07 +01:00
Jan Mas Rovira
028c6ac5c0 [tests] add test and error for missing function clause 2022-02-24 00:29:59 +01:00
Jan Mas Rovira
85601c6332 [scoper] properly handle qualified constructors in patterns 2022-02-18 00:58:41 +01:00
Jan Mas Rovira
393f907a51 [scoper] add error for unused operator syntax definitions 2022-02-17 22:00:58 +01:00
Jan Mas Rovira
e55680bfec [scoper] add module not in scope error 2022-02-17 13:40:19 +01:00
Jan Mas Rovira
4ffc7f368d [wip] incorporate singletons-th 2022-02-16 20:15:14 +01:00
Jan Mas Rovira
add1b6e689 [tests] add more errors and their tests 2022-02-16 15:18:08 +01:00
Jan Mas Rovira
ee1ed2d385 [pretty] cool error for import cycles 2022-02-16 11:53:58 +01:00
Jan Mas Rovira
0856327658 [errors] add not in scope error 2022-02-14 13:39:54 +01:00
Jan Mas Rovira
d2e07b9c43 [errors] add more errors and tests 2022-02-14 11:54:18 +01:00
Jan Mas Rovira
cbc9a409ca [tests] add two negative tests to check new errors 2022-02-14 09:06:11 +01:00