124 Commits

Author SHA1 Message Date
Gaith Hallak
7a1e94c1e6 Fix annotations 2023-06-09 13:30:25 +03:00
Gaith Hallak
3ef72e9091 Use lookup instead of lookup_all 2023-06-09 13:30:25 +03:00
Gaith Hallak
864189ee5e Add DBG_LOC op to step at function sig 2023-06-09 13:24:07 +03:00
Gaith Hallak
ee4c0eee34 Remove col from fann 2023-06-09 13:24:07 +03:00
Gaith Hallak
801231d628 Fill out empty fann() when possible 2023-06-09 13:23:36 +03:00
Gaith Hallak
a752fa5b48 Remove fann() from fsplit_pat() and fpat() 2023-06-09 13:23:36 +03:00
Gaith Hallak
f6beec0a7c Add file to aeso_syntax:ann() 2023-06-09 13:23:36 +03:00
Gaith Hallak
eb16d2f77b Add file to fann() 2023-06-09 13:23:36 +03:00
Gaith Hallak
354e49c5d3 Add line to fann() 2023-06-09 13:23:36 +03:00
Gaith Hallak
5ef52c0dc3 Rname Ann to FAnn when the type is fann() 2023-06-09 13:23:36 +03:00
Gaith Hallak
116fefc244 Fix missing fann() in tuple fexpr() 2023-06-09 13:17:04 +03:00
Gaith Hallak
835b186499 Add fann() to nil 2023-06-09 13:17:04 +03:00
Gaith Hallak
7648732879 Add fann() to tuple 2023-06-09 13:17:04 +03:00
Gaith Hallak
0611bcae9d Add fann() to con 2023-06-09 13:17:04 +03:00
Gaith Hallak
9f082b1af2 Add fann() to builtin 2023-06-09 13:17:04 +03:00
Gaith Hallak
7abf93e0e0 Add fann() to lit and get_state 2023-06-09 13:17:04 +03:00
Gaith Hallak
d11f3107a4 Add fann() to switch 2023-06-09 13:17:04 +03:00
Gaith Hallak
08174e5dbf Add fann() to var 2023-06-09 13:17:04 +03:00
Gaith Hallak
431e983940 Fix the spec for compute_state_layout 2023-06-09 13:17:04 +03:00
Gaith Hallak
5046c08b9f Dead code removal 2023-06-09 13:17:04 +03:00
Gaith Hallak
81fc1de479 Add missing functions specs 2023-06-09 13:17:04 +03:00
Gaith Hallak
2d4e1d7026 Add fann() to builtin_u 2023-06-09 13:17:04 +03:00
Gaith Hallak
3f129b3b04 Add fann() to lam 2023-06-09 13:17:04 +03:00
Gaith Hallak
48136ef719 Add fann() to let 2023-06-09 13:17:04 +03:00
Gaith Hallak
a027ac4f6a Add fann() to op 2023-06-09 13:17:04 +03:00
Gaith Hallak
44ec5db132 Add fann() to def and def_u 2023-06-09 13:17:04 +03:00
Gaith Hallak
74f0b3a2db Add fann() to set_proj 2023-06-09 13:17:04 +03:00
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
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
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
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
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
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
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
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
74aff5401b
Introduce pipe operator |> (#371)
* Add pipe operator

* Add tests

* Update docs and CHANGELOG
2022-04-12 12:40:32 +03:00
Gaith Hallak
a982f25262
Pattern guards for functions and switch statements (#339)
* Add case guards to parser

* Add pattern guards to infer types and fcode generation

* Add functions guards

* Add test for patterns guards

* Update docs

* Update CHANGELOG.md

* Remove stateful context from Env for guards

* Elaborate on guards

* Add failing test for stateful pattern guards

* Implement multiple guards

* Fix tests

* Disable aevm related tests

* Split the sentence before if and otherwise

* Fix type in docs

* Implement multiple exprs in the same guard

* Fix pretty printing

* Change tests to include multiple guards

* Add test for non-boolean guards

* Desugar clauses with guards

* Fix incomplete patterns bug

* Fix docs

* Compile to icode when no guards are used

* Revert "Disable aevm related tests"

This reverts commit e828099bd97dffe11438f2e48f3a92ce3641e85b.
2021-10-20 11:04:00 +03:00
Hans Svensson
6d79d2d558
GH344 - Add builtin types in decoder (#345)
* Only use basic types in type_env

* Add builtin types to the calldata/result decoder for FATE
2021-09-30 19:11:00 +02:00
Gaith Hallak
e8a171dc45
Allow assigning patterns to variables (#336)
* Change syntax tree and parser

* Add assign pattern to type inference

* Use check_expr instead of hard-coded type

* Add fcode generation for assign pattern

* Implement rename_spat for assign pattern

* Add tests

* Update CHANGELOG.md

* Update docs and changelog

* Add letpat to aeso_syntax_utils:fold

* Use Plus instead of Scoped
2021-09-11 16:18:30 +02:00
Ulf Norell
d07b321b25 Fix #324: bug when compiling default init in the presence of child contracts 2021-07-05 09:29:43 +02:00
Radosław Rowicki
e8b32a6875
Call.fee (#313)
* Call.fee

* nice align
2021-05-24 14:30:57 +02:00
Radosław Rowicki
1d9f59fec3
Contract factories and bytecode introspection (#305)
* Support for CREATE, CLONE and BYTECODE_HASH

* Add missing files

* Pushed the clone example through the typechecker

* CLONE compiles

* Fix dependent type in CLONE

* Bytecode hash fixes

* Refactor

* Refactor 2

* move some logic away

* Fixed some error messages. Type inference of child contract still does some random shit\n(mistakes arguments with result type)

* CREATE sometimes compiles and sometimes not

* Fix some scoping/constraint issues

* works, needs cleanup

* cleanup

* Fix some tests. Remove optimization of singleton tuples

* Fix default argument for clone

* Cleanup

* CHANGELOG

* Mention void type

* Address review, fix some dialyzer errors

* Please dialyzer

* Fix failing tests

* Write negative tests

* Docs

* TOC

* missing 'the'

* missing 'the'

* missing 'the'

* missing 'the'

* mention pre-fund

* format

* pre-fund clarification

* format

* Grammar in docs
2021-05-18 12:21:57 +02:00
radrow
ad78f440d9 Merge lima 2020-04-02 15:32:26 +02:00