831 Commits

Author SHA1 Message Date
Gaith Hallak
404bb33863 Add fann() to proj 2023-06-09 13:17:04 +03:00
Gaith Hallak
b35441c40e Add fann() to remote 2023-06-09 13:17:04 +03:00
Gaith Hallak
dd57fd9abe Add fann() to remote_u 2023-06-09 13:17:04 +03:00
Gaith Hallak
1043473696 Add fann() to set_state 2023-06-09 13:17:04 +03:00
Gaith Hallak
dc5a119bc6 Add fann() to closure 2023-06-09 13:17:04 +03:00
Gaith Hallak
2118d82745 Add fann() to funcall 2023-06-09 13:17:04 +03:00
Gaith Hallak
a4d1479cc5 Add fann type and to_fann fun 2023-06-09 13:17:04 +03:00
Hans Svensson
7bac15949c
Introduce encode/decode_value to compiler (#457) 2023-06-01 13:23:21 +02:00
Gaith Hallak
7b6eba5319
Introduce contract-level compile-time constants (#432)
* Allow compile-time constants as toplevel declarations

* Remove the test that fails on toplevel consts

* Warn when shadowing a constant

* Allow records to be used as compile time constants

* Allow data constructors in compile-time constants

* Disable some warnings for toplevel constants

Since variables and functions cannot be used in the definition of
a compile time constants, the following warnings are not going to be
reported:

* Used/Unused variable
* Used/Unused function

* Do not reverse constants declarations

* Add tests for all valid expressions

* Add test for accessing const from namespace

* Revert "Do not reverse constants declarations"

This reverts commit c4647fadacd134866e4be9c2ab4b0d54870a35fd.

* Add test for assigining constant to a constant

* Show empty map or record error when assigning to const

* Report all invalid constant expressions before fail

* Allow accessing records fields in toplevel consts

* Undo a mistake

* Add test for warning on const shadowing

* Show error message when using pattern matching for consts

* Remove unused error

* Ban toplevel constants in contract interfaces

* Varibles rename

* Change the error message for invalid_const_id

* Make constants public in namespaces and private in contracts

* Add a warning about unused constants in contracts

* Use ban_when_const for function applications

* Test for qualified access of constants in functions

* Add failing tests

* Add test for the unused const warning

* Update CHANGELOG

* Update all_syntax test file

* Treat expr and type inside bound as bound

* Allow typed ids to be used for constants

* List valid exprs in the error message for invalid exprs

* Fix tests

* Update the docs about constants

* Update syntax docs

* Check validity of const exprs in a separate functions

* Call both resolve_const and resolve_fun from resolve_var
2023-04-12 14:20:41 +03:00
Gaith Hallak
99bb3fe1fb
Mark only included files as potentially unused (#442)
* Mark only included files as potentially unused

* Update CHANGELOG

* Add test
2023-03-21 13:55:18 +03:00
Hans Svensson
311bf49505
Prepare v7.1.0 release (#438) v7.1.0 2023-02-24 09:40:06 +01:00
Denis Davidyuk
0e3bcba07d
Fix markup in sophia_features.md (#437) 2023-02-15 13:27:29 +03:00
Marco Walz
699d1f7ab8
fix: use latest pygments version to generate docs (#435) 2023-02-02 08:32:54 +01:00
Marco Walz
1a40a93157
chore(deps): mkdocs version update (#434) 2023-02-02 10:16:27 +03:00
Gaith Hallak
c078119bc4
Add hole expression (#433)
* Add hole expressions

* Fix the issue of unreported holes

* Add tests

* New line in the end of the test file

* Update CHANGELOG

* Add hole expression to the docs

* Do not treat hole as a special type

* Update docs

* Update docs/sophia_features.md

Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com>

Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com>
2023-01-12 16:23:36 +03:00
Gaith Hallak
31fd8fe24f
Hide warning when calling with non-0 value arg (#431)
* Hide warning when calling with non-0 value arg

* Update the tests

* Update CHANGELOG
2022-12-12 11:44:24 +03:00
Nikita Fuchs
9ad8e26e88
Add clarification for Chain.timestamp in the stdlib docs (#429) 2022-12-07 17:34:55 +03:00
Gaith Hallak
5adeb6c93e
Ban using contracts as namespaces (#428)
* Ban calling contracts functions as functions namespaces

* Ban using contracts as namespaces

* Add tests

* Update CHANGELOG

* Separate guards with a semicolon
2022-11-23 12:03:24 +03:00
Gaith Hallak
256df25af4
Check contracts and entrypoints modifiers when implementing interfaces (#427)
* Check contracts and entrypoints modifiers when implementing interfaces

* Fix existing tests

* Add passing tests

* Add failing tests

* Update docs

* Update CHANGELOG
2022-11-17 11:40:57 +03:00
Gaith Hallak
83abfae32b
Ban the unification of uvars and var_args functions (#423)
* Ban the unification of uvar and var_args function

* Update CHANGELOG

* Fix the tests

* Undo indent

* Change the error message for unify_varargs
2022-11-01 18:10:57 +02:00
Denis Davidyuk
4ca90feea0
Rename type_defs to typedefs in ACI to increase compatibility (#421) 2022-11-01 08:55:00 +02:00
Gaith Hallak
09638daa90
Return mapping from variables to registers in fate compilation (#411)
* Return mapping from variables to registers

* Fix dialyzer issues

* Record real names

* Report saved fresh names as part of fcode env

* Undo whitespace changes

* Fix dialyzer warnings

* Formatting fix

* Use function names as strings

* Manually handle making function names

* Update CHANGELOG

* Make variables registers optional

* Update docs about the new flag

* Remove empty saved_fresh_names map from fcode env
2022-10-25 09:42:02 +03:00
Gaith Hallak
d59023a9f4
Allow calling a different instance of the current contract (#379)
Add functions as fields before inferring

Unbound untyped fields before binding typed ones

Fix failing tests

Make complex_types contract non-compatible with aevm

Reduce code duplication

Undo changes to test.aes

Remove special handling of __constructor__ field

Resolve field constraint by arity of contract function

Update CHANGELOG

Update CHANGELOG.md

Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com>

Split bind_field function

Add a comment about rebinding
2022-10-23 15:01:28 +03:00
Radosław Rowicki
34b52739fd
Include all functions in the symbols map (#418)
* Include all functions in the symbols map

* .

* remove improper wording

* Use update_symbols exported from aebytecode

* Extract adding child symbols into a separate fun

* Make child contracts symbols optional

* Document include_child_contract_symbols option

Co-authored-by: Gaith Hallak <gaithhallak@gmail.com>
2022-10-07 15:57:37 +03:00
Gaith Hallak
1c83287d45
Add separate flags for each scode optimization (#410)
* Add separate flags for each scode optimization

* Add a list of available optimizations to docs

* Update CONTRIBUTING.md

* Update docs/aeso_compiler.md

Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com>

* Prefix rules functions with optimize_ instead of r_

Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com>
2022-10-07 12:09:53 +03:00
Gaith Hallak
da92ddbd5d
Polymorphism fixes (#415)
* Assume that void is a supertype of all types

* Add test for void supertype

* Unify functions with decls from implemented interfaces

* Rename delete_if_implementation

* Match only with function name and without typesig
2022-10-04 12:40:50 +03:00
Gaith Hallak
c1c169273c
Add options to enable/disable certain optimizations (#409)
* Add flags to enable/disable specific optimizations

* Fix typos

* Enable/disable scode optimization

* Update CHANGELOG.md

* Remove optimize_all option
2022-08-30 10:14:46 +03:00
Gaith Hallak
ad4c341a4a
Bump version to 7.0.1 (#408)
* Fix broken link in CONTRIBUTING.md

* Bump version to 7.0.1 and update CHANGELOG.md
v7.0.1
2022-08-04 19:38:24 +02:00
Gaith Hallak
f964fa89a1
Add CONTRIBUTING.md (#406)
* Add CONTRIBUTING.md

* Include CONTRIBUTING.md in README.md

* Fix broken links

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Use "If a PR" instead of "If the PR"

* Mention fold and pretty printing

* Add missing precedence of the operator '|>'

* Add a note about tests

* Rename to Sophia

* Add missing using keyword

* Update the entire list of keywords in sophia syntax doc

* Add a section about creating a new aesophia release
2022-08-04 19:35:48 +04:00
Gaith Hallak
8d8d9c6b83
Update Sophia syntax docs to include missing information about existing syntax (#405)
* Add main contract, contract interface, and guards to the docs syntax

* Use Sep1 instead of Sep for the GuardedDef

* Add guarded case for switches

* Change '=' to '::=' in GuardedDef

* Add Using

* Add '|>' binary operator to aeso_syntax

* Add assign patter

* Fix typos

* Add polymorphism implmented interface syntax
2022-08-03 22:25:42 +02:00
Gaith Hallak
c98ea25e8b
Fix: Get the type of Chain.create() from its application (#407)
* Get the type of Chain.create() from its application

* Add test contract

* Update CHANGELOG.md

* Update the tests

* Update tests again
2022-08-03 22:24:22 +02:00
Radosław Rowicki
4dbc9858fb
Prepare 7.0.0 release, upgrade to OTP24 (#402)
* Prepare v7.0.0 release

* OTP25

* Try OTP24

* Update aebytecode

* aeb 3.1.1

* Update CHANGELOG.md

Co-authored-by: Hans Svensson <hanssv@gmail.com>

* Update rebar.lock

Co-authored-by: Hans Svensson <hanssv@gmail.com>
Co-authored-by: Gaith Hallak <gaithhallak@gmail.com>
v7.0.0
2022-07-28 21:38:18 +02:00
Gaith Hallak
51f9eaa934
Update the documentation and changelog to include polymorphism (#396)
* Update CHANGELOG

* Docs: first part

* Docs: first part (subtyping)

* Update docs/sophia_features.md

Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com>

* Update docs/sophia_features.md

Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com>

* Update docs/sophia_features.md

Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com>

* Change "the same type" to "compatible types"

* Formatting for subtyping rules

* Note about type variance

* Update docs/sophia_features.md

Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com>

Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com>
2022-07-25 18:47:16 +02:00
Radosław Rowicki
0ebcf006e2
Prepare for new repl (#401)
Minor tweaks that are used by aerepl
2022-07-25 18:46:54 +02:00
Gaith Hallak
381a7c98cd
Handle all user generated code errors in the type checker (#394)
* Move the missing_definition error to the type checker

* Move the parameterised_event and parameterised_state errors to the type checker

* Remove check_state_and_event_types from ast_to_fcode

* Move missing_init_function to the type checker

* Remove the code error last_declaration_must_be_main_contract

* Expand the tests for missing init function

* Remove found_void error

* Move the higher order entrypoint error to type checker

* Move invalid_aens_resolve_type error to type checker

* Add more tests for AENS.resolve

* Add test for AENS.resolve with using

* Move invalid_oracle_type error to type checker

* Move old code errors tests to compilable_contracts

* Remove the file aeso_code_errors.erl

* Add comment about state type
2022-07-25 19:48:46 +04:00
Radosław Rowicki
4bec4e5107
Added support for EXIT op (#397)
* EXIT op

* changelog

* docs

* Update CHANGELOG.md
2022-07-08 15:56:29 +02:00
Marco Walz
4dd247b159
Merge pull request #399 from aeternity/mkdocs-updates
chore: update deps and remove caching of python libs
2022-07-06 13:15:58 +02:00
marc0olo
d926c4a7e3 chore: update deps and remove caching of python libs 2022-07-06 10:05:44 +02:00
Nikita Fuchs
7b8957b46a
Update sophia_stdlib.md (#350)
* Update sophia_stdlib.md

add more precise description of oracle TTLs

* Update sophia_stdlib.md
2022-06-18 12:03:46 +02:00
Gaith Hallak
e46226a693
Polymorphism support (#357)
* Add polymorphism to syntax tree and parser

* Add polymorphism to infer types

* Fix pretty printing

* Add new tests and fix old tests

* Fix the comparison between unit and empty tuple

* Report undefined interface errors before checking implemented interfaces

* Add test for implementing multiple interfaces

* Add test for implementing two interfaces with entrypoints of same names and different types

* Add tests for interfaces implementing interfaces

* Draft: Add variance switching

* Revert "Draft: Add variance switching"

This reverts commit 92dc6ac169cfbff447ed59de04994f564876b3fb.

* Add variance switching

* Fix broken tests

* Fix broken abi tests

* Add tests for variance switching

* Fix tests after rebase

* Variance switching for custom datatypes

* Fix dialyzer warning

* Add testing for custom types variance switching

* Make opposite_variance a separate function

* Make is_subtype/4 a separate function

* Fix warning

* Mark tvars as invariant

* Add type_vars_uvar ets table to ets_tables()

* Don't destroy and recreate type errors table when not needed

* Fixes from the reviews

* Use is_list to check if a var is a list

* Compare named args in fun_t

* Test only for covariance and contravariance

* Remove arrows_in_type and use infer_type_vars_variance instead

* Add tests for option and type aliases

* Fix previous commit

* Rename check_implemented_interfaces_recursive to check_implemented_interfaces1

* Make interfaces declare functions from extended interfaces

* Restore test.aes

* Add test for variance switching in records

* Enable variance switching for record types

* Handle builtin types type variables separately

* Add tests for oracles and oracle queries

* Replace compare_types with non-throwing version of unify

* Add the context to unification error

* Test variance switching for bivariant records

* Give clear names to the records in records variance switching test

* Handle comments about polymorphism_variance_switching.aes

* Rename datatypes in custom types variance switching test for readability

* Change the variance of the oracle_query type vars

* Add test for accessing maps with the wrong type

* Default to invariant when the variance of the type vars is unknown

* Rename test files to have common prefix

* Rename functions in variance switching tests for readability

* Fix variance inference

* Eliminate redundant tests

* Test all cases for bivariant
2022-06-17 13:09:07 +04:00
Gaith Hallak
b599d581ee
Fix warnings reporting and stdlib warnings (#367)
* Fix stdlib warnings

* Mark unused includes when used from non-included files

* Do not mark indirectly included files as unused

* Show unused include warning only for files that are never used

* Remove unused include from Option.aes

* Consider functions passed as args as used

* Return warnings as a sorted list

* Fix failing tests

* Fix dialyzer warning

* Fix warning in Func.aes
2022-06-14 12:22:32 +04:00
Gaith Hallak
b3767071a8
Allow binary operators to be used as lambdas (#385)
* Add operator lambdas

* Do not register anonymous functions as called functions

* Add tests

* Update CHANGELOG

* Update the docs

* Do not allow (..) to be used as a lambda

* Rename the function sum to any
2022-06-03 13:12:23 +04:00
Gaith Hallak
b0e6418161
Ban empty record definitions (#384)
* Ban empty record declarations

* Use definition instead of declaration

* Fix the failing test
2022-05-25 17:59:46 +04:00
Gaith Hallak
a894876f56
Show the file name in the location if the file is included (#383) 2022-05-10 18:27:06 +04:00
Radosław Rowicki
0af45dfd19
Deprecate AEVM (#375)
* Deprecate AEVM

* Fix test, changelog

* Restore old rebar

* rebar lock fix

* undo export

Co-authored-by: Gaith Hallak <gaithhallak@gmail.com>

* undo export

Co-authored-by: Gaith Hallak <gaithhallak@gmail.com>

* Solve GH suggestions

* Fix the docs

* update docs

* Remove unused tests

* undo weird change

Co-authored-by: Gaith Hallak <gaithhallak@gmail.com>
2022-05-10 15:33:59 +02:00
Gaith Hallak
c5bfcd3bdc
Add MCL_BLS12_381 types to from_fate_builtin (#382)
* Add MCL_BLS12_381 types to from_fate_builtin

* Add tests for mcl_bls12_381 types to sophia value
2022-05-05 13:19:43 +04:00
Dincho Todorov
85879f5380
Fix BLS12_381.fp and BLS12_381.fr size in the docs (#377) 2022-04-27 17:10:56 +03:00
Dincho Todorov
8897cc6cbd
Fix bls12_381 anchor in the stdlib docs (#376) 2022-04-26 20:10:11 +03:00
Marco Walz
0ec7fdc6ac
Merge pull request #368 from aeternity/docs/improve-stdlib-structure
docs: order namespaces alphabetically and place Set in includables
2022-04-12 12:49:40 +02:00
Gaith Hallak
74aff5401b
Introduce pipe operator |> (#371)
* Add pipe operator

* Add tests

* Update docs and CHANGELOG
2022-04-12 12:40:32 +03:00